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
 
Copy Book Declaration

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

New User


Joined: 15 Dec 2008
Posts: 10
Location: INDIA

PostPosted: Fri Jan 16, 2009 2:21 pm    Post subject: Copy Book Declaration
Reply with quote

i have six copy book
1 is generic and other defines the record
i have to declare its structre but i am bit confuse can anyone please help...
description of copybook is given below
Code:

1)
MAIN.CPY
10  (P)-PRIMARY-KEY PIC X(23).
10  (P)-DATA.
  15 FILLER          PIC X(4476). 

2)
ONE.CPY
10  (P)-KEY.
   15 ABC   PIC X(29).

3)
TWO.CPY
15 (P)-REC  PIC X(421).

4)
THREE.CPY
10  (P)-HEADER.
  15 (P)-REC PIC X(420).

5)
FOUR.CPY
15  (P)-REC-TY    PIC X(420).

6)
FIVE.CPY
15  (P)-REC-T     PIC X(420).

how to declare it i am confuse
i have written like this (P)-DATA has to be redefines...
Thanks in advance
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jan 16, 2009 5:57 pm    Post subject:
Reply with quote

piyush,

why do you think anyone
outside your organization
would know how to put this puzzle together?
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 Jan 16, 2009 10:17 pm    Post subject:
Reply with quote

Hi,

Since afternoon (IST) I was thinking how to reply this question -

- thought to suggest to look into some similar program at your shop
- then wanted to ask decide on - what do you want ? Do you want to drive your program or progrm should drive you..phew..then I give up didn't post anything.

However Dbz beats me anyway..

May be posting your question in rather structured manner would give me one more chance to compete dbzTHEdinosauer.. icon_wink.gif
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 Jan 16, 2009 11:27 pm    Post subject:
Reply with quote

Hello,

If these copybooks define a "record" you need to tell more about the record(s). Is this file fixed or variable? Why are there 6? Why do you believe you need 6? Why the level numbers used? What does the data look like (show a few example data records)?

Quote:
i have to declare its structre but i am bit confuse can anyone please help...
You are likely less confused than we are. . .

Once some clear information is posted about what you want to do , someone should be able to help.
Back to top
View user's profile Send private message
piyushksah

New User


Joined: 15 Dec 2008
Posts: 10
Location: INDIA

PostPosted: Tue Jan 20, 2009 10:57 am    Post subject: Reply to: Copy Book Declaration
Reply with quote

hi my actual copybook looks like..these declaration
i have these copybook and i have to use the variable declared in this copybook into my program...for making changes and using some conditions..
Code:


1)MAIN(total=4499)

               10  (P)00-PRIMARY-KEY.
                   15  (P)00-CUID                PIC S9(05) COMP-3.
                   15  (P)00-CU-BR               PIC S9(03) COMP-3.
                   15  (P)00-RPT-NBR             PIC  X(05).
                   15  (P)00-SUB-RPT             PIC  X(10).

               10  (P)00-DATA.
                   15  FILLER                      PIC  X(4476).



                   
2)ONE(total=29)


               10  (P)X100-KEY.
                   15  (P)X100-STATE              PIC X(02).
                   15  (P)X100-ID                 PIC S9(05) COMP-3.
                   ..
                   ..
                   ..
                   15  FILLER                     PIC  X(03).

3)TWO(total=420)

                   15  (P)X100-REC-TYPE0        PIC  X(01).
                       88  (P)X100-TYPE-0         VALUE '0'.
                   15  (P)X10000-TOT-HEADER       PIC  S9(03) COMP-3.
                   15  (P)X10000-FILLER-1         PIC  X(417).



4)THREE(total=420)

              10  (P)X10001-HEADER-A.
                   15  (P)X10001-REC-TYPE         PIC  X(01).
                       88  (P)X100-TYPE-A         VALUE '1'.
                   15  (P)X10001-FILLER-1         PIC  X(02).
                   15  (P)X10001-XMIT-SQ-NBR      PIC  X(03).
                   ..                 
                   ..
                   15  (P)X10001-MATCH-IND        PIC  X(01).
                   15  (P)X10001-FILLER-5         PIC  X(49).


