Two requirements exist for creating a CL program from source statements that refer to command definitions or files.
This means that if you use the Declare File (DCLF) command, you must create the file before creating a program that refers to the file.
Access to the command definitions occurs during program creation time and at command run time. To allow for syntax checking, the command must exist during the creation of a program that uses it. If it is qualified at creation time, the command needs to exist in the library referred to during creation, and in the same library when processed. If it is not library-qualified, it must be in some library on the library list during creation time and at run time.
The command name should be qualified in the program:
The name of the command must be the same when the program runs as when the system created it. An error occurs if the command name changes after creating a program that refers to that command. This is because the program cannot find the command when it runs. However, if a default changes for a parameter on a command, the new default is used when that command runs. For more detail on attributes that you may change on a command without having to re-create the command, see the Change Command (CHGCMD) command description in the CL topic of the Programming category in the iSeries Information Center.
The compiler accesses files when compiling a program module that has a Declare File (DCLF) command. The file must exist when compiling a CL module or OPM program that uses it. The file does not have to exist when creating a program or service program that uses the module.
Enter Data Description Specifications (DDS) into a source file before creating it. The DDS describes the record formats and the fields within the records. Additionally, the system compiles this information to create the file object through the Create Display File (CRTDSPF) command.
The fields that are described in the DDS can be input or output fields (or both). The system declares the fields in the CL program or procedure as variables when it compiles a program or module. The program manipulates data from display through these variables.
If you do not use DDS to create a physical file, the system declares a CL variable to contain the entire record. This variable has the same name as the file, and its length is the same as the record length of the file.
CL programs and procedures cannot manipulate data in any types of files other than display files and database files, except with specific CL commands.
Deletion of the DDS after creating the file is possible but not recommended. You can delete the file after the system compiles the CL program or module that refers to the file. This is true provided the file exists when the command referring to it, such as a Receive File (RCVF), is processed in the program.
The rules on qualified names that are described here for command definitions also apply to files. For more details on files, see Working with Files in CL Procedures.
A procedure that is specified by Call Bound Procedure (CALLPRC), does not have to exist at the time a module that refers to it is created. The system requires the existence of the procedure in order to create a program or service program that uses the procedure. The called procedure may be:
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.