SORT SPECIAL REGISTERS - IBM Mainframe

Special registersare reserved words that name storage areas generated by the compiler. Their primary use is to store information produced through specific COBOL features. Each such storage area has a fixed name, and must not be defined within the program.

For programs with the recursive attribute, for programs compiled with the THREAD option, and for methods, storage for the following special registers is allocated on a per-invocation basis:

  • ADDRESS-OF
  • RETURN-CODE
  • SORT-CONTROL
  • SORT-CORE-SIZE
  • SORT-FILE-SIZE
  • SORT-MESSAGE
  • SORT-MODE-SIZE
  • SORT-RETURN
  • TALLY
  • XML-CODE
  • XML-EVENT

For the first call to a program, for the first call to a program following a cancel of that program, or for a method invocation, the compiler initializes the special register fields to their initial values. For the following four cases:

  • Programs that have the INITIAL clause specified
  • Programs that have the RECURSIVE clause specified
  • Programs compiled with the THREAD option

Methods the following special registers are reset to their initial value on each program or method entry:

  • RETURN-CODE
  • SORT-CONTROL
  • SORT-CORE-SIZE
  • SORT-FILE-SIZE
  • SORT-MESSAGE
  • SORT-MODE-SIZE
  • SORT-RETURN
  • TALLY
  • XML-CODE
  • XML-EVENT

Further, in the above four cases, values set in ADDRESS OF special registers persist only for the span of the particular program or method invocation.

In all other cases, the special registers will not be reset; they will be unchanged from the value contained on the previous CALL or INVOKE.

Unless otherwise explicitly restricted, a special register can be used wherever a data-name or identifier that has the same definition as the implicit definition of the special register (which is specified later in this section) can be used.

You can specify an alphanumeric special register in a function wherever an alphanumeric argument to a function is allowed, unless specifically prohibited. If qualification is allowed, special registers can be qualified as necessary to provide uniqueness.

The following table shows how the SORT special registers are used in VS COBOL II.

Sorting and SORT Special Registers in VS COBOL II

Sorting and SORT Special Registers in VS COBOL II

Sorting and SORT Special Registers in VS COBOL II

Storage Use during a Sort or Merge Operation

In general, the more storage DFSORT has available, the faster the sorting operation is performed. Certain parameters specified during the installation of DFSORT determine the amount of storage used during its operation. Storage must be reserved for:

  • COBOL programs that are dynamically called from an input or output procedure
  • COBOL run-time library routines (if the RES compiler option was specified)
  • Data management modules that can be loaded into the region for use by an input or output procedure
  • Any storage obtained by these modules.

The sort program should not allocate all the free space in the region for its COBOL operation. For a specific execution of a sort or merge, you can override the values specified at installation. The MAINSIZE and RESINV keywords on the OPTION control statement in the IGZSRTCD data set, or the SORT-CORE-SIZE special register, can be used for this purpose. Be careful not to override the storage allocation to the extent that all the free space in the region is used for sort's operation in your COBOL program. If the COBOL debug tool is to be active during a sort or merge, a minimum of 132000 bytes (decimal) must be reserved for the DEBUG modules.

Checkpoint/Restart during DFSORT

Checkpoints taken during DFSORT execution, unless taken by DFSORT, cannot be used to restart. Restarts using checkpoints are invalid if taken by your VS COBOL II program while SORT or MERGE statements execute. The restarts are detected and canceled. If checkpoints are to be taken during a sorting operation, add a DD statement for SORTCKPT in the run-time JCL. There are two ways to take a checkpoint while a SORT or MERGE statement is executing:

  • To cause DFSORT to take checkpoints that are usable for restart, code in the following l-O control paragraph: RERUN ON assignment-name
  • Code the CKPT (or CHKPT) keyword m an OPTION control statement in the IGZSRTCD data set.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IBM Mainframe Topics