Skip to main content

Problem:

This COBOL syntax uses the SPECIAL REGISTER TALLY:

inspect Avariable tallying TALLY for all space

TALLY SPECIAL REGISTER is usable ONLY WHEN Compiler directive OSVS or VSC2 is set

Extract of Net Express on-line help using the keyword TALLY special register:  

!!!!!!   OSVS or VSC2 have to be set

*   TALLY 9(5) COMP

*   The TALLY special register contains information produced by the EXAMINE...TALLYING statement.

*   It is valid as a data-name in a Procedure Division statement wherever an elementary data item can be referenced.

Resolution:

      *SET VSC2

      $SET OSVS

       IDENTIFICATION DIVISION.

       PROGRAM-ID. TESTtally.

       ENVIRONMENT DIVISION.

       DATA DIVISION.

       WORKING-STORAGE SECTION.

       01 MSGTOTALLY pic x(10).

       01 P pic x(10).

       PROCEDURE DIVISION.

       Begin.

         move 0 to tally move "AnyValue" to MSGTOTALLY

         perform doINSPECTTALLYspace

         move 0 to tally move spaces     to MSGTOTALLY

         perform doINSPECTTALLYspace

         STOP RUN

         .

       doINSPECTTALLYspace.

         inspect MSGTOTALLY tallying tally for all space

         display "MSGTOTALLY >>|" MSGTOTALLY "|>>tally = " tally

*  TALLY SPECIAL REGISTER is usable ONLY WHEN usable or WHEN Compiler OSVS or VSC2 set

*   TALLY 9(5) COMP

*   The TALLY special register contains information produced by the EXAMINE...TALLYING  statement.

*   It is valid as a data-name in a Procedure Division statement wherever an elementary data item can be referenced.

Attachments:

progtally.cbl

Old KB# 3835