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

batch cobol/db2 paragraph fall thru after the exit to next p


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Mar 14, 2018 12:30 am
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Wed Mar 14, 2018 1:11 am
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Mar 14, 2018 3:09 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
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 Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts How to get a stack trace on a looping... ABENDS & Debugging 5
Search our Forums:

Back to Top