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

Can we call a copybook USING a variable


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

New User


Joined: 27 Mar 2006
Posts: 16

PostPosted: Fri Aug 31, 2007 3:14 pm
Reply with quote

Hi can we call a copybook?

i have code like this

-----------a929408--------
01 a
02 b pic x value space
02 c pic x value space
02 d pic x value space
----------------------------

This is a copy book.

now in cobol program he is calling this copy book, like

call a929408 using a.

what it means? is there any value assigned to those b,c,d variables?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Aug 31, 2007 3:18 pm
Reply with quote

I don't think so...
Maybe the programmer wrote it by mistake.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 31, 2007 3:42 pm
Reply with quote

you should do a FIND 'a929408' in your source code. Maybe there is a Reference Name A929408 someplace. If not, then the program will not compile. Did it compile?
Back to top
View user's profile Send private message
earsha

New User


Joined: 16 Mar 2007
Posts: 17
Location: Pune

PostPosted: Fri Aug 31, 2007 4:08 pm
Reply with quote

we can't call a copy book! Instead you can copy the copybook into the source code.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Aug 31, 2007 4:42 pm
Reply with quote

srkumar422,

Show a piece of code from the program, may be, you'll get better responses. By the way, did you follow Dick's suggestion, what was the result?
Back to top
View user's profile Send private message
chiranjeevi_mca

New User


Joined: 19 Feb 2006
Posts: 27

PostPosted: Fri Aug 31, 2007 4:56 pm
Reply with quote

Hi,

Call statement is used to call sub programs only in cobol. COPY statement is used to add copybooks to cobol programs. Copy books will expand while compilation time.

your statemet meaning is calling a subprogram(a929408) using the Group Data-item A. means they already assingned the values for Elementary dataitems. In the called program may be the same structure will be used at in the Linkage section.

Regards
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Aug 31, 2007 5:07 pm
Reply with quote

srkumar422 wrote:
Hi can we call a copybook?
No.
Quote:
now in cobol program he is calling this copy book, like
call a929408 using a.
what it means?
It probably means that there is a routine with the same name as the copybook.
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 Aug 31, 2007 7:41 pm
Reply with quote

Hello,

Copybook a929408 contains the fields used by called module a929408.

Notice that the call specifies "using a" and "a" is the group field of the copybook.
Back to top
View user's profile Send private message
srkumar422

New User


Joined: 27 Mar 2006
Posts: 16

PostPosted: Sat Sep 01, 2007 12:00 pm
Reply with quote

01 WK-CONSTANTS.
05 WK-PGM-NM PIC X(08) VALUE 'AVLB0501'.
05 WK-AVLB7506 PIC X(08) VALUE 'AVLB7506'.
05 WK-AVLB7507 PIC X(08) VALUE 'AVLB7507'.
05 WK-AVLB7508 PIC X(08) VALUE 'AVLB7508'.
05 WK-AVLB9998 PIC X(08) VALUE 'AVLB9998'.
05 WK-AVLB9999 PIC X(08) VALUE 'AVLB9999'.
05 WK-A9294A08 PIC X(08) VALUE 'A9294A08'.
05 WK-PGM-CNST-SEQ-NBR PIC S9(04) COMP VALUE 1.
05 WK-SQL-ERR-911 PIC S9(08) VALUE -911.
05 WK-SQL-ERR-913 PIC S9(08) VALUE -913.

----here he is intializing a variable [/img]WK-A9294A08 TO A9294A08------------

COPY A9294A08.

----Next hi is using this copy book A9294A08 ---------

016200* CALL A9294A08 TO GET INFO ABOUT THE CURRENT JOB.
016300**************************************************
016400
016500 CALL WK-A9294A08 USING WP-A9294A08-UPDT
016600

----Here is calling that copybook usning WK-A9294A08 -----

000200**********************************************************
000300* A9294A08 PARAMETERS
000400**********************************************************
000500
000600 01 WP-A9294A08-UPDT.
000700 05 WP-JOB-NM PIC X(08) VALUE SPACES.
000800 05 WP-STEP-NM PIC X(08) VALUE SPACES.
000900 05 WP-JOB-NBR PIC X(08) VALUE SPACES.
001000 05 WP-RMTID PIC X(08) VALUE SPACES.
001100 05 WP-JOB-TYPE PIC X(01) VALUE SPACES.

-------This is the copy book -------------

After call he is getting some values into these fields and he is using them further.

My question is how values are assigned to these fields with just CALL

Hi Dick,
i did search on A9294A08. In the following sections he is using variable of those copybook thats all. And the code is working fine since 4 years!!!
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: Sat Sep 01, 2007 12:17 pm
Reply with quote

The call is filling in the information, job name, step name, job number and such....I have a similar subroutine at my shop.....
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: Sat Sep 01, 2007 1:55 pm
Reply with quote

Hello,

Find and look at the source for the called module.

When control is passed to A9294A08, it obtains system information and moves it into the WP-A9294A08-UPDT variables (this may be an assembler module).

Quote:
My question is how values are assigned to these fields with just CALL
The CALL passes control to A9294A08.

Let us know if this is not clear.
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Call program, directly from panel CLIST & REXX 9
Search our Forums:

Back to Top