COBOL description of a generated Server

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 Server whose type is Business Component, Server Monitor, Communication Monitor, or Error Message Server.

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

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 that are used by the Server. They are generated according to the characteristics and calls of the various elements in the Server.

The following tables explain the meaning of the most important variables of the WORKING-STORAGE SECTION:
Table 1. Control variables and indicators
Code Meaning
IK Return code upon a Segment access or a Business Component call:
  • 0: No error
  • 1: Error
CATM Transaction code:
  • C: Creation
  • M: Modification
  • A: Deletion
  • X: Implicit update
A-CATM Description buffer. This buffer contains the action codes that are related to the Logical View data.
A-CATM-CA Action code that applies to non-repeated data. It is always generated.
A-CATM-CR OCCURS N Action code that applies to repeated data. N is the maximum number of repetitions for all the Logical Views in this Server. It is generated if a Logical View of the Business Component contains repeated data.
ICATR Indicator for the category under processing (repetitive data of the Logical View)
ICATRC Number of requested repetitions upon a Business Component call
IRR Number of repetitions that are requested by the Client
OPERB Indicates whether the requested selection is a list
OPERS Operation code
OPERT Management of check, update, and selection services
OPERV Logical View processing indicator:
  • V: The Logical View is recognized by the Business Component
  • blank: The Logical View is not processed by the Business Component
OPER2 Operation code for the call of a second-level Business Component
CH-view view is the Logical View. This field contains a table for the Logical View checks. It is generated if the CHECKSER=YES option is indicated in the Complement tab of the Server Dialog or Server. This table contains one item for each Data Element that is called in the Logical View.
The possible values (to be specified in the Client) are the following values:
  • N: No check on this Data Element (default value),
  • P: No Data Element,
  • blank: All Data Elements are checked.

This field is also used to indicate whether the value of a field in the Logical View is null or not (according to the SQL terminology), so if it is present. For example, the Client can set null values for an update service and the Business Component can return null values for the selection if the corresponding fields in the table are null.

L-CURS-EXTNAM The closing of the cursor is conditioned at the end of a selection service if an extraction method is used.
Table 2. Description of Segments
Code Meaning
02 view-C Data that is transferred from the Client to the Server and in both directions. view is the Logical View.
02 view-S Data that is transferred from the Server to the Client. When the Logical View contains repeated data, a level 01 is also generated.
01 RE-view-delco Repeated data (delco is the group Data Element for the repeated data)
10 1-view-delco Identifier of the repeated structure in the Logical View. This Data Element is declared only once in the Logical View.
Table 3. Error Variables
Code Meaning
DEL-ER Error on a Data Element
IED Maximum number of errors on the Logical View data that the Business Component can detect before the return to the Client. This number is determined by the DATAERR option.
IER Maximum number of errors on database access that the Business Component can detect before the return to the Client. This number is determined by the ACCESERR option.
K50L Work indicator of the number of Segment access errors
K50D Work indicator of the number of Data Element errors
The errors on Data Elements are stored in variables that are prefixed by EE-view. These variables are generated for each Logical View (view) that is called in the Business Component. This table stores the errors that are detected on the Logical View with the ERR operator. The number of items in the table depends on the DATAERR option. Each item contains the information required to format the key that is used to access the error message file.
Table 4. Data Element error variables
Code Meaning
EE-view-LIBRA Library
EE-view-SERVER Business Component
EE-view-VIEW Logical View
EE-view-DATCOD Data Element
EE-view-DATERR Error code
EE-view-DATTYP Error type:
  • S: Standard error
  • U: User error
EE-view-ICATR Line number where the error is detected
The errors on Segments are stored in variables that are prefixed by V-ERR. V-ERR is always generated. It is used to store the database access errors. The OCCURS N depends on the ACCESERR option.
Table 5. Segment error variables
Code Meaning
V-ERR-SEGCOD Erroneous Segment
V-ERR-SEGERR Error code
V-ERR-SEGTYP Error type
V-ERR-ICATR Rank of the erroneous occurrence in a multi-occurrence processing
V-ERR-LIBRA Library
V-ERR-SERVER Business Component
The LINKAGE SECTION, which is the communication area, is used when the Client or the Client Monitor is called. The following three steps are run:
  • The communication area is loaded,
  • The Business Component is called and the communication area is passed on,
  • The message is retrieved upon the return to the Business Component.
The LINKAGE SECTION contains two types of fields:
  • Some fields must not be modified (Table 6)
  • Some fields might be modified if necessary, under your own responsibility only (Table 7). As these fields are loaded in standard, it is recommended to use the intermediate fields that are described in the WORKING-STORAGE SECTION to modify them. You must not add new values or modify the existing values of these fields.

PROCEDURE DIVISION

In this table, function tags are preceded by the COBOL level.
Table 8. Structure of the PROCEDURE DIVISION of a Server
Function code Function goal
05 FSERVER Beginning of Server processing
10 FSERVER-STRVIEW Validation of the structure and length of the communication area buffers
05 FSQL SQL declaration
10 FSQL-WHENEVER WHENEVER clause
10 FSQL-CURSR-segt DECLARE CURSOR clause
05 Fview Processing of the view Logical View
10 Fview-BEGV Initialization of the Logical View processing
10 Fview-CHUP Check and update processing