5)FOUR(total=420)

                   15  (P)X10002-REC-TYPEB        PIC  X(01).
                       88  (P)X100-TYPE-B         VALUE '2'.
                   15  (P)X10002-CCYYMM-B         PIC  X(06).
                   15  (P)X10002-PAYEE-CNTL       PIC  X(04).
                   15  (P)X10002-FILLER-1         PIC  X(03).
                   ..
                   ..
                   ..
                   15  (P)X10002-2ND-PAYEE-TIN    PIC  X(09).
                   15  (P)X10002-REGION-ID        PIC  X(01).



6)FIVE(total=420)
                   15  (P)X10003-REC-TYPET        PIC  X(01).
                       88  (P)X100-TYPE-T         VALUE '3'.
                   15  (P)X10003-TOT-ACCTS        PIC S9(09).
                   ..
                   ..
                   ..
                   15  (P)X10003-TOT-DOLLAR-AMT   PIC S9(09).
                   15  (P)X10003-TOT-IRA          PIC S9(09).
                   15  (P)X10003-FILLER-3         PIC  X(320).


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: Tue Jan 20, 2009 11:17 am    Post subject:
Reply with quote

Hello,

I believe you want to use COPY/REPLACING .

Here are a couple of links to similar questions (if i have understood the question icon_smile.gif ).
http://ibmmainframes.com/viewtopic.php?t=33725&highlight=copy+replace

http://ibmmainframes.com/viewtopic.php?t=35873&highlight=copy+replace

At the top of the page is a link to "IBM Manuals" which will also have complete information. One of these is the COBOL Language Reference. From that manual is:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3lr10/8.1.4?
which shoould help.
Back to top
View user's profile Send private message
piyushksah

New User


Joined: 15 Dec 2008
Posts: 10
Location: INDIA

PostPosted: Tue Jan 20, 2009 11:35 am    Post subject:
Reply with quote

thanks for the help..i'll chek the link
Back to top
View user's profile Send private message
piyushksah

New User


Joined: 15 Dec 2008
Posts: 10
Location: INDIA

PostPosted: Tue Jan 20, 2009 12:45 pm    Post subject:
Reply with quote

i have tried after reading in the given links..
Code:

05 9T12-IN-REC.
   COPY MAIN REPLACING ==(P)== BY ==PKS==.
   10 9T12-RT-DATA  PIC X(420)  REDEFINES PKS-DATA.
05 9T12-W-DATA.
   COPY ONE REPLACING ==(P)== BY ==PKS==.
       COPY TWO REPLACING ==(P)== BY ==PKS==.
   COPY THREE REPLACING ==(P)== BY ==PS==.
   10 9T12-W-HEADER  REDEFINES PKS-DATA.
      COPY FOUR REPLACING ==(P)== BY ==PKS==.
      COPY FIVE REPLACING ==(P)== BY ==PKS==.


could anyone help...


it is showing the following compilation error
REDEFINES" object "PKS-DATA" was not the immediately preceding level
Clause was discarded.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Tue Jan 20, 2009 1:19 pm    Post subject:
Reply with quote

Hello,
piyushksah wrote:
REDEFINES" object "PKS-DATA" was not the immediately preceding level Clause was discarded.
And what does this convey to You ?

Suggest you check the COBOL reference Manual for Redefines, here are some threads on Redefine from this froum:

http://www.ibmmainframes.com/viewtopic.php?t=29175&highlight=redefines
http://www.ibmmainframes.com/viewtopic.php?t=24349&highlight=redefines
http://www.ibmmainframes.com/viewtopic.php?t=31503&highlight=redefines
http://www.ibmmainframes.com/viewtopic.php?t=24349&highlight=redefines
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: Tue Jan 20, 2009 8:23 pm    Post subject:
Reply with quote

Hello,

When the code specifies REDEFINES, the field names must exist.

Your MAIN copybook has no PKS-DATA field. You do have a PKS00-DATA field. . .
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts XMITIP sends it out. Can it copy on l... Rommel Dayon Rustia IBM Tools 0 Tue Sep 05, 2017 10:16 am
No new posts Unable to copy data from spool in a d... srikant314 JCL & VSAM 8 Fri Jul 28, 2017 9:10 pm
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 7 Thu Apr 27, 2017 1:15 am
No new posts Copy load modules and alias vasanthz IBM Tools 5 Thu Apr 20, 2017 6:31 am

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