Populating the data as 1 rec by pulling the data from 2 recs



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Populating the data as 1 rec by pulling the data from 2 recs

Postby RajeshT » Tue May 04, 2010 10:41 pm

Hi,

Good Morning !!

Can you help me with the situation mentioned below; My requirement is to pull 2 fields from record 1 and 2 fields from record 2 as ONE OUTPUT record; I knew that every two records is a set here.

INPUT
-------
8E03402723N10050238376
1B03402723VNPETALUMA POULTRY
8E0SKEXCELN1005032667700009
1B0SKEXCELVNHOUSTON
8E0SKEXCELN1005033044200052
1B0SKEXCELVNDALLAS
8E0SKEXCELN1005021666100540
1B0SKEXCELVNLOUISVILLE
8E03402089N10050238374
1B03402089VNBOULDER NATURAL MEATS
8E03000684N10050244617
1B03000684VNCHEF'S REQUESTED FOODS

Expected OUTPUT (2 pos from 1 and 7 pos from 4 from rec 1 AND 2 pos from 1 and 20 pos from 13 from rec 2 as 1 OUTPUT record)
----------------------
8E34027231BPETALUMA POULTRY
8ESKEXCEL1BHOUSTON
8ESKEXCEL1BDALLAS
8ESKEXCEL1BLOUISVILLE
8E34020891BBOULDER NATURAL MEATS
8E30006841BCHEF'S REQUESTED FOODS

Options :-
1. First record will always have 8E in first 2 positions.
2. Second record will always have 1B in first 2 positions and VN in 2 positions from 11.

Let me know if you need any information from my end.

Thank You.
Rajesh.
RajeshT
 
Posts: 22
Joined: Tue May 04, 2010 10:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Populating the data as 1 rec by pulling the data from 2 recs

Postby Alissa Margulies » Tue May 04, 2010 10:52 pm

Hello Rajesh, and welcome to the forum.

Please identify which release and maintenance level of SyncSort you are currently running so that we can provide you with an appropriate resolution.

Regards,
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Populating the data as 1 rec by pulling the data from 2 recs

Postby RajeshT » Tue May 04, 2010 10:55 pm

Thank You Alissa.

We're using the latest version of SYNCSORT :- SYNCSORT FOR Z/OS 1.3.2.1R

Please suggest.
RajeshT
 
Posts: 22
Joined: Tue May 04, 2010 10:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Populating the data as 1 rec by pulling the data from 2 recs

Postby Alissa Margulies » Tue May 04, 2010 11:35 pm

Based only on your sample input and desired output, here is one way to accomplish this task:
//SORT1 EXEC PGM=SORT                               
//SORTIN  DD *                                     
8E03402723N10050238376                             
1B03402723VNPETALUMA POULTRY                       
8E0SKEXCELN1005032667700009                         
1B0SKEXCELVNHOUSTON                                 
8E0SKEXCELN1005033044200052                         
1B0SKEXCELVNDALLAS                                 
8E0SKEXCELN1005021666100540                         
1B0SKEXCELVNLOUISVILLE                             
8E03402089N10050238374                             
1B03402089VNBOULDER NATURAL MEATS                   
8E03000684N10050244617                             
1B03000684VNCHEF'S REQUESTED FOODS                 
//SORTOUT DD SYSOUT=*                               
//SYSOUT  DD SYSOUT=*                               
//SYSIN   DD *                                     
  INCLUDE COND=(1,2,CH,EQ,C'1B',AND,11,2,CH,EQ,C'VN')
  INREC BUILD=(1:C'8E',4,7,1,2,13,22)
  SORT FIELDS=COPY                                       

However, if you did not know what data would be in the first 2 positions in the "first" record, and positions 4-10 were not the same in both records, then here is an alternative method:
//SYSIN   DD *                                           
  INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(41:1,2,4,7)) 
  SORT FIELDS=COPY                                       
  OUTFIL INCLUDE=(1,2,CH,NE,41,2,CH),                   
         BUILD=(41,9,1,2,13,22)                         
/*                                                       
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Populating the data as 1 rec by pulling the data from 2 recs

Postby RajeshT » Wed May 05, 2010 1:03 am

Hi Alissa,

I've tested the code (2nd code) and found that it is working fine as expected. Am trying to understand the logc; when we say PUSH(41:1,2,4,7), i understand it is ADDing 9 bytes towards the end of the record; And the INCLUDE condition is eliminating all records starts with '8E' in this case. So, we are only left with 2nd set of records, from which the INREC / OUTREC pulls the data and BUILDing as per our need.

Thank you for your time and quick responses today.

Am curious to know, does the same above logic allow us to deal with 3 sets of records. I mean, can we pull 2 different fields from each of 3 records as ONE SINGLE output record ?

Have a good day ahead.

Rajesh.
RajeshT
 
Posts: 22
Joined: Tue May 04, 2010 10:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Populating the data as 1 rec by pulling the data from 2 recs

Postby Alissa Margulies » Wed May 05, 2010 2:28 am

RajeshT wrote:Am curious to know, does the same above logic allow us to deal with 3 sets of records. I mean, can we pull 2 different fields from each of 3 records as ONE SINGLE output record ?

I would need to see some sample input records in order to determine if it could be done in a single pass of the data. Otherwise, it could probably be done in 2 steps.
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post