Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Odd bit of COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 171
Location: Seattle, WA

PostPosted: Tue Jul 09, 2019 4:46 am    Post subject: Odd bit of COBOL
Reply with quote

Here's an odd bit of COBOL:
Code:

PERFORM 5500-PARAGRAPH
  VARYING WS-SUB-1 FROM +1 BY +1
       UNTIL WS-SUB+1 > WS-LIC-STATUS
       AFTER WS-SUB-2
         FROM +1 BY +1
        UNTIL WS-SUB-2 > WS-LIC-STATUS


Is this like an inner loop on WS-SUB-2 with WS-SUB-1 being the outer loop? Such as the paragraph is performed until WS-SUB-2 is greater than the licenses status, then WS-SUB-1 is increased by 1 and we loop through WS-SUB-2 until it is greater than the licenses status again?

If that isn't what it's doing, does someone have an explanation?
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8553
Location: Dubuque, Iowa, USA

PostPosted: Tue Jul 09, 2019 7:38 am    Post subject: Reply to: Odd bit of COBOL
Reply with quote

You could have coded up a test for this using a DISPLAY for 5500-PARAGRAPH in maybe 10 minutes and you would have gotten your answer much earlier.

Your assumption about how the PERFORM works is correct -- WS-SUB-2 is varied from 1 to WS-LIC-STATUS for each value of WS-SUB-1 starting at 1 and continuing until WS-LIC-STATUS. This is assuming, of course, that the typo error in your code is corrected (WS-SUB+1 could be either WS-SUB-1 + 1 or WS-SUB-1); your comments are assuming the latter case.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2443
Location: NY,USA

PostPosted: Tue Jul 09, 2019 3:29 pm    Post subject:
Reply with quote

This shall explain the concept for this and more of a such scenarios.
https://www.ibm.com/support/knowledgecenter/en/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/ref/rlpsperf.htm
Back to top
View user's profile Send private message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 171
Location: Seattle, WA

PostPosted: Tue Jul 09, 2019 8:19 pm    Post subject:
Reply with quote

Thanks guys! Tremendous help as always!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Restart logic by using cursor name in... Twinkle22 Mainframe Interview Questions 1 Wed Jul 29, 2020 11:26 am
No new posts COBOL Developers Perspectives on Soft... achakarov COBOL Programming 4 Sat Jul 18, 2020 1:26 am
No new posts CALL statement in COBOL for VSE Kirthishine COBOL Programming 3 Fri Jun 26, 2020 12:12 pm
No new posts Question for Cobol Report Writer jackzhang75 COBOL Programming 3 Wed May 27, 2020 4:35 am
No new posts Compare multiple files using JCL/Rexx... tanvi110788 JCL & VSAM 4 Tue May 19, 2020 5:47 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us