COBOL description of a generated Screen

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.

A generation is possible from a Screen whose type is standard, Client, or Client Monitor.

The generated COBOL code is adapted to the hardware, operating system, and TP monitor that are indicated in the Definition of the Dialog or Screen.

The WORKING-STORAGE SECTION and the PROCEDURE DIVISION are described in detail in this page.

WORKING-STORAGE SECTION

The WORKING-STORAGE SECTION contains the constants and variables that are used by the Screen.

The following tables explain the meaning of the most important generated constants and variables:
Table 1. General variables and constants
Code Meaning
CURPOS Cursor position in Screen. CPOSL represents the line number and CPOSC represents the column number.
CPOSN Absolute cursor position in Screen. The origin is CPOSL=1 and CPOSC=1.
INA Number of Data Elements in the Screen-top category. Input field.
INR INA + number of Data Elements in the repetitive category. Input field.
INZ INA + number of Data Elements in the Screen-bottom category. Input field.
IRR Number of repetitions in the repetitive category
INT Number of input fields in the Screen
IER Number of error messages on the Screen
PRDOC External name of the help program
DATOR Field that stores the date of processing as YEAR-MONTH-DAY
DATSEP Separator for dates (default value: /)
DATSET Separator for dates (default value:-)
DAT6, DAT7, and DAT8 Fields for date formatting as DDMMYY or YYMMDD and output format (DD/MM/YY for example). They are generated if a variable Data Element has a date format.
DATCTY Field for loading the century
DAT6C and DAT7C Non-formatted date with century
DAT8C Non-formatted date with century (MM/DD/CCYY)
DAT8G Gregorian-formatted date with century (CCYY/MM/DD)
TIMCO Field for loading the time
TIMDAY Field for loading the formatted time (HH:MM:SS)
5-xxnn-PROGE Field that contains the name of the program to branch to
Table 2. Control variables and indicators
Code Meaning
ICF Input configuration variable:
  • 1: Input Screen
  • 0: No input Screen
OCF Output configuration variable:
  • 1: Output Screen
  • 0: No output Screen
OPER Operation code:
  • A: Display
  • M: Update
  • S: Screen continuation
  • E: End of conversation
  • P: Same Screen
  • O: Call to another Screen
OPERD Operation code for deferred branching:

O: Deferred call to another Screen

Initialized in F0520 and moved into OPER in F40

CATX Code of the category under processing:
  • 0: Beginning of reception or display
  • blank: Screen top
  • R: Repetitive
  • Z: Screen-bottom
CATM Transaction code:
  • C: Creation
  • M: Modification
  • A: Deletion
  • X: Implicit update
ICATR Indicator for the category under processing (repetitive category only)
FT Indicator for the end of the repetitive category:
  • 0: Lines to display
  • 1: No more lines to display
ddss-CF Indicator for the configuration of Segment ddss:
  • 0: The Segment is processed
  • 1: The Segment is not processed
IK Indicator for error on file access:
  • 0: No error
  • 1: Error
Table 3. Error variables
Code Meaning
SCR-ER Indicator of Screen error:
  • 1: No error
  • 4: Error
CAT-ER Indicator of category error:
  • blank: No error
  • E: Error
ER-scrn-delco Indicator of Data Element (delco) error:
  • 0: Data Element absent
  • 1: Data Element present
  • 2: Invalid absence of Data Element
  • 3: Invalid presence of Data Element
  • 4: Erroneous class
  • 5: Invalid content

PROCEDURE DIVISION

Table 4. Structure of the PROCEDURE DIVISION of a Screen
Function code Function goal
F0110 Initializations.

This function is always generated. It initializes the work areas. It sets the processing to be run if an error occurs. It branches to the physical display function after the consultation of the help documentation (if a documentation help character is entered on the Screen definition line). It sets the cursor position for the first display.

F05 Reception and control of the operation code (ICF=1).

This function contains the conditions for all the processing of the reception part of the COBOL, from F05 to END-OF-RECEPTION (F45-FN). The automatic functions in this part of the COBOL are generated if at least variable Data Element is declared as variable.

F0510 Reception of the input message.
F0512 Processing of documentation call if a help documentation call is specified in the Screen Definition. It initializes the fields that are required for the branching to the help documentation Screen.
F0520 Setting of the operation code.

This subfunction is generated if a variable Data Element or a special function key Data Element is defined as an operation code in the Screen -CE Lines.

The OPER internal operation code is set according to the value of the Data Element that is declared as the operation code.

If an error is detected on the operation code value, the processing that comes next in reception is not run.

F1010 Setting of the category to be processed.
This function sets the category to be processed in reception by using the CATX indicator. This indicator can take the following values:
  • 0: Beginning of reception,
  • blank: Screen-top category,
  • R: Repetitive category,
  • Z: Screen-bottom category.

