Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Using same copybook for subsequent call

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Fri Jul 02, 2010 10:02 am    Post subject: Using same copybook for subsequent call
Reply with quote

I am having a requirement like this:

PROGA is calling PROGB using copybook COPY1
PROGB is calling PROGC using copybook COPY1.

All programs are CICS program.

In the copybook COPY1, some of the request fields are populated by PROGA and some by PROGB, so using same copybook for both of the call.

But while trying to access any variable of that copybook in PROGC, getting S0C1 abend.

Can anyone suggest how to use the same copybook in more than one call under same transaction.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7999
Location: Bellevue, IA

PostPosted: Fri Jul 02, 2010 10:20 am    Post subject:
Reply with quote

You have a very basic, fundamental misunderstanding of COBOL. A copybook is source code that is called into the program when it is compiled. There is, therefore, absolutely no way a copybook can be involved in a run-time CALL to another program. When the call occurs, the copybook has long been copied into the code as part of the compile process. The copybook will not be used at run time for anything.

Accordingly, making statements like
Quote:
PROGA is calling PROGB using copybook COPY1
PROGB is calling PROGC using copybook COPY1.
is complete nonsense -- and cannot occur under any circumstances whatsoever. Variables may be passed from program to program, but they are not copy books at that point -- they are variables in the program and could not be distinguished from a variable defined without a copybook.

You may be calling a program using data included from a copy book but you cannot call a program using a copy book.

So, given from your problem statement that you have no clue about what is going on, try this: what variables are involved in the call from PROGA to PROGB? and what variables are involved in the call from PROGB to PROGC? are the calls COBOL CALL statements, EXEC CICS LINK statements, or something else -- and if so, what? What does the PROCEDURE DIVISION USING look like for PROGB and PROGC?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jul 02, 2010 7:39 pm    Post subject:
Reply with quote

Hello,

Quote:
Can anyone suggest how to use the same copybook in more than one call under same transaction.
As copybooks are usually used in multiple programs, suggest you look at some other programs that use this copybook or at some other copybook that is used by multiple programs.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Jul 02, 2010 8:14 pm    Post subject:
Reply with quote

I assume that:
PROGA has the 01 COPY1 in working storage,
PROGB has the 01 COPY1 in linkage section,
PROGC has the 01 COPY1 in linkage section
&
there is no RETURN done in PROGB prior to the CALL to PROGC.

The obvious problem is that you have lost addressability to PROGC's COPY1.
Try to display the address of PROGB's COPY1 at the start of the program and just before the call to PROGC.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Jul 02, 2010 8:27 pm    Post subject: Reply to: Using same copybook for subsequent call
Reply with quote

The copybook can be defined as EXTERNAL, which makes it addressable in all sub-program's within the run-unit and without having to pass it as a parm.

Bill
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 EZASOKET call to SETSOCKOPT fails Andi1982 COBOL Programming 6 Thu Oct 06, 2016 7:12 pm
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts Copybook structure in Load module Vai123 COBOL Programming 7 Fri Sep 16, 2016 8:29 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Is possible to call subprogram from c... cmsmoon COBOL Programming 3 Fri Aug 05, 2016 6:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us