Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Merge 4 records into one

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Merge 4 records into one
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Tue Aug 02, 2011 7:05 pm    Post subject: Re: Merge 4 records into one
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: 578
Location: USA

PostPosted: Tue Aug 02, 2011 8:09 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us