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

CICS program issuing a CALL statement to subprogram.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kunal jain

New User


Joined: 19 May 2011
Posts: 59
Location: India

PostPosted: Fri Dec 21, 2012 6:06 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Dec 21, 2012 6:14 pm
Reply with quote

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
View user's profile Send private message
kunal jain

New User


Joined: 19 May 2011
Posts: 59
Location: India

PostPosted: Fri Dec 21, 2012 6:34 pm
Reply with quote

Thank you so much Robert, for the quick reply icon_biggrin.gif .

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
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Dec 21, 2012 6:45 pm
Reply with quote

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
View user's profile Send private message
kunal jain

New User


Joined: 19 May 2011
Posts: 59
Location: India

PostPosted: Fri Dec 21, 2012 6:55 pm
Reply with quote

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
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 Using API Gateway from CICS program CICS 0
No new posts Calling an Open C library function in... CICS 1
No new posts How to 'Ping' a CICS region in JCL CICS 2
No new posts Parallelization in CICS to reduce res... CICS 4
No new posts DB2 Event passed to the Application P... DB2 1
Search our Forums:

Back to Top