CL Command Reference - CRTPF
CL Command List > CRTPF Reference
Description:
The Create Physical File (CRTPF) command creates a physical file from the information specified on this command and (optionally) from the data description specifications (DDS) contained in a source file.
A physical file is a database file that contains data records. The data records are grouped into physical file members and each 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. If the desired physical file has a record format with only one character field in arrival sequence or if the file is a source file, a DDS source file is not needed. To override attributes of the file after it has been created, use the Override Database File (OVRDBF) command before the file is opened. To change attributes of the file after it has been created, use the Change Physical File (CHGPF) command.
Restrictions:
. 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 Physical File
CRTPF FILE(PAYLIB/PAYTXS) SRCFILE(SRCLIB/PAYTXS)
MBR(*NONE) MAXMBRS(5)
This command creates a physical file named PAYTXS in the PAYLIB library. The source descriptions in the member PAYTXS in source file PAYTXS in the SRCLIB library are used to create the physical file. The file is created without members (*NONE was specified); therefore, no data can be put into the file until a member is added later. As many as five members can be contained in the file.
By default, each file member added later will contain data records. The access path of each member is continuously maintained. Each member can have up to 10,000 records before automatic extensions (three increments maximum) occur that add 1000 records to the capacity of the member. Storage space for each member is allocated only as needed, with no restrictions on whether the space is contiguous; there is no initial storage allocation. The public has object operational, read, add, delete, and update authority for the file.
Example 2: Creating a Physical File and Member
CRTPF FILE(ORDERCTL/ORDERS) SRCFILE(ORDERCTL/ORDERSRC)
SRCMBR(MFGORD) MAXMBRS(50) SIZE(1000 100 5)
ALLOCATE(*YES)
This command creates a physical file and physical file member, both named ORDERS in the ORDERCTL library. The file and its member are created from the MFGORD source member of the ORDERSRC source file in the same library. Storage space for the records placed in the file need not be contiguous. Up to 50 members can be contained in the file. The initial allocation of storage provides for up to 1000 records, and up to five increments of additional space for 100 records each can be added automatically. These allocation values also apply to each member of this physical file that is added later.