COBOL Perform? - VMS

This is a discussion on COBOL Perform? - VMS ; Can someone explain this little bit of COBOL behavior (Alpha VMS 8.3) please? I expected the EXIT PROGRAM to terminate the program at the end of the mainline, but it seems to fall through and go execute the paragraphs below ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: COBOL Perform?

  1. COBOL Perform?

    Can someone explain this little bit of COBOL behavior (Alpha VMS 8.3)
    please?

    I expected the EXIT PROGRAM to terminate the program at the end of
    the mainline, but it seems to fall through and go execute the
    paragraphs below it. EXIT PROGRAM does appear to be working this
    way elsewhere in code. Huh. maybe I am just too tired right now
    and am missing something utterly simple. I'm used to using GOBACK.

    I did stay up wayyyy to late last night.

    The below is a condensed sample program to illustrate what I mean,
    and the output is reproduced below it.

    Thanks
    -Paul

    ************************************************** *************
    * .MC80-A
    * SAMPLE CODE FOR PERFORM ISSUE
    ************************************************** *************

    IDENTIFICATION DIVISION.
    PROGRAM-ID. MC80 INITIAL.

    DATA DIVISION.
    WORKING-STORAGE SECTION.
    01 WS-EOF-FLAG PIC X(1) VALUE 'N'.

    PROCEDURE DIVISION.
    START-PROGRAM.
    DISPLAY '**** FIRST LINE OF MAINLINE CODE ****'
    MOVE 'N' TO WS-EOF-FLAG
    PERFORM WRITE-TEXT1
    PERFORM UNTIL WS-EOF-FLAG = 'Y'
    DISPLAY ' TEXT FROM PERFORM UNTIL'
    MOVE 'Y' TO WS-EOF-FLAG
    END-PERFORM
    PERFORM WRITE-TEXT2
    DISPLAY '**** LAST LINE OF MAINLINE CODE ****'
    EXIT PROGRAM

  2. Re: COBOL Perform?

    Paul Raulerson wrote:
    > Can someone explain this little bit of COBOL behavior (Alpha VMS 8.3)
    > please?
    >
    > I expected the EXIT PROGRAM to terminate the program at the end of
    > the mainline, but it seems to fall through and go execute the
    > paragraphs below it. EXIT PROGRAM does appear to be working this
    > way elsewhere in code. Huh. maybe I am just too tired right now
    > and am missing something utterly simple. I'm used to using GOBACK.
    >
    > I did stay up wayyyy to late last night.
    >
    > The below is a condensed sample program to illustrate what I mean,
    > and the output is reproduced below it.
    >
    > Thanks
    > -Paul
    >
    > ************************************************** *************
    > * .MC80-A
    > * SAMPLE CODE FOR PERFORM ISSUE
    > ************************************************** *************
    >
    > IDENTIFICATION DIVISION.
    > PROGRAM-ID. MC80 INITIAL.
    >
    > DATA DIVISION.
    > WORKING-STORAGE SECTION.
    > 01 WS-EOF-FLAG PIC X(1) VALUE 'N'.
    >
    > PROCEDURE DIVISION.
    > START-PROGRAM.
    > DISPLAY '**** FIRST LINE OF MAINLINE CODE ****'
    > MOVE 'N' TO WS-EOF-FLAG
    > PERFORM WRITE-TEXT1
    > PERFORM UNTIL WS-EOF-FLAG = 'Y'
    > DISPLAY ' TEXT FROM PERFORM UNTIL'
    > MOVE 'Y' TO WS-EOF-FLAG
    > END-PERFORM
    > PERFORM WRITE-TEXT2
    > DISPLAY '**** LAST LINE OF MAINLINE CODE ****'
    > EXIT PROGRAM
    > .
    >
    > WRITE-TEXT1.
    > DISPLAY ' TEXT FROM PERFORM WRITE-TEXT1'
    > .
    >
    > WRITE-TEXT2.
    > DISPLAY ' TEXT FROM PERFORM WRITE-TEXT2'
    > .
    >
    >
    > ===== output from above program is =====
    >
    > $ link mc80
    > $ r mc80
    > **** FIRST LINE OF MAINLINE CODE ****
    > TEXT FROM PERFORM WRITE-TEXT1
    > TEXT FROM PERFORM UNTIL
    > TEXT FROM PERFORM WRITE-TEXT2
    > **** LAST LINE OF MAINLINE CODE ****
    > TEXT FROM PERFORM WRITE-TEXT1
    > TEXT FROM PERFORM WRITE-TEXT2
    > $
    >




    You need to use STOP RUN, instead of EXIT PROGRAM or GOBACK.

    Jeff

    ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

+ Reply to Thread