This processing is constituted of levels 15 Fview-CHUP-CATX for the processing of category X.

The category can be A (before the repetitive category), R (repetitive category), or Z (after the repetitive category).

The following processing is run:
  • 25 Fview-CHUP-CATX-SRVO-INIT for the initializations
  • 25 Fview-CHUP-CATX-SRVO-CHCK for the logical check processing
  • 25 Fview-CHUP-CATX-SRVO-TRAN for the loadings before update
  • 25 Fview-CHUP-CATX-SRVO-UPDT for the logical update processing
  • 25 Fview-CHUP-CATX-SRVO-DONE for the end of service
10 Fview-LOCK Lock
10 Fview-UNLK Unlock
10 Fview-SELC Selection processing

This processing is constituted of levels 15 Fview-SELC-CATX for the processing of category X.

The category can be A (before the repetitive category), R (repetitive category), or Z (after the repetitive category).

The following processing is run:
  • 25 Fview-SELC-CATX-SRVO-INIT for the initializations
  • 25 Fview-SELC-CATX-SRVO-CHCK for the logical check processing
  • 25 Fview-SELC-CATX-SRVO-TRAN for the loadings before update
  • 25 Fview-SELC-CATX-SRVO-UPDT for the logical update processing
  • 25 Fview-SELC-CATX-SRVO-DONE for the end of service
10 Fview-USER User processing
10 Fview-ERRV Error processing for the view Logical View
10 Fview-ENDV End of processing for the view Logical View
05 FSERVER-END End of Server processing. Return to the Client.
Table 9. Elementary processing run by PERFORM from the body of the program
Function code Function goal
10 Fview-TRDT Transfer of data from the Logical View to the Segments for the physical access level

This processing is constituted of levels 15 Fview-TRDT-CATX for the processing of category X.

The category can be A (before the repetitive category), R (repetitive category), or Z (after the repetitive category).

10 Fview-CHKD Check of the Logical View data

This processing is constituted of levels 15 Fview-CHKD-CATX for the processing of category X.

The category can be A (before the repetitive category), R (repetitive category), or Z (after the repetitive category).

10 Fview-TRVW Transfer of data from the Segments to the Logical View for the physical access level

This processing is constituted of levels 15 Fview-TRVW-CATX for the processing of category X.

The category can be A (before the repetitive category), R (repetitive category), or Z (after the repetitive category).

10 Fsegt-CHCK Processing of the logical access level for check on Segment segt

This processing is constituted of levels 15 Fsegt-CHCK-CATX for the processing of category X.

The category can be A (before the repetitive category), R (repetitive category), or Z (after the repetitive category).

The following processing is run:
  • 25 Fsegt-CHCK-CATX-ALIM for the loading of the keys
  • 25 Fsegt-CHCR-CATX-CALL for the calls to physical access level
  • 25 Fsegt-CHCK-CATX-ERRS for the error processing on the physical access level
10 Fsegt-UPDT Processing of the logical access level for update on Segment segt

This processing is constituted of levels 15 Fsegt-UPDT-CATX for the processing of category X.

The category can be A (before the repetitive category), R (repetitive category), or Z (after the repetitive category).

The following processing is run:
  • 25 Fsegt-UPDT-CATX-ALIM for the loading of the keys
  • 25 Fsegt-UPDT-CATX-CALL for the calls to physical access level
  • 25 Fsegt-UPDT-CATX-ERRS for the error processing on the physical access level
10 Fsegt-SLCT Processing of the logical access level for selection on Segment segt

This processing is constituted of levels 15 Fsegt-SLCT-CATX for the processing of category X.

The category can be A (before the repetitive category), R (repetitive category), or Z (after the repetitive category).

The following processing is run:
  • 25 Fsegt-SLCT-CATX-ALIM for the loading of the keys
  • 25 Fsegt-SLCT-CATX-CALL for the calls to physical access level
  • 25 Fsegt-SLCT-CATX-ERRS for the error processing on the physical access level
F80 Physical access level that is run by PERFORM from the logical access level and that are generated in function 80. This function includes the following processing:
  • 10 F80-segt-R: Reading for check
  • 10 F80-segt-RA: Reading for selection
  • 10 F80-segt-RU: Reading for check before update
  • 10 F80-segt-P: Reading of first record
  • 10 F80-segt-RN: Reading of next record
  • 10 F80-segt-W: Creation (WRITE)
  • 10 F80-segt-RW: Modification (REWRITE)
  • 10 F80-segt-D: Deletion (DELETE)
  • 10 F80-segt-UN: Unlock of the record that is read in RU
F81 Additional processing that is run by PERFORM and that is generated in function 81. This function includes the following processing:
  • F81CA: Calculation of the real length of the communication area
  • F81ER: Processing of an unrecoverable error
  • F81FI: Closing
  • F81EC: Setting of the processing to complete in the case of an error (CICS)
  • F81MS: Call of TUXEDO routine for error processing
  • F81RE: Return to the Client
  • F8120: Date check

Function F81 also includes the retrieval of errors. The corresponding subfunctions vary according to the persistent data storage structure.


Feedback