Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Uninteresting Query in Cobol

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

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Thu Aug 14, 2008 11:40 am    Post subject: Uninteresting Query in Cobol
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    Post subject:
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    Post subject:
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: 680
Location: NJ

PostPosted: Thu Aug 14, 2008 2:12 pm    Post subject: Reply to: Interesting Query in Cobol
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: 686
Location: Earth

PostPosted: Thu Aug 14, 2008 2:12 pm    Post subject:
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: 680
Location: NJ

PostPosted: Thu Aug 14, 2008 2:15 pm    Post subject:
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: 686
Location: Earth

PostPosted: Thu Aug 14, 2008 2:22 pm    Post subject:
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    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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us