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

Copy Book Declaration


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 6966
Location: porcelain throne

PostPosted: Fri Jan 16, 2009 5:57 pm
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

Superior Member


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

PostPosted: Fri Jan 16, 2009 10:17 pm
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

Moderator Emeritus


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

PostPosted: Fri Jan 16, 2009 11:27 pm
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
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

Moderator Emeritus


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

PostPosted: Tue Jan 20, 2009 11:17 am
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 ).
ibmmainframes.com/viewtopic.php?t=33725&highlight=copy+replace

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:
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
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
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

Superior Member


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

PostPosted: Tue Jan 20, 2009 1:19 pm
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:

www.ibmmainframes.com/viewtopic.php?t=29175&highlight=redefines
www.ibmmainframes.com/viewtopic.php?t=24349&highlight=redefines
www.ibmmainframes.com/viewtopic.php?t=31503&highlight=redefines
www.ibmmainframes.com/viewtopic.php?t=24349&highlight=redefines
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: Tue Jan 20, 2009 8:23 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts Need COBOL COPY Help in MVS Environment COBOL Programming 4
No new posts Issue after ISPF copy to Linklist Lib... TSO/ISPF 1
No new posts DB2 Table - Image copy unload IBM Tools 2
No new posts How to copy the -1 version of a membe... TSO/ISPF 4
Search our Forums:

Back to Top