Professional Documents
Culture Documents
Working With Database Files in CL Procedures
Working With Database Files in CL Procedures
Working With Database Files in CL Procedures
Purpose
The Declare File (DCLF) command declares one file (by name) to a control language (CL)
program. Only one DCLF command is allowed in a CL program. The command specifies the
name of the file and the record formats to be used in the program. After the file is declared, the
program can contain the data manipulation command RCVF for database files that reference the
file. This enables the program to interact with its user by sending data to and receiving data from
a work station or database file. Database files can be used for input processing only.
When the CL program is compiled, a CL variable is automatically declared for each field in each
record format used in the program. If the file is a non-field level database file, the record format
contains one field with the name of that record format. The field name becomes the variable
name prefixed with an ampersand (&). The attributes of each declared field are the same as the
attributes of the fields in the file. Fields defined in the record format as numeric are defined as
decimal variables. Also, indicators used in the referenced file are declared as logical variables in
the form &INnn, in which nn is the indicator number.
Variables automatically declared by the DCLF command can be used in the program the same as
the variables declared by a DCL command. For example, indicators can be used in expressions
and IF statements because they are declared as logical variables.
The content of the variables, not the variable names, are seen by the user; the display shows one,
some, or all of the fields in the record format that can be filled in by the user. DDS determines
the display format.
If the file is changed (and the file description specifies that level checking is to be
performed), the CL program must be recompiled to match the new file description
If any field name is defined in more than one record format of the display file, the
attributes in each record format for the commonly named field must match.
Any CL variable declared in the program by a DCL command with the same name as an
automatically declared CL variable (for a referenced field) must also have the same
attributes specified in DDS for the referenced field.
The variables used in the file must have data types supported for CL variables. However,
fields defined as packed decimal format, zoned decimal format, or binary format are
declared as decimal variables. The variables used in the file must have attributes that are
valid for CL variables. For decimal variables, the limits are 15 digits and 9 decimal
The file must be a database file with a single record format at run time.
The program may contain only RCVF commands; SNDF, SNDRCVF, ENDRCV, and
WAIT commands are not allowed.
The file is opened by the RCVF command, not the OPNDBF command.