CL Command Reference - CRTLF
CL Command List > CRTLF Reference
Description:
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 keyed logical file over one or more physical files, you must have object operational (*OBJOPR) authority and either object management (*OBJMGT) authority or object alter (*OBJALTER) authority for each of the files specified for the PFILE or JFILE keywords in DDS. To create a non-keyed logical file, only *OBJOPR authority is required.
. This command is conditionally threadsafe. In multithreaded jobs, this command is not threadsafe for distributed files and fails for distributed files that use relational databases of type *SNA.
Examples:
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.