View previous topic :: View next topic
|
Author |
Message |
notonly4u
New User
Joined: 26 Apr 2005 Posts: 87 Location: Hyderabad
|
|
|
|
Dear Friends,
I have a FB file with LRECL = 8491 bytes.
The layout of the file is
Code: |
01 DETAIL-RECORD.
05 KEY-VALUE PIC X(10).
05 DATA-TYPE PIC X(01).
05 WEEK-END-DATE OCCURS 106 TIMES .
10 CCYYMMDD PIC X(08).
05 ENTRY1 OCCURS 106 TIMES .
10 UNIT1 PIC S9(15)V9(3).
05 ENTRY2 OCCURS 106 TIMES .
10 UNIT2 PIC S9(15)V9(3).
05 ENTRY3 OCCURS 106 TIMES .
10 UNIT3 PIC S9(15)V9(3).
05 ENTRY4 OCCURS 106 TIMES .
10 UNIT4 PIC S9(15)V9(3). |
The possible values in DATA-TYPE are 1 or 2 or 3 or 4.
If DATA-TYPE = '1' then ENTRY1 table will have values. All other entries will have zeroes in it.
If DATA-TYPE = '2' then ENTRY2 table will have values. All other entries will have zeroes in it.
If DATA-TYPE = '3' then ENTRY3 table will have values. All other entries will have zeroes in it.
If DATA-TYPE = '4' then ENTRY4 table will have values. All other entries will have zeroes in it.
WEEK-END-DATE will have past 106 week ending dates in CCYYMMDD format.
I want to merge these 4 record types into one single record based on the KEY-VALUE. I can go for SUM FIELDS, but I have to give 106*4 = 424 fields in sum fields. Is there any other better way to do that?
Thanks much for your advice and help.
Regards
Tanden. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Do you have one, and only one, of each record type per key-value? Or possible multiples? |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
notonly4u,
I am assuming that you will always have records with all 4 DATA-TYPE present in the input and there will never be an instance where one of the DATA-TYPE is absent. With that in mind, you could use WITHEACH of SPLICE to get the required output. I am also "guessing" that after combining all 4 DATA-TYPE, you don't really care which value remains because you now have "entry values" for all 4 DATA-TYPE in a single record.
See if below works...
Code: |
//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD INPUT FB/8491
//OUT DD OUTPUT FB/8491
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(1,10,CH) WITHEACH WITH(2768,1908) -
WITH(4676,1908) -
WITH(6584,1908)
/*
//* |
In fact even if my assumption is not true,you can still use WITHEACH with little change using OUTFIL OVERLAY, but I will wait for your reply.
Thanks, |
|
Back to top |
|
|
|