COBOL description of a generated Program
The COBOL code is generated from the information that is indicated in the design editor of the instance and from the possible insertions of specific code. To help you understand the generated COBOL code and decide where to insert your specific code, this page explains the variables that are present in the COBOL code and describes the generated functions.
The COBOL code of a Program starts with the COBOL IDENTIFICATION DIVISION, which is generated from the Program Definition.
Then, the ENVIRONMENT DIVISION is generated from the Data Structure calls. It is adapted to the type of COBOL code of the Program.
The DATA DIVISION is also generated from the Data Structure calls. Its FILE SECTION must not be modified in any way, except through the actual description of the Data Structures.
The WORKING-STORAGE SECTION and the PROCEDURE DIVISION are described in detail in this page.
WORKING-STORAGE SECTION
The WORKING-STORAGE SECTION contains the variables and indexes that are used by the Program. They are generated according to the Data Structure characteristics and to their calls in the Program.
The beginning of the WORKING-STORAGE SECTION contains the generated descriptions of the files with an organization W: File description in Working, or an organization L: Working with placement or D: DL/1, IDS I and II with an alphabetic placement code.
- The BLANC constant is generated if the Program includes a file with a usage M: Transaction to be validated or N: Transaction not to be validated.
- The IK variable is always generated.
- The date-related variables,
- The CONDITIONAL-VARIABLES,
- The table indexes,
- The work areas and variables for validation,
- The tables for Reports,
- The automated totaling fields.
Code | Meaning |
---|---|
DATCE | Variable that contains a CENTUR field for the century and a blank date field (DATOR) to store the processing date as year-month-day (DATOA-DATOM-DATOJ). DAT6, DAT8, DAT8E, DAT6C, and DAT8C are used to format the date. |
DATSEP | Separator in dates (default value: /). |
Code | Meaning |
---|---|
FTBn | Final total control break at level n. During the iteration, the processing is ended on all the Data Structures that are synchronized on input for all the records with the same key at the level n. |
ITBn | Initial total control break at level n. During the iteration, the processing is started on all the Data Structures that are synchronized on input for all the records with the same key at the level n. |
dd-FBn | Final control break on Data Structure dd at
level n. The last record at level n on Data Structure dd is ready for processing. |
dd-IBn | Initial control break on Data Structure dd at
level n. The first record at level n on Data Structure dd is ready for processing. |
dd-CFn | Configuration of Data Structure dd at
level n. At level n, the input record of Data Structure dd is to be processed in this iteration. |
dd-OCn | Occurrence on Data Structure dd at
level n. At level n, a record of Data Structure dd is being processed in this iteration. |
dd-FT | End-of-Processing indicator on Data Structure dd. All the records of Data Structure dd have been processed. |
dd-FI | End-of-File indicator on Data Structure dd. All the records of Data Structure dd have been read. |
Code | Meaning |
---|---|
IddssM | Contains the value of the maximum number of entries that can be specified by the user. |
IddssL | Contains the value of the number of entries that are actually loaded from Segment ss in Data Structure dd. This number cannot exceed IddssM. |
IddssR | Used for all look-ups on the table that is loaded from Data Structure dd, Segment ss. After the table is loaded, this index is set to zero if there is no overflow, or to the number of records read if an overflow has occurred. |
5-dd00-CPTENR | Record counter for Data Structure dd. It is incremented with each sequential read and write. |
Code | Meaning |
---|---|
DE-ERR | Contains the presence status of each Data Element
of the transaction file in the record. Each elementary Data Element
(eeeeee) that is not a FILLER or
an optional Data Element, is provided with a status field within the
table. This field is named ER-ss-eeeeee (ss is
the Segment). It can take the following values:
The last field in the table is ID-ER.
It stores the identification errors. It can take the following values:
|
DEL-ER | Contains the presence status of the Data Element that is being processed |
ER-PRR | Completes the transfers between DE-ERR and a Data Structure whose usage is M: Transaction to be validated, N: Transaction not to be validated, or E: Transaction with error checking with a reduced error array. |
GR-PRR | Contains, for each record type of the transaction
file, the presence status of the record in a transaction. Each record
type is provided with a status field within this table. This field
is named SE-ER(I01). It can take the following values:
The last field in the table is named TR-ER.
It contains the errors. It can take the following values: :
|
SE-ERE | Contains the presence status of the record that is being processed. |
GR-ER | Indicates whether an error was detected on transactions that are meant to update a record of a permanent file. |
UT-ERUT | Contains the user’s errors. |
Code | Meaning |
---|---|
CAT-TAB | Category table that contains all the categories to be printed in this iteration |
ST-TA | Table that contains the structure number, constant part number, and page or line skip for the category to be printed |
r-LAB | Table that contains the constants for Report r |
ST-SLS | Structure number, constant part number, and skip before printing a line |
CATX | Category that is being printed |
5-dd00-rPC | Page counter for Report r in Data Structure dd |
5-dd00-rLC | Line counter for Report r in Data Structure dd |
5-dd00-rLCM | Counter for the maximum number of lines per page |
r-cc-NL | Number of lines that are required to print the category cc of Report r |
Jddrcc | Index that is associated with the repetitive
category cc for Report r of Data
Structure dd. It contains the rank of the category cc that is being printed when the structures are being loaded. |
Code | Meaning |
---|---|
Trst-eeeeee(n) | Accumulator at level n, for Data Element eeeeee of structure st in Report r. |
Grst-eeeeee | Grand total accumulator, for Data Element eeeeee of structure st in Report r |
PROCEDURE DIVISION
The PROCEDURE DIVISION is generated from the Data Structure or Segment calls, the specific insertions, and the Macro calls.
Function code | Function goal |
---|---|
F01 | Initializations. This function is always generated. It contains a subfunction F01dd with an OPEN instruction and a prime READ instruction for a dd Data Structure with control break or file matching. |
F05 | Reading of sequential files with no control
break. This function contains a subfunction F05dd for each dd input Data Structure without control break or file matching. |
F10 | Reading of sequential files with control breaks. This function contains a subfunction F10dd for each dd input Data Structure with control breaks. |
F20 | End of run. This function contains a subfunction F20dd to close each dd Data Structure with control breaks or file matching. It also contains a subfunction 2099 that generates a STOP RUN instruction if the Program does not contain any sort file. |
F22 | Calculation of file control breaks. This function is generated if a principal, consulted, or transaction file contains a control break. |
F24 | File matching logic. This function is generated if a control break is indicated on at least one input Data Structure with no file matching, or if an input or input-output Data Structure is a principal Data Structure. |
F26 | Total control break logic. This function is generated if control breaks and file matching are indicated on a principal, consulted, or transaction file. |
F30 | Calculation of validation variables. This function is generated if an input Data Structure is a transaction file. |
F33 | Identification validation. This function is generated if a record type or an action code is indicated on the transaction Data Structure of the Program. This function contains a subfunction F33AA for the record type validation and a subfunction F33BB for the action code validation. |
F36 | Duplicate record validation. This function is generated if the Program contains a Data Structure that has a usage M: Transaction to be validated and that contains control breaks. The record type element must be part of the sort key and be the minor-most control break level, or the Data Structure must have only one Segment. |
F39 | Presence of Data Elements. This function is generated if the Program contains an input transaction Data Structure whose usage is M: Transaction to be validated or N: Transaction not to be validated. |
F42 | Record structure validation. This function is generated if the Program contains a Data Structure with a usage M: Transaction to be validated. This function contains a subfunction F4210 to validate the presence or the absence of the Data Elements from the common part, and a subfunction F4220 to validate the presence or the absence of the Data Elements from the specific part. |
F45 | Data Element contents validation. This function is generated if the Program contains a Data Structure with a usage M: Transaction to be validated. This function contains a subfunction F4500 to validate the contents of Data Elements from the dd00 record, and a subfunction F45nn to validate the contents of the Data Elements from the ddnn record. |
F51 | Record presence validation. This function is generated if the Program contains a Data Structure that has a usage M: Transaction to be validated and that contains more than one record type. This function contains a subfunction F5110 to detect the invalid presence of records, and a subfunction F5120 to detect the invalid absence of records. |
F70 | Existence validation. This function is generated if the Program contains a Data Structure with a usage M: Transaction to be validated or N: Transaction not to be validated and whose Data Elements update one or more principal Data Structures. This function contains a subfunction F70dd for each dd Data Structure to be updated. |
F73 | Update. This function is generated if a transaction Data Structure updates a principal Data Structure. |
F76 | Storing of errors and backout. This function is generated if the Program contains a transaction Data Structure. It contains the errors that are detected by the validations and retrieves the initial state of each record from the principal files in the case of an error. This function contains a subfunction F76dd for each dd Data Structure to be updated. These subfunctions are run when the Data Structures are on the final total control break. |
F8R | Report logic for Report R. This function is generated if the Program contains a Report. A function F8R is generated for each Report to be printed. Each function is divided
into 2 subsets:
Each function contains the following elements:
|
F90 | Writing of files. This function is generated if the Program contains an output sequential file sequential with a usage D: Output file, S: Selected, R : Result, or E: Transaction with error checking. This function contains the WRITE functions for the output files. It is not conditioned. It contains a subfunction F90dd (dd: Data Structure) for each output file. |
F95 | Function called by PERFORM. This function is generated from the functions 05 or 10, if a Data Structure has an organization W: File description in Working in the Data Structure calls. The subfunction F9520 is the default date transformation subfunction. The number of this subfunction can be modified by indicating the DATPRO option in the Program. |