Where allowed to run: All environments (*ALL) Threadsafe: Conditional |
Parameters Examples Error messages |
The Create Logical File (CRTLF) command creates a logical file from the information specified on this command and from the data description specifications (DDS) contained in a source file.
A logical file is a database file that describes how data records contained in one or more physical files are presented to a program. The logical file does not contain data records. The data records are contained in the physical files associated with the logical file.
The data records contained in the physical files are grouped into physical file members. The logical file accesses the data records through one or more logical file members. Each logical file member describes the data contained in one or more physical file members, and each logical file member has its own access path to the data. Normally, database files have only one member which, by default, is added to the file when the file is created.
Restrictions:
To create a non-keyed logical file, only *OBJOPR authority is required.
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
FILE | File | Qualified object name | Required, Positional 1 |
Qualifier 1: File | Name | ||
Qualifier 2: Library | Name, *CURLIB | ||
SRCFILE | Source file | Qualified object name | Optional, Positional 2 |
Qualifier 1: Source file | Name, QDDSSRC | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
SRCMBR | Source member | Name, *FILE | Optional, Positional 3 |
GENLVL | Generation severity level | 0-30, 20 | Optional |
FLAG | Flagging severity level | 0-30, 0 | Optional |
FILETYPE | File type | *DATA, *SRC | Optional |
MBR | Member, if desired | Name, *FILE, *NONE | Optional |
DTAMBRS | Physical file data members | Single values: *ALL Other values (up to 32 repetitions): Element list |
Optional |
Element 1: Physical file | Qualified object name | ||
Qualifier 1: Physical file | Name, QDDSSRC | ||
Qualifier 2: Library | Name, *CURRENT | ||
Element 2: Members |
Single values: *NONE Other values (up to 32 repetitions): Name |
||
TEXT | Text 'description' | Character value, *SRCMBRTXT, *BLANK | Optional |
OPTION | Source listing options | Values (up to 4 repetitions): *SRC, *NOSRC, *SOURCE, *NOSOURCE, *LIST, *NOLIST, *SECLVL, *NOSECLVL, *EVENTF, *NOEVENTF | Optional, Positional 4 |
SYSTEM | System | *LCL, *RMT, *FILETYPE | Optional |
MAXMBRS | Maximum members | Integer, 1, *NOMAX | Optional |
ACCPTHSIZ | Access path size | *MAX1TB, *MAX4GB | Optional |
PAGESIZE | Access path logical page size | *KEYLEN, 8, 16, 32, 64, 128, 256, 512 | Optional |
MAINT | Access path maintenance | *IMMED, *DLY, *REBLD | Optional |
RECOVER | Access path recovery | *NO, *AFTIPL, *IPL | Optional |
FRCACCPTH | Force keyed access path | *NO, *YES | Optional |
UNIT | Preferred storage unit | 1-255, *ANY | Optional |
FMTSLR | Rcd format selector program | Single values: *NONE Other values: Qualified object name |
Optional |
Qualifier 1: Rcd format selector program | Name, QDDSSRC | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
FRCRATIO | Records to force a write | Integer, *NONE | Optional |
WAITFILE | Maximum file wait time | Integer, 30, *IMMED, *CLS | Optional |
WAITRCD | Maximum record wait time | Integer, 60, *IMMED, *NOMAX | Optional |
SHARE | Share open data path | *NO, *YES | Optional |
SRTSEQ | Sort sequence | Single values: *SRC, *JOB, *LANGIDSHR, *LANGIDUNQ, *HEX Other values: Qualified object name |
Optional |
Qualifier 1: Sort sequence | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
LANGID | Language ID | Character value, *JOB | Optional |
LVLCHK | Record format level check | *YES, *NO | Optional |
AUT | Authority | Name, *LIBCRTAUT, *ALL, *CHANGE, *EXCLUDE, *USE | Optional |
Top |
Specifies the logical file to be created.
If the file is used in a high-level language program, the file name should be consistent with the naming rules of that language; otherwise, the file must be renamed in the program.
This is a required parameter.
Qualifier 1: File
Qualifier 2: Library
Note: If a logical file and the physical file on which it is based are in different libraries, and the logical or physical file does not exist when it is to be restored (such as during disaster recovery or when the files are deleted), the access path is not restored. It is rebuilt. To make it possible for access paths to be restored and not rebuilt, the logical files and the based-on physical files must be in the same library. More information on the restoring of saved access paths is in the Backup and Recovery book, SC41-5304.
Top |
Specifies the source file that contains the data description specifications (DDS) source used to create the logical file.
Qualifier 1: Source file
Qualifier 2: Library
Top |
Specifies the name of the source file member that contains the DDS source for the logical file being created.
Top |
Specifies the severity level of data description specifications (DDS) messages that cause file creation to fail. This parameter applies only to messages created while processing DDS source files.
Top |
Specifies the minimum severity level of messages to be listed.
Top |
Specifies whether each member of the logical file being created contains data records, or contains source records for a program or another file.
Top |
Specifies the logical file member to be added when the logical file is created.
Top |
Specifies the physical files and members that contain the data associated with the logical file member being added by this command. A logical file member can be based on all (*ALL) of the physical files and members on which the logical file itself is based, or the member can be based on a subset of the total files and members.
Note: When adding a member to a logical file that is a DDM file, the physical file, if specified, must also be a DDM file with its library and member(s) specified explicitly. *CURRENT is not supported when the logical file is a DDM file.
When a logical file is created, the physical files specified for the PFILE or JFILE DDS keyword are used to create the logical file. If no library name is specified for the physical files on the PFILE or JFILE keyword, the library list (*LIBL) at file creation time is used to find the physical files; the physical files from the library list are used to create the logical file. The qualified physical files from the PFILE or JFILE keyword (regardless of whether a library name was specified or if the library list was used to find the files) are the physical files associated with the logical file. The names of the physical files associated with the logical file are saved in the description of the logical file. When a member is added to the logical file, the DTAMBRS parameter is used to specify the physical file members associated with the logical file member. Each physical file name specified on the DTAMBRS parameter must be the name of a physical file that is associated with the logical file (saved in the description of the logical file).
Single values
Element 1: Physical file
Qualifier 1: Physical file
The physical file names must match a name on the PFILE or JFILE keywords in the DDS and cannot be specified more often on the DTAMBRS parameter than on the PFILE or JFILE keywords in the DDS. For join logical files, all physical files specified for the JFILE keyword must be specified for the DTAMBRS parameter and each physical file must contain only one member. If a physical file name is not specified for a physical file that is on a PFILE or JFILE keyword in the DDS, the logical file member is not based on any member of that physical file.
Qualifier 2: Library
If a library name is not specified, the current library name (*CURRENT) from the logical file description is used. If the library name is specified, the physical file must be a physical file associated with the logical file. If the logical file is associated with more than one physical file of the same name, the library name must be specified.
Element 2: Member
Single values
Other values (up to 32 repetitions)
When the FILE parameter specifies a join logical file or an arrival sequence logical file, only one data member must be specified for the DTAMBRS parameter for each physical file that was specified for the PFILE or JFILE keyword in the DDS. *ALL is valid only if each based-on physical file has only one member. If any of the physical files has more than one member, the specific physical file member must be specified for the DTAMBRS parameter.
The same physical file name can be specified more than once on the JFILE keyword. In this case, each occurrence of the file name is treated as a different based-on physical file, and must be specified for the DTAMBRS parameter.
Up to 32 qualified physical file names and physical file member names can be specified. Also, the total number of member names cannot exceed 32. For example, one file can specify 32 members, two files can each have 16 members, or 32 files can each have one member specified.
For DDM file:
Top |
Specifies the text that briefly describes the object.
Top |
Specifies the type of output produced when the file is created. A maximum of four of the following values can be specified in any order on this parameter. If neither or both of the values on an option are specified, the first value listed for the option is used.
Note: The first values on each option are similar to, but are not actually default values, and therefore, cannot be changed with the CHGCMDDFT (Change Command Default) command.
Source Listing Option
Program Listing Option
Second-Level Message Text Option
Event File Creation Option
Top |
Specifies whether the logical file is created on the local system or the remote system.
Top |
Specifies the maximum number of members that the logical file can contain.
Top |
Specifies the maximum size of auxiliary storage that can be occupied by access paths that are associated with join logical files or with files that have keyed sequence access paths.
Note: For a join logical file, this parameter applies to all join secondary access paths even if the join logical file is not a keyed file.
Top |
Specifies the access path logical page size that is used when the access path is created.
The access path logical page size is used by the system to determine the size of each page of the index. This logical page size is the amount of bytes of the access path that can be moved into the job's storage pool from the auxiliary storage for a page fault.
Top |
Specifies, for files with key fields or join logical files, the type of access path maintenance used for all members of the logical file.
If the number of changes between a close operation and the next open operation reaches approximately 10 percent of the access path size, the system stops saving changes and the access path is completely rebuilt the next time the file is opened. The access path is updated when the member is opened with records that have been added, deleted, or changed from the member since the last time the member was opened.
Top |
Specifies, for files having immediate or delayed maintenance on their access paths, when recovery processing of the file is performed after a system failure occurs while the access path is being changed. This parameter is valid only for join logical files or files with a keyed access path.
If *IMMED or *DLY is specified for the Access path maintenance (MAINT) parameter, the access path can be rebuilt during initial program load (IPL) (before any user can run a job), after IPL has ended (during concurrent job running), or when the file is next opened. While the access path is being rebuilt, the file cannot be used by any job.
During the IPL, an Override Access Path Recovery display lists those paths that must be recovered and what the RECOVER parameter value is for each path. The user can override the RECOVER parameter value on this display. More information is in the Backup and Recovery book, SC41-5304.
If *REBLD is specified for the MAINT parameter, the access path is rebuilt the next time its file is opened.
Top |
Specifies, for files with key fields or a join logical file, whether access path changes are forced to auxiliary storage along with the associated records in the file. FRCACCPTH(*YES) minimizes (but does not remove) the possibility that an abnormal job end could cause damage to the access path that would require it to be rebuilt.
Note: For a join logical file, this parameter value applies to all join secondary files even if the join file is not a keyed file.
FRCACCPTH(*YES) slows the response time of the system if the access path is changed in an interactive job. If the access path is changed frequently, the overall performance of the system is affected somewhat.
Top |
This parameter is no longer supported. It exists solely for compatibility with releases earlier than Version 3 Release 6 Modification 0 of the OS/400 operating system. For information on using auxiliary storage pools (ASPs), refer to the Backup and Recovery book, SC41-5304.
You can specify the value *ANY or a value ranging from 1 through 255 on this parameter.
Top |
Specifies the record format selector program that is called when the logical file member contains more than one logical record format.
The user-written selector program is called when a record is written to the database file and a record format name is not included in the high-level language program. The selector program receives the record as input, determines the record format used, and returns it to the database.
This parameter is not valid if the logical file has only one record format.
Single values
Qualifier 1: Rcd format selector program
Qualifier 2: Library
Top |
Specifies the number of inserted or updated records that are processed before the records are forced into auxiliary storage.
The force write ratio specified for a logical file cannot be less than or equal to the smallest force write ratio of its based-on files. If a larger force write ratio is specified, it is ignored and a message is sent informing the user of the action.
For example, if the force ratios of three physical files are 2, 6, and 8, the logical file force ratio that is based on these three physical files must be as restrictive as the least of them; that is 2 in this case. Two would be used even if the FRCRATIO parameter is not specified. Thus, each time a program inserts, updates, or deletes two records in the logical file (regardless of which based-on physical files are affected), those records are forced to permanent storage.
If a physical file associated with this logical file is being journaled, a large force write ratio or *NONE is specified. More information on journal management is in the Backup and Recovery book, SC41-5304.
Top |
Specifies the number of seconds that the program waits for the file resources to be allocated when the file is opened, or the device or session resources to be allocated when an acquire operation is performed to the file. If the file resources cannot be allocated in the specified wait time, an error message is sent to the program.
Top |
Specifies the number of seconds that the program waits for a record being changed or deleted. If the record cannot be allocated within the specified wait time, an error message is sent to the program.
Top |
Specifies whether the open data path (ODP) is shared with other programs in the same routing step. When an ODP is shared, the programs accessing the file share facilities such as the file status and the buffer.
Note: This parameter is not valid when *NONE is specified for the Logical file member (MBR) parameter.
Top |
Specifies the sort sequence used for this file. The sort sequence is used with the LANGID parameter to determine which sort sequence table is used.
Single values
Qualifier 1: Sort sequence
Qualifier 2: Library
Top |
Specifies the language identifier used when *LANGIDSHR or *LANGIDUNQ is specified for the Sort sequence (SRTSEQ) parameter. The language identifier is used with the SRTSEQ parameter to determine which sort sequence table the file uses.
Top |
Specifies whether the level identifiers of the record formats in the logical file are checked when the file is opened by a program.
Top |
Specifies the authority you are giving to users who do not have specific authority for the object, who are not on an authorization list, and whose group profile or supplemental group profiles do not have specific authority for the object.
Top |
Example 1: Creating a Logical File Without Members
CRTLF FILE(INVEN/STOCKCTL) SRCFILE(SRCLIB/STKLFSRC) MBR(*NONE)
This command creates a logical file named STOCKCTL, in the INVEN library. The source descriptions in the source file STKLFSRC in the SRCLIB library are used to create the logical file. The file is created without any members (*NONE was specified), and only one member can be added later (because one member is the default for the MAXMBRS parameters). The logical file accesses the data contained in the physical files specified in the DDS source file used to create this logical file. For successful completion of the CRTLF command, the user must have object operational authority for all the physical files specified in the DDS. If the logical file is keyed, object management authority is also required.
Example 2: Creating a Logical File With Members
CRTLF FILE(PAYLIB/PAYCODESEQ) SRCFILE(PAYLIB/PAYTXSRC) DTAMBRS(PAYTRANS FIRSTQTR) AUT(*EXCLUDE) TEXT('Pay taxes in code sequence')
This command creates a logical file and logical file member, both named PAYCODESEQ in the PAYLIB library. The file and its member are created from the PAYTXSRC source file that is in the same library. The logical file member accesses the data contained in the FIRSTQTR member of the physical file PAYTRANS. The logical file is secured for the private use of the owner. The owner must have object operational authority for the PAYTRANS file to create the member. If the logical file is keyed, object management authority is also required.
Top |
*ESCAPE Messages
Top |