The processing is then generated according to the categories that are defined for the Screen. If no category is defined, the Screen is considered to be a Screen-top category.

This function includes the following processing for the repetitive category:
  • Interactions between the line of the category to be processed and the input Screen description field that is used to access the Data Elements on the line,
  • Initialization and incrementation of the ICATR index, which manages the repetitive category.

If an error is detected (CAT-ER=E) when the processing of a category is complete (F15 to F3999-ITER-FI), SCR-ER is set and the validation processing on the subsequent categories is not run.

F15 Setting of the transaction code.

This function is generated if at least one Data Element is defined as a transaction code in a category of the Screen.

The internal transaction code (CATM) is set according to the value of the Data Element that is defined as a transaction code for the category. This definition can be indicated at 2 levels:
  • The -D Lines of the Data Element,
  • The Additional controls for the selected field of the Screen -CE Lines.
The following subfunctions are generated according to the categories that contain a transaction code:
  • F15A for the Screen-top category,
  • F15R for the repetitive category,
  • F15Z for the Screen-bottom category.

If the transaction code is wrong, the subsequent reception processing is not run.

F20 Data Element validation.

This function is generated when a variable Data Element is specified on the Screen.

The following subfunctions are generated according to the categories that contain a Data Element to validate:
  • F20A for the Screen-top category,
  • F20R for the repetitive category,
  • F20Z for the Screen-bottom category.

The processing of each category contains a subfunction per Data Element to be validated.

The following validations are run:
  • Presence validation,
  • Numeric class validation,
  • Value validation according to the values or value ranges that are defined for the Data Element,
  • Validation of date (by PERFORM) for Data Elements with a date format,
  • Validation of a subfunction (by PERFORM) that is specified in the Additional controls for the selected field of the Screen -CE Lines.

The conditions of each subfunction are generated according to the Data Element processing option.

The validation result for each Data Element is stored in a field that is named ER-scrn-delco (with scrn: last 4 characters of the Screen name and delco: Data Element name). This field can take the following values:
  • 0: Data Element absent,
  • 1: Data Element present,
  • 2: invalid absence,
  • 4: invalid class,
  • 5: invalid value.

CAT-ER is set when an error on a Data Element or a user error is detected.

Subfunctions are numbered according to the number of Data Elements, their position on the Screen, and other parameters. As a result, direct references must not be made to a label that is generated in specific processing. You must use a relative positioning insertion.

F25 Segments to be accessed in reception.

This function is generated when a Segment is accessed in reception.

The following subfunctions are generated according to the categories that contain a Segment to be accessed in reception:
  • F25A for the Screen-top category,
  • F25R for the repetitive category,
  • F25Z for the Screen-bottom category.
The processing of each category includes a subfunction for each access to a Segment. The following processing is run:
  • Initialization of the key if it is indicated in the Screen -CS Lines,
  • Read, or read and update, of the Segment depending on its use in the Screen (by a PERFORM of F80-ddss-R or F80-ddss-RU),
  • Setting of the Segment variable ddss-CF,
  • Error processing, if necessary.

Subfunction F2599 is generated if at least one Segment to be read can be updated. It contains the PERFORM of the F80-ddss-UN functions, according to the Segments in use. It also sets the cursor on the first variable Data Element in the category, if there is an error on a Segment.

Subfunctions are numbered according to the number of Data Elements, their position on the Screen, and other parameters. As a result, direct references must not be made to a label that is generated in specific processing. You must use a relative positioning insertion.

F30 Transfer of Data Elements.

This function transfers the Data Elements of the Screen to the corresponding Data Elements of the Segments.

The following subfunctions are generated according to the categories that contain a Data Element transfer in reception:
  • F30A for the Screen-top category,
  • F30R for the repetitive category,
  • F30Z for the Screen-bottom category.
F35 Segment updates.

This function updates the Segments. If an error is detected by the error checks (CAT-ER), this function is not run.

The following subfunctions are generated according to the categories that contain a Segment to be updated:
  • F35A for the Screen-top category,
  • F35R for the repetitive category,
  • F35Z for the Screen-bottom category.

This function is accessed by running a PERFORM of the appropriate subfunction in F80.

The processing of each category contains one subfunction per Segment to be updated, possibly including several types of access.

For a Segment that does not follow an access to another Segment (no previous Segment), the access is conditioned by the value of the internal transaction code (CATM) for the category. The following values are possible:
  • Creation: writing (F80-ddss-R),
  • Deletion: (F80-ddss-D),
  • Other cases: rewriting (F80-ddss-RW).
