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

Redefines copybook for multiple layout records


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

New User


Joined: 19 Sep 2006
Posts: 29

PostPosted: Tue Jun 10, 2008 1:36 pm
Reply with quote

Hi, i have the following requirement.

I am having a following input file, with different layout records

10001abcdefghij25
1000275abcdefghij
10001abcdefghij45
1000255abcdefghij
10001abcdefghij55
1000245abcdefghij
10001abcdefghij65
1000235abcdefghij

The record start with 10001 is first detail record and the one start with 10002 is second detail records,
both are having different layout, eXcept id num field is same.

first Records(10001) have following fields
id num 9(5)
name x(10)
age x(02)
filler x(63).

second Records(10002) have following fields(age and name are changed)
id num 9(5)
age x(02)
name x(10)
filler x(63).

input file length is 80.

i want to create a copybook as member to view the above the file in
file Aid. i don't want to use this copybook in program , i just need this copybook for viewing the file for some report purpose.

i created a copybook, but i am getting error, can u please correct this or give the exact copybook such

if id num is 10001,it should use first record layout and displays in file aid.
similarly for id num is 10002, it should use second record layout.

i used the copybook, it shows all the records in all layout.
05 WS-RECORD.
10 ID-NUM PIC 9(5).
10 REM-FIELDS PIC X(75).
10 RECORD1 REDEFINES REM-FIELDS.
15 NAME1 PIC X(10).
15 AGE1 PIC X(02).
15 FILLER PIC X(63).
10 RECORD2 REDEFINES REM-FIELDS.
15 AGE2 PIC X(02).
15 NAME2 PIC X(10).
15 FILLER PIC X(63).

please provide the exact copybook.
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Tue Jun 10, 2008 3:39 pm
Reply with quote

Your copybook works for me in file-aid for the data given by you.

Hope you have coded the fields in the copybook from position 8 and not before it?
Back to top
View user's profile Send private message
sankar_MF

New User


Joined: 19 Sep 2006
Posts: 29

PostPosted: Tue Jun 10, 2008 4:25 pm
Reply with quote

Hi,
When I use the following copybook, i am able to see the records in File aid.
05 WS-RECORD.
10 ID-NUM PIC 9(5).
10 REM-FIELDS PIC X(75).
10 RECORD1 REDEFINES REM-FIELDS.
15 NAME1 PIC X(10).
15 AGE1 PIC X(02).
15 FILLER PIC X(63).
10 RECORD2 REDEFINES REM-FIELDS.
15 AGE2 PIC X(02).
15 NAME2 PIC X(10).
15 FILLER PIC X(63).

But, Record is displayed for both the layouts....Actually it should be displayed for one layout Right? if id num is 10001, first layout alone should be used and if id num is 10002 second layout alone shoudl be used.
How to acheive this?... i am getting both the outputs as following in File aid.


RECORD: 1 WS-RECORD
---- FIELD LEVEL/NAME ------- -FORMAT- ----+----1----
5 WS-RECORD 80/GRP
10 ID-NUM 5/NUM 10001
10 REM-FIELDS 75/AN abcdefghij25
(POS 41-75)
10 RECORD1 REDEFINES REM-FIELDS
10 RECORD1 75/GRP
15 NAME1 10/AN abcdefghij
15 AGE1 2/AN 25
15 FILLER 63/AN
( POS 41-63)
10 RECORD2 REDEFINES REM-FIELDS
10 RECORD2 75/GRP
15 AGE2 2/AN ab
15 NAME2 10/AN cdefghij25
15 FILLER 63/AN
(POS 41-63)

How to view the records in a particualar layout alone.?

thanks
Sankar
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Tue Jun 10, 2008 4:37 pm
Reply with quote

sankar_MF wrote:
Hi,
When I use the following copybook, i am able to see the records in File aid.
05 WS-RECORD.
10 ID-NUM PIC 9(5).
10 REM-FIELDS PIC X(75).
10 RECORD1 REDEFINES REM-FIELDS.
15 NAME1 PIC X(10).
15 AGE1 PIC X(02).
15 FILLER PIC X(63).
10 RECORD2 REDEFINES REM-FIELDS.
15 AGE2 PIC X(02).
15 NAME2 PIC X(10).
15 FILLER PIC X(63).

But, Record is displayed for both the layouts....Actually it should be displayed for one layout Right? if id num is 10001, first layout alone should be used and if id num is 10002 second layout alone shoudl be used.
How to acheive this?... i am getting both the outputs as following in File aid.


RECORD: 1 WS-RECORD
---- FIELD LEVEL/NAME ------- -FORMAT- ----+----1----
5 WS-RECORD 80/GRP
10 ID-NUM 5/NUM 10001
10 REM-FIELDS 75/AN abcdefghij25
(POS 41-75)
10 RECORD1 REDEFINES REM-FIELDS
10 RECORD1 75/GRP
15 NAME1 10/AN abcdefghij
15 AGE1 2/AN 25
15 FILLER 63/AN
( POS 41-63)
10 RECORD2 REDEFINES REM-FIELDS
10 RECORD2 75/GRP
15 AGE2 2/AN ab
15 NAME2 10/AN cdefghij25
15 FILLER 63/AN
(POS 41-63)

How to view the records in a particualar layout alone.?

thanks
Sankar


AFAIK in file-aid you cannot split the record types based on your requirements. You just redefine the record with different record types and view/use the suitable fields. File-aid or any file utility for that matter displays the records based on your copybook and fills all the fields of the copybook
Back to top
View user's profile Send private message
sankar_MF

New User


Joined: 19 Sep 2006
Posts: 29

PostPosted: Tue Jun 10, 2008 5:36 pm
Reply with quote

Hi Manu,
Thanks for your reply.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Jun 13, 2008 12:41 am
Reply with quote

Did you try creating XREF for file-aid here?
I think creating an XREF will perfectly fulfil your requirement.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Jun 13, 2008 12:45 am
Reply with quote

Quote:
File-aid or any file utility for that matter displays the records based on your copybook and fills all the fields of the copybook

If your statement was true then companies will be wasting all their money in products like FILE-AID. FILE-AID can do much more than that.
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Fri Jun 13, 2008 8:44 am
Reply with quote

As abhijit stated define 2 xref's for the record layouts you want and mention the starting position for each layout
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top