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

Merge 4 records into one


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Tue Aug 02, 2011 3:43 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Aug 02, 2011 7:05 pm
Reply with quote

Do you have one, and only one, of each record type per key-value? Or possible multiples?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Aug 02, 2011 8:09 pm
Reply with quote

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
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
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 Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top