The Declare File (DCLF) command is used to declare a display or database file to your CL procedure or program. The DCLF command cannot be used to declare files such as tape, diskette, printer, and mixed files. Only one DCLF command is allowed in a CL procedure or OPM program. The DCLF command has the following parameters:
DCLF FILE(library-name/file-name) RCDFMT(record-format-names)
Note that the file must exist before the module or program is compiled.
If you are using a display file in your procedure or program, you may have to specify input and output fields in your DDS. These fields are handled as variables in the procedure or program. When processing a DCLF command, the CL compiler declares CL variables for each field and option indicator in each record format in the file. For a field, the CL variable name is the field name preceded by an ampersand (&). For an option indicator, the CL variable name is the indicator that is preceded by &IN.
For example, if a field named INPUT and indicator 10 are defined in DDS, the DCLF command automatically declares them as &INPUT and &IN10. This declaration is performed when the CL module or program is compiled. Up to 50 record format names can be specified on one command, but none can be variables. Only one record format may be specified for a database file.
If the following DDS were used to create display file CNTRLDSP in library MCGANN:
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A R MASTER A CA01(01 'F1 RESPONSE') A TEXT 300 2 4 A RESPONSE 15 1 8 4 BLINK A A
Three variables, &IN01, &TEXT, and &RESPONSE, would be available from the display file. In a CL procedure referring to this display file, you would enter only the DCLF source statement:
DCLF MCGANN/CNTRLDSP
The compiler will expand this statement to individually declare all display file variables. The expanded declaration in the compiler list looks like this:
* * * 500- DCLF MCGANN/CNTRLDSP QUALIFIED FILE NAME 'MCGANN ' 'CNTRLDSP ' RECORD FORMAT NAME 'MASTER ' CL VARIABLE TYPE LENGTH PRECISION (IF *DEC) &IN01 *LGL 1 &TEXT *CHAR 300 &RESPONSE *CHAR 15 * * * |
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.