gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] trailing paragraphs in nested programs ?


From: Patrick
Subject: Re: [open-cobol-list] trailing paragraphs in nested programs ?
Date: Thu, 29 Aug 2013 09:04:39 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130809 Thunderbird/17.0.8


Can you provide an example of what you mean?

Otherwise I am 'Assuming' you refer to:

--------------------------

zz999-we-are-done.

goback.

(or) stop run.

*>

zz999-no-we-are-not.

*>

add 1 to a b.

move whatever to whatever-2.

etc, etc.

---------------------------

Which of course you can do.

Vince




Hi Vince

I figured it out while trying to come up with an example to post. I really should have tried a little harder to work though it before posting, a late night mistake sorry to everyone.

Here is what went wrong in case this thread is useful to someone else:

I have a Cobol 85 reference book(which I cannot find at the moment). It had an example of nested programs, each terminated by END PROGRAM. I did not find a nested program example in Stern and even thought the index mentions one(page 366), I did not find an example in Murach either.

I was able to create nested programs using END PROGRAM but only the outer most could have "trailing paragraphs".

The key item I was missing is that the "trailing paragraphs" have to be sandwhiched between EXIT PROGAM and END PROGRAM or STOP RUN and END PROGRAM.

I have attached an example below. The key part is nested1

Thanks again VInce.

       IDENTIFICATION DIVISION.
       PROGRAM-ID. nestedTest.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       PROCEDURE DIVISION.
       DISPLAY "I am in the procedure div in the outermost program"
       CALL 'nested1'
       CALL 'nested2'
         PERFORM 100-TEST-PARA
       STOP RUN.

        100-TEST-PARA.
        DISPLAY 'I am paragraph in the outermost program'
        .


       IDENTIFICATION DIVISION.
       PROGRAM-ID. nested1.
       PROCEDURE DIVISION.
       DISPLAY "this is nested 1"
       PERFORM 101-TEST-PARA
        .
       EXIT PROGRAM.

        101-TEST-PARA.
        DISPLAY 'I am test paragraph in nested1'
        .
       END PROGRAM nested1 .



       IDENTIFICATION DIVISION.
       PROGRAM-ID. nested2.
       PROCEDURE DIVISION.
       DISPLAY "I am nested 2"
        .
       END PROGRAM nested2
        .


       END PROGRAM nestedTest.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]