Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
batch cobol/db2 paragraph fall thru after the exit to next p

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

New User


Joined: 13 Mar 2018
Posts: 3
Location: usa

PostPosted: Wed Mar 14, 2018 12:21 am    Post subject: batch cobol/db2 paragraph fall thru after the exit to next p
Reply with quote

a batch cobol/db2 pgm that worked for years suddenly abends and the trace shows it goes to the exit of an sql select para and then continues with the next para. the paragraphs are performed using the thru statements.
there are many paragraphs before that perform as expected.
any ideas? we use the latest versions of cobol/db2 and zos.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Wed Mar 14, 2018 12:30 am    Post subject:
Reply with quote

Quote:
any ideas?
The usual -- somehow the code is dropping through because the SQL SELECT paragraph was NOT performed and hence the EXIT has no effect on the code. This has been true for many years and does not depend upon the version of COBOL nor of DB2 nor of z/OS.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


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

PostPosted: Wed Mar 14, 2018 1:11 am    Post subject:
Reply with quote

How vague is the question, did you realize?
what is the sqlcode at the time of abend?
Back to top
View user's profile Send private message
alois eisshofer

New User


Joined: 13 Mar 2018
Posts: 3
Location: usa

PostPosted: Wed Mar 14, 2018 2:09 am    Post subject: cobol/db2 para fall thru
Reply with quote

PERFORM S255-000-SELECT THRU S255-999-EXIT

sqlcode is 100 (not found)

Code:
WHEN WK-805-SUCCESSFUL-CALL             
          ADD +1 TO WA-999-RECORDS-READ (6, 1)
     WHEN WK-805-DATA-NOT-FOUND               
          GO TO S255-999-EXIT                 
     WHEN OTHER                               
          GO TO S900-000-DUAL-MDUL-DB2-ERR   
     END-EVALUATE.                           
                                             
 S255-999-EXIT.                               
     EXIT.                                   
 S300-000-TERMINATE.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Mar 14, 2018 3:09 am    Post subject:
Reply with quote

The code you provided is useless in diagnosing the issue. Your problem is that somehow the S255-999-EXIT paragraph is the subject of a GO TO while not under the control of a PERFORM. The Language Reference manual explains:
Quote:
EXIT statement
The EXIT statement provides a common end point for a series of procedures.
Format

paragraph-name
.
EXIT.

The EXIT statement enables you to assign a procedure-name to a given point in a
program.
The EXIT statement is treated as a CONTINUE statement. Any statements
following the EXIT statement are executed
Since you appear to have an END-EVALUATE just before the paragraph name, it is less likely that you have a pure fall-through -- most likely there is a GO TO directing the program flow to S255-999-EXIT. This particular problem is easiest to resolve if your site has some program flow monitor that can let you see which statements are executed in which order; if you don't have that then your best bet would be to put DISPLAY statements on each paragraph to show the program flow (and yes I know this can be a significant effort but it is a one-time effort since you can make them DEBUG statements and turn them on / off with a single change to your program before a recompile).

And, by the way, it does not matter how long (days or weeks or months or years or decades) the program has been running in production -- either it was recently changed which introduced the bug, or the bug has been in existence since the program was written and you have just uncovered the set of conditions that cause the bug to appear.
Back to top
View user's profile Send private message
alois eisshofer

New User


Joined: 13 Mar 2018
Posts: 3
Location: usa

PostPosted: Wed Mar 14, 2018 7:18 pm    Post subject: Reply to: batch cobol/db2 paragraph fall thru after the exit to next p
Reply with quote

Thanks everyone,
the problem is in a previous paragraph that had a goto exit that went outside of the perform thru exit which then caused the abend.
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 COBOL file declaration jithinraghavan COBOL Programming 1 Fri Nov 16, 2018 10:54 pm
No new posts Accessing control blocks to retrieve ... menonkiran COBOL Programming 4 Wed Nov 14, 2018 9:08 pm
No new posts how to use RDZ for converting cobol c... balajiChid CICS 1 Tue Oct 09, 2018 8:40 pm
No new posts Problem with Return or Exit from DCB ... Vishnu Priya M R PL/I & Assembler 6 Thu Aug 23, 2018 9:43 am
No new posts COBOL - JSON GENERATE husni1972 COBOL Programming 1 Fri Aug 17, 2018 3:29 am

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