Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can we call a copybook USING a variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Can we call a copybook USING a variable
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: 686
Location: Earth

PostPosted: Fri Aug 31, 2007 3:18 pm    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Fri Aug 31, 2007 3:42 pm    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Fri Aug 31, 2007 4:42 pm    Post subject:
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    Post subject: Reply to: Calling a COPYBOOK
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: 3158
Location: Tucson AZ

PostPosted: Fri Aug 31, 2007 5:07 pm    Post subject: Re: Calling a COPYBOOK
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

Site Director


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

PostPosted: Fri Aug 31, 2007 7:41 pm    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Sat Sep 01, 2007 12:17 pm    Post subject:
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

Site Director


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

PostPosted: Sat Sep 01, 2007 1:55 pm    Post subject:
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    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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us