SQL adaptation guide For IBM DB2 UDB 8.x, 9x / Connecting to DB2 OS/400 |
Each table in the database is stored in a Physical file. They can be created in the control center with SQL scripts (CREATE TABLE), or with OS/400® commands.
The table creation script file must be copied in the library in the form: library/sourcefile.member
Creation of a physical file:
Type:
CRTSRCPF
Enter field values:
FILE = name of the table (10 characters max).
LIBRARY = name of the library in which the table is created (schema).
RECORD LENGTH = length of the script creation file (in bytes)
MEMBER = *FILE
Execution of the SQL creation script:
Type
RUNSQLSTM
Press F10 for additional parameters
Enter field values:
SOURCE FILE = name of the source file of the script creation file
LIBRARY = name of the library (schema)
SOURCE MEMBER = name of the member of the script creation file
NAMING FIELD = *SQL (SQL Naming convention library.table)
COMMITMENT CONTROL = *NONE
IBM® SQL FLAGGING FIELD = *FLAG
If errors occur, you can use WRKSPLF to display error information saved in the spool file. Use option 5 in the Opt Field on the line of the script file you tried to execute.