merge data from record type 1 with group record type 2



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

merge data from record type 1 with group record type 2

Postby rgranja » Thu May 06, 2010 12:01 am

hi
using syncsort (1.3.2.1R), i would like to merge data from record type 2 with records type 5, which follows the type 2 record.

need to use data from type 2 record to be included for each type 5 record until the next type 2 record is encountered.

a record is created for every type 5 record.

sample input data follows:
2PGMRKPKKX   C+XKF   KKKKKKKKK+PP{                               
5:<:<G:<PQ-QQ2<<2       :<:<KXK::2222QK2<G2KXXKKQK-QKKKKKKKKKKP{
5:<:<G:<P<X2:QPXX       :<:<KXK::2222QK2<G2KXXKKQK-QKKKKKKKK+PK{
2PGMRKPKKX   LCXKF   KKKKKKKKG<-QB                               
5:<:<G:<PXK-K+X<:       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<PXX2G<X:K       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<P22QQ<:-K       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<P2GG<X<GK       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKP:QB
5:<:<G:<PGP:-:X+-       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<PG<KG+P-+       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<PQQ--KQ:G       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<PQ-QQ2<<2       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKXPK{
5:<:<G:<PPXGQ<X+2       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<P<XGKG<:K       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
2PGMRKPKKX   LCPKF   KKKKKKKKKG:K{                               
5:<:<G:<PG<<<XP:2       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
2PGMRKPKKX   LC+KF   KKKKKKKKKPKK{                               
5:<:<G:<P2KK::PKK       :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKPKK{
2PGMRKPKKX   OL+KF   KKKKKKKKKXGK{                               
5:<:<G:<PQ+P--GQX       :<:<KX-::KK--+K2<+2KKXKKQ:2QKKKKKKKKXGK{

sample output data follows:
5:<:<G:<PQ-QQ2<<2 C+XKF :<:<KXK::2222QK2<G2KXXKKQK-QKKKKKKKKKKP{
5:<:<G:<P<X2:QPXX C+XKF :<:<KXK::2222QK2<G2KXXKKQK-QKKKKKKKK+PK{
5:<:<G:<PXK-K+X<: LCXKF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<PXX2G<X:K LCXKF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<P22QQ<:-K LCXKF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<P2GG<X<GK LCXKF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKP:QB
5:<:<G:<PGP:-:X+- LCXKF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<PG<KG+P-+ LCXKF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<PQQ--KQ:G LCXKF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<PQ-QQ2<<2 LCXKF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKXPK{
5:<:<G:<PPXGQ<X+2 LCXKF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<P<XGKG<:K LCXKF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<PG<<<XP:2 LCPKF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKG:K{
5:<:<G:<P2KK::PKK LC+KF :<:<KXK::2222::2<22KXXKKQ+XXKKKKKKKKPKK{
5:<:<G:<PQ+P--GQX OL+KF :<:<KX-::KK--+K2<+2KKXKKQ:2QKKKKKKKKXGK{
rgranja
 
Posts: 4
Joined: Fri Jul 03, 2009 12:04 am
Has thanked: 0 time
Been thanked: 0 time

Re: merge data from record type 1 with group record type 2

Postby Alissa Margulies » Thu May 06, 2010 7:37 pm

The following SyncSort for z/OS 1.3.2 job should give you the requested output:
//SORT1 EXEC PGM=SORT                                               
//SORTIN  DD DSN=input.file,DISP=SHR                                                       
//SORTOUT DD SYSOUT=*                                               
//SYSOUT  DD SYSOUT=*                                               
//SYSIN   DD *                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'2'),PUSH=(19:14,5))   
  SORT FIELDS=COPY                                                   
  OUTFIL INCLUDE=(1,1,CH,EQ,C'5')                                   
/*                               
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: merge data from record type 1 with group record type 2

Postby rgranja » Thu May 06, 2010 8:41 pm

thank you alissa, this works great.
rgranja
 
Posts: 4
Joined: Fri Jul 03, 2009 12:04 am
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post