Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Adapting COBOL definitions

COBOL definitions that refer to the database key provide an indication of where adaptations to database key values of the extended value range (REC-REF > 254 and/or RSQ > 224-1) may be required in the application program.

The following COBOL definitions refer to the database key:

  • Definition of a COBOL item with type USAGE IS DATABASE-KEY

  • Redefinition with REDEFINES of a COBOL item or subschema item of type USAGE IS DATABASE KEY

  • LINKAGE SECTION describing COBOL or subschema items of type USAGE IS DATABASE-KEY

These definitions thus indicate where adaptations for extended database key values may be required in the application program.

Adapting definitions of COBOL items with USAGE IS DATABASE-KEY

The definition of COBOL items of type USAGE IS DATABASE-KEY or USAGE IS DATABASE-KEY-LONG in the WORKING-STORAGE SECTION of an COBOLD program corresponds to the definition of a database key item in the subschema.

A COBOL item that is defined with USAGE IS DATABASE-KEY indicates that the application program uses database key values. If this COBOL item is also to accept database key values of the extended value range (e.g. with ACCEPT), the type of the COBOL item must be changed to USAGE IS DATABASE-KEY-LONG.

Any COBOL program that only uses database key items (USAGE IS DATABASE-KEY) which are defined within its WORKING STORAGE SECTION can be prepared to use extended database key values (USAGE IS DATABASE-KEY-LONG) even before the database conversion has been performed.

Adapting redefinitions of database key items

Individual components of database key values can be selectively addressed and processed in a COBOL program by redefining them with REDEFINES in the WORKING-STORAGE SECTION.
The following database key items can be redefined:

  • COBOL items of type USAGE IS DATABASE-KEY or USAGE IS DATABASE-KEY-LONG

  • Items of type USAGE IS DATABASE-KEY or USAGE IS DATABASE-KEY-LONG that are defined in a subschema (SUB-SCHEMA SECTION) used by the application program.

All redefinitions for COBOL or subschema items of type USAGE IS DATABASE-KEY-LONG must be adapted accordingly.

Adapting the LINKAGE SECTION

The LINKAGE SECTION in a called COBOL program describes and uses a data structure that is defined outside the program in another called program.

If a subschema or COBOL item of type USAGE IS DATABASE-KEY is addressed in the LINKAGE SECTION of an application program, the following must be checked:

  • whether and how (if relevant) this item is supplied with values,

  • whether this item is supplied with values originating from records of other databases,

  • whether a type conversion is performed when assigning the value.

If the item defined in the called program was changed to the type USAGE IS DATABASE-KEY-LONG, and if the need to pass database key values from the extended value range cannot be excluded in the future, the local definition must also be changed to DATABASE-KEY-LONG.

As a rule, the LINKAGE-SECTION refers to a data item defined in the calling program by means of the COPY statement. It is therefore sufficient to recompile the called program in order to have the data type changes in it copied to the calling program.