For a Segment that follows an access to another Segment, the access is conditioned by the Segment configuration:
  • ddss-CF=0: writing,
  • ddss-CF=1: rewriting.

The 'transaction code' Data Element of the category or the repetitive category line is reset to blank after the update.

Subfunctions are numbered according to the number of Data Elements, their position on the Screen, and other parameters. As a result, direct references must not be made to a label that is generated in specific processing. You must use a relative positioning insertion.

F3999-ITER-FN GO TO F10
F3999-ITER-FT EXIT
F40 This function contains the end-of-reception processing. It is run if no error is found.
F4010 Loading the keys for a new display.

This subfunction is run for a display or an update operation. It assigns values to the keys of the Segments that have no previous Segment and that are used in display.

Depending on the categories, the access key for the Segments in display is stored in the following subfunctions:
  • F40A for the Screen-top category,
  • F40R for the repetitive category,
  • F40Z for the Screen-bottom category.
F4020 Loading the keys for Screen paging.

This subfunction is run for a Screen continuation operation. It stores the first key for the display of the Screen continuation, if the Segment is used in the repetitive category.

F4030 End of transaction.
F4040 Transfer to another Screen.
F45-FN END-OF-RECEPTION
F50 This function contains the conditions for the processing of the display part of the COBOL, from F50 to END-OF-DISPLAY (F78-FN).

If an error is detected, a branching to the error processing function is run. The fields of valid Data Elements remain unchanged and are not transferred to the lines.

F5010 This subfunction is always generated. It initializes the work areas and the description of the display Screen.
F55 Management of the category.
This function sets the category to be processed in display according to the value of the CATX indicator, which can be as follows:
  • 0: Beginning of display,
  • blank: Screen-top category,
  • R: Repetitive category,
  • Z: Screen-bottom category.

The processing is then generated according to the categories that are defined for the Screen. If no category is defined, the Screen is considered to be a Screen-top category.

This function includes the following processing for the repetitive category:
  • Interactions between the repeated line to be processed and the output Screen description field that is used to access the Data Elements on the line,
  • Initialization and incrementation of the ICATR index, which manages the repetitive category.
F60 Accessing the Segments in display.
This function is generated when a Segment is to be accessed for display. The following subfunctions are generated according to the categories that contain a Segment to be accessed for display:
  • F60A for the Screen-top category,
  • F60R for the repetitive category,
  • F60Z for the Screen-bottom category.
The processing of each category includes a subfunction for each access to a Segment. The following processing is run:
  • Loading of the key from the K-cddss-key field that is stored in function F40. For a first display, you must make sure to load the K- field.
  • Accessing by PERFORM the appropriate F80 subfunction, according to the category:
    • Direct read (F80-ddss-R),
    • Sequential read after positioning (repetitive) (F80-ddss-P and F80-ddss-RN), according to the Segment use.
  • Setting of the Segment variable ddss-CF,
  • Error processing, if necessary.

If a Segment has a previous Segment, its read is always a direct read, even in the repetitive category.

Subfunctions are numbered according to the number of Data Elements, their position on the Screen, and other parameters. As a result, direct references must not be made to a label that is generated in specific processing. You must use a relative positioning insertion.

F65 Data Elements transfer.
This function transfers the Segment Data Elements to the corresponding Data Elements on the Screen. The following subfunctions are generated according to the categories that contain the transfer of a Data Element for display:
  • F65A for the Screen-top category,
  • F65R for the repetitive category,
  • F65Z for the Screen-bottom category.
F6999-ITER-FN. GO TO F55
F6999-ITER-FT. EXIT
F70 Error processing.
This function is always generated. It contains the following processing:
  • F7010-A: Testing of DE-ERR, positioning of the error attributes, access to the error message file, and coding of the error message on the Screen,
  • F7010-B: Testing of T-XEMKY, access to the error message file, and coding of the error message on the Screen.
F7020 Setting of the attributes.

This subfunction is generated if the Screen contains at least a variable field.

F78-FN END-OF-DISPLAY
F8Z This function is always generated.
F8Z05 Help subfunction

This subfunction is generated if a documentation help request is entered on the Screen Definition.

F8Z10 Screen display.

This subfunction contains the display of the Screen according to the type of COBOL code.

F8Z20 End of program.
F80

F8095

F8098

Physical accesses.

Screen backup (call of documentation)

Access to the error message file

F81

F81ER

F81UT

F8110

F8115

F8120

F8125

F8130

F8135

F8140

Functions called by PERFORM.

Abnormal end processing

Memorization of user errors

Presence of numeric fields

Initialization of variable fields

Validation and formatting of a date

Transfer of variable fields

Help function processing

Transfer in reception

Cursor position calculation


Feedback