View previous topic :: View next topic
|
Author |
Message |
alois eisshofer
New User
Joined: 13 Mar 2018 Posts: 3 Location: usa
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
|
|
How vague is the question, did you realize?
what is the sqlcode at the time of abend? |
|
Back to top |
|
|
alois eisshofer
New User
Joined: 13 Mar 2018 Posts: 3 Location: usa
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
alois eisshofer
New User
Joined: 13 Mar 2018 Posts: 3 Location: usa
|
|
|
|
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 |
|
|
|