IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Copybook Scope Terminator within IF/Evaluate Conditions


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramanindya55

New User


Joined: 23 May 2008
Posts: 9
Location: pune

PostPosted: Thu Mar 18, 2010 8:27 pm
Reply with quote

Hi,
I have following code.
Code:

    IF AGE > 20 AND AGE < 60 THEN
        Move 'Valid Data' TO WS-OUT-TEXT
    ELSE
        Move 'Invalid Data' TO WS-OUT-TEXT
COPY PRINTEMP.
        DISPLAY 'STILL IN THE ELSE LOOP'
    END-IF.


And in the Copybook, I have following piece of Code. I have not used any Scope terminator in the copybook.

Code:
DISPLAY 'In PRINTEMP copybook'


My Question is whether the display 'STILL IN THE ELSE LOOP' statement will get executed.
If so, How the compiler is interpreting the Scope terminator which I have given after COPYBOOK ?
Please help me if you have any idea.

Thanks in Advance !!!
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Mar 18, 2010 10:44 pm
Reply with quote

Could it be that pesky period at the end of the line?

Code:

COPY PRINTEMP.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 18, 2010 11:59 pm
Reply with quote

Hello,

Quote:
My Question is whether the display 'STILL IN THE ELSE LOOP' statement will get executed.
What happens when you run this?
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Fri Mar 19, 2010 3:37 pm
Reply with quote

Many shops have development standards that also may specify the use of copybooks. I think most standards advice against using copybooks for bringing in code. If the logic should be reuseable globally, put it in a separate submodule.

If your site endorse using copybooks for code, they (your development support) should already know the answer to your question

If the copied statements is some standard execution, it could be made part of a standard template for a Cobol module.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to load to DB2 with column level ... DB2 6
No new posts SCOPE PENDING option -check data DB2 2
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts Db2 SQL - how to switch among differe... DB2 18
No new posts To search DB2 table based on Conditio... DB2 1
Search our Forums:

Back to Top