View previous topic :: View next topic
|
Author |
Message |
kunal jain
New User
Joined: 19 May 2011 Posts: 59 Location: India
|
|
|
|
Hi, my CICS program is calling a subprogramusing dynamic CALL statement.
CALL WS-SUB-PROGRAM using WS-COPYBOOK.
Please advise if I need to code for ON EXCEPTION/OVERFLOW clause in CALL statement.
I would really appreciate your reply on this. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
ON EXCEPTION/OVERFLOW on a CALL statement in COBOL is used if -- and only if -- the called subprogram cannot be located. So the answer to your question is ... it depends upon YOU. If you ensure the subprogram is always available, then there would be no reason to code ON EXCEPTION or ON OVERFLOW. If you do not ensure that the subprogram is always available, you might want to code ON EXCEPTION or ON OVERFLOW to indicate this problem in some way (since, presumably, the subprogram not being available will affect the results you send back to the screen).
Personally, I've never had a need to use ON EXCEPTION or ON OVERFLOW for a CALL statement -- but then I've only been coding COBOL programs (batch and CICS) for 37 years or so; the need might yet arise. |
|
Back to top |
|
|
kunal jain
New User
Joined: 19 May 2011 Posts: 59 Location: India
|
|
|
|
Thank you so much Robert, for the quick reply .
I am planning to code in below manner:
CALL WS-SUB-PROGRAM using WS-COPYBOOK.
(Note: SUB-PROG-RETURN-CODE is populated by WS-SUB-PROGRAM)
IF SUB-PROG-RETURN-CODE = '00'
CONTINUE
ELSE
MOVE 'Y' to WS-CALL-FAILED-SUB-PROG
END-IF
As you indicated if ON EXCEPTIOn or ON OVERFLOW is not coded & sub-program is not available, then how will the execution of CALL statemnt will respond based on the above code.
1) Will Calling program will abend disruptly
OR
2) Control will go to ELSE part of above IF logic.
Please advise. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
The IF statement would never be executed, so your (2) point is completely irrelevant.
CICS would detect an abend when the program is not found and would kill the transaction, so the CALL statement would be the last line of code executed.
Since there are at least three ways to ensure the program is found (by statically linking the subprogram to the main program or by compiling the subprogram into a link pack area -- or LINKLIST -- load library or by compiling the subprogram into the library used by the CICS region -- which may require a recompile if the program moves from a test to qa or production CICS region), there really should be no reason to use the ON EXCEPTION / ON OVERFLOW structure in your code. But as I said earlier, it depends entirely upon YOU and your site's coding standards and procedures.
And this is really a question you should be posing at your site; since we do not work at your site, we do not know what your site standards are and hence cannot provide definitive answers. At my site, for example, we have a specific LINKLIST library that application programmers can compile subprograms into just for cases like yours -- but not all sites do this. |
|
Back to top |
|
|
kunal jain
New User
Joined: 19 May 2011 Posts: 59 Location: India
|
|
|
|
I am glad to see myself as more confident than before posting my doubt here.
Thank you !!!
This forum is amazingly the best for mainframe users. |
|
Back to top |
|
|
|