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

Using same copybook for subsequent call


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

PostPosted: Fri Jul 02, 2010 10:20 am
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

Moderator Emeritus


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

PostPosted: Fri Jul 02, 2010 7:39 pm
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: 2146
Location: At my coffee table

PostPosted: Fri Jul 02, 2010 8:14 pm
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jul 02, 2010 8:27 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Call program, directly from panel CLIST & REXX 9
No new posts Trying to change copybook in online c... CICS 4
No new posts Help to Filter File Manager Copybook ... DFSORT/ICETOOL 14
Search our Forums:

Back to Top