OS/VS COBOL

This appendix describes how to convert OS/VS COBOL.

1. OS/VS COBOL Elements

OS/VS COBOL is internally converted to COBOL and then processed only when the --enable-osvs option is used.

The following are elements used in OS/VS COBOL and how they are converted to COBOL in OpenFrame.

  • AFTER POSITIONING clause

    The following is sample OS/VS COBOL source code.

    AFTER POSITIONING 0
    AFTER POSITIONING 1
    AFTER POSITIONING 2
    AFTER POSITIONING 3

    The following is the converted source code.

    AFTER ADVANCING PAGE
    AFTER ADVANCING 1 LINES
    AFTER ADVANCING 2 LINES
    AFTER ADVANCING 3 LINES
  • EXAMINE statement

    The following is sample OS/VS COBOL source code.

    EXAMINE DATA-A TALLYING UNTIL FIRST " "

    The following is the converted source code.

    MOVE 0 TO TALLY
    INSPECT DATA-A TALLYING TALLY FOR CHARACTERS BEFORE " "
  • EXHIBIT statement

    There are three EXHIBIT statement formats.

    • Format 1

      The following is sample OS/VS COBOL source code.

      WORKING-STORAGE SECTION.
      01 A PIC X(8).
      01 B PIC X(8).
      ...
      EXHIBIT NAMED A B.

      The following is the converted source code.

      WORKING-STORAGE SECTION.
      01 A PIC X(8).
      01 B PIC X(8).
      ...
        DISPLAY "A = " A
                "B = " B
    • Format 2

      The following is a sample OS/VS COBOL source code.

      WORKING-STORAGE SECTION.
      01 A PIC X(8).
      01 B PIC X(8).
      ...
      EXHIBIT CHANGED A B.

      The following is the converted source code.

      WORKING-STORAGE SECTION.
      01 A PIC X(8).
      01 B PIC X(8).
      01 A-CMP PIC X(8).
      01 B-CMP PIC X(8).
      ...
      IF A NOT EQUAL TO A-CMP
        DISPLAY A
      END-IF
      IF B NOT EQUAL TO B-CMP
        DISPLAY B
      END-IF
      MOVE A TO A-CMP
      MOVE A TO B-CMP
    • Format 3

      The following is a sample OS/VS COBOL source code.

      WORKING-STORAGE SECTION.
      01 A PIC X(8).
      01 B PIC X(8).
      ...
      EXHIBIT CHANGED NAMED A B.

      The following is the converted source code.

      WORKING-STORAGE SECTION.
      01 A PIC X(8).
      01 B PIC X(8).
      01 A-CMP PIC X(8).
      01 B-CMP PIC X(8).
      ...
      IF A NOT EQUAL TO A-CMP
        DISPLAY "A = " A
      END-IF
      IF B NOT EQUAL TO B-CMP
        DISPLAY "B = " B
      END-IF
      MOVE A TO A-CMP
      MOVE A TO B-CMP
  • TRANSFORM statement

    The following is a sample OS/VS COBOL source code.

    WORKING-STORAGE SECTION.
    01 A PIC X(8) VALUE "ABCDEFGH"
    ...
    TRANSFORM A FORM "ABC" TO "ZZZ"

    The following is the result source code of converting the previous source code.

    WORKING-STORAGE SECTION.
    01 A PIC X(8) VALUE "ABCDEFGH"
    ...
    INSPECT A CONVERTING "ABC" TO "ZZZ"
  • ON statement

    There are two ON statement formats.

    • Format 1

      The following is a sample OS/VS COBOL source code.

      ON integer
         imperative steatement

      The following is the converted source code.

      WORKING-STORAGE SECTION.
      01 A PIC 9(8) COMP VALUE 0.
      ...
      ADD 1 TO A
      IF A = integer
         imperative statement
    • Format 2

      The following is a sample OS/VS COBOL source code.

      ON integer-1 UNTIL integer-2
         imperative steatement

      The following is the converted source code.

      WORKING-STORAGE SECTION.
      01 A PIC 9(8) COMP VALUE 0.
      ...
      ADD 1 TO A
      IF A > integer-1 AND B < integer-2
         imperative statement
  • CURRENT-DATE special register output format

    To change the output format of CURRENT-DATE special register to MMDDYYYY, use the --CURRENT-DATE "MMDDYYYY" option.

    IDENTIFICATION DIVISION.
    PROGRAM-ID.    TESTCOB.
    DATA           DIVISION.
    WORKING-STORAGE SECTION.
        01 DATE-FORMAT PIC X(8).
    PROCEDURE      DIVISION.
        MOVE CURRENT-DATE TO DATE-FORMAT.
        DISPLAY DATE-FORMAT.

    The following are the usage of OS/VS COBOL compile options and their results.

    ofcob -x TESTCOB.cob --enable-osvs --current-date
    03/22/21
    ofcob -x TESTCOB.cob --enable-osvs --current-date MMDDYYYY
    03/22/21
    ofcob -x TESTCOB.cob --enable-osvs --current-date DDMMYYYY
    22/03/21