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

Uninteresting Query in Cobol


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

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Thu Aug 14, 2008 11:40 am
Reply with quote

Hi all,

Below is the procedure division in our program.

Code:
PROCEDURE DIVISION USING PARM-AREA.                 
-----------------------------------------------------
    PERFORM 0100-GET-DATES THRU 0100-EXIT.           
                                                     
    PERFORM 0200-OPEN-FILES THRU 0200-EXIT.         
                                                     
    PERFORM 0300-PROCESS-CUSIP  THRU 0300-EXIT       
            UNTIL NO-MORE-CUSIP.                     
                                                     
    PERFORM 8000-CLOSE-FILES THRU 8000-EXIT.         
                                                     
    STOP RUN.


0100-GET-DATES thru 8000-CLOSE-FILES para's are defined below. At the end ie., after 8000-CLOSE-FILES there is a pra names 1200-GET-CUSIP- para. AFter which para this 1200-GET-CUSIP will get executed??? Please advise.
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Thu Aug 14, 2008 12:42 pm
Reply with quote

Why do you think it will get executed ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 14, 2008 1:48 pm
Reply with quote

k.a.khamaurutheen,

are you serious? you show us A and then ask if B is invoked.

look at your compile output xref, the paragraph/section will either have a referencing statement or it will not.

more than likely, one of the PERFORMed para/sections that you showed us will invoke the others.

I have included an ISPF EDIT MACRO (that can be used in edit and view) which might help you:
Code:

/*    REXX  */
/*                       member name = whocalls                                                 */
/*  FINDS ALL 'PERFORMS' FOR THE CURSOR SELECTED SECTION.  */
/*                                                         */
/*                                                         */
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ADDRESS ISREDIT
"MACRO"
/*   TRACE ?R                                              */
"(WRKDATA) = LINE .ZCSR"
WRKDATA_LEN = LENGTH(WRKDATA)
/*                                                         */
/*           FIND WORD SECTION. AND THEN WORK BACKWARDS    */
/*           FOR THE SECTION NAME                          */
/*                                                         */
SPACE_POS = INDEX(WRKDATA,' SECTION. ')
IF SPACE_POS = 0 THEN EXIT
WRKDATA = LEFT(WRKDATA,SPACE_POS)
WRKDATA = STRIP(WRKDATA,'B')
WRKDATA_LEN = LENGTH(WRKDATA)
SPACE_POS = LASTPOS(' ',WRKDATA)
IF SPACE_POS > 0 THEN
   DO
     WRKDATA = RIGHT(WRKDATA,WRKDATA_LEN - SPACE_POS)
   END
"FIND ALL " WRKDATA
"X ALL '*' 1"
"X ALL '*' 7"
"FIND FIRST NX" WRKDATA
EXIT


I always code using SECTIONs and NOT PARAGRAPHs. So if the module is paragraphed, you will have to modify the macro.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Thu Aug 14, 2008 2:12 pm
Reply with quote

Hi,

Thanks for your quick response. This code came to my box for analysis. i was just analysing the code and i was just confused how this para is invoked without any call statement!!! This was in production . i will try to pull it in test and do some test hits and let you know the result.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Aug 14, 2008 2:12 pm
Reply with quote

khamarutheen,
Do you mean you code is like-
Code:
8000-CLOSE-FILES.
--- stmts
---
1200-GET-CUSIP- para.
--- stmts
---
---
8000-EXIT.
?
If this is the case and you do PERFORM 8000-CLOSE-FILES THRU 8000-EXIT. then after 8000-CLOSE-FILES para it shoule fall through in to 1200 para. Do you have anything different in your mind?
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Thu Aug 14, 2008 2:15 pm
Reply with quote

Quote:
If this is the case and you do PERFORM 8000-CLOSE-FILES THRU 8000-EXIT. then after 8000-CLOSE-FILES para it shoule fall through in to 1200 para. Do you have anything different in your mind?


Yep it falls like that only... But see the below code. After 8000-Exit. It will stop the execution. I guess it wont go to any other para in the pgm.

Code:
PERFORM 8000-CLOSE-FILES THRU 8000-EXIT.         
                                                     
    STOP RUN.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Aug 14, 2008 2:22 pm
Reply with quote

Yes.
PERFROM -- thru -- can execute multiple paragraphs /sections.
It is the expected behaviour. I don't see any problem here, do you?
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top