Sort inside a group of records



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

Sort inside a group of records

Postby akanchu » Fri Mar 27, 2015 4:16 am

I have been trying to sort a group of records inside a group.
My input files looks like :

0000000000000000000000000000000001XXXX     
000000000000000000000000000300000107My Agent
000000000000000000000000000400000107Your Agent
070000012 001DDDDDDDDDD 200000001DDDDDDDDDD 03YYAP          KLL             
070000012 001DDDDDDDDDD 210000001294119481                          00         
070000012 001DDDDDDDDDD 300000001070000012 R  000000000000000000000000      SAA
070000012 001DDDDDDDDDD 305000001$000,000.00         27991231  $999,058.55     
070000012 001DDDDDDDDDD 35000000100002500008008008008002SDB                 000
070000012 001DDDDDDDDDD 400000001STARING-PAGE                 05                 
070000012 001DDDDDDDDDD 409000001               OWNER                         
070000012 001DDDDDDDDDD 400000001SECND-PAGE                   05               
070000012 001DDDDDDDDDD 405000001          Happy Pharrell
070000012 001DDDDDDDDDD 400000001RECORDS1-COVER               20
070000012 001DDDDDDDDDD 400000001RECORDS1-BODY                40
070000012 001DDDDDDDDDD 400000001RECORDS1-END                 70
070000012 001DDDDDDDDDD 400000001MOREDATA0198HI.1             30
070000012 001DDDDDDDDDD 400000001DIRECT-FORM                  50
070000012 001DDDDDDDDDD 400000001ERROR-PAGE                   99
070000012 001DDDDDDDDDD 408000001MOREDATA0108HI.1             

070000013 001DDDDDDDDDD 200000001DDDDDDDDDD 03YYAP          BLUE             
070000013 001DDDDDDDDDD 210000001194119418                          00         
070000013 001DDDDDDDDDD 300000001070000013 R  000000000000000000000000      SAA
070000013 001DDDDDDDDDD 305000001$000,000.00         27991231  $999,058.55     
070000013 001DDDDDDDDDD 35000000100002500008008008008002SDB                 000
070000013 001DDDDDDDDDD 400000001STARING-PAGE                 05                 
070000013 001DDDDDDDDDD 409000001               OWNER                         
070000013 001DDDDDDDDDD 400000001SECND-PAGE                   05               
070000013 001DDDDDDDDDD 405000001          Happy Pharrell
070000013 001DDDDDDDDDD 400000001RECORDS1-COVER               20
070000013 001DDDDDDDDDD 400000001RECORDS1-BODY                40
070000013 001DDDDDDDDDD 400000001RECORDS1-END                 70
070000013 001DDDDDDDDDD 400000001MOREDATA0109LN.1             30
070000013 001DDDDDDDDDD 400000001DRIVER-MORRSEMENT            15
070000013 001DDDDDDDDDD 35600000100000.00                                     
070000013 001DDDDDDDDDD 35600000101000.00                                     
070000013 001DDDDDDDDDD 400000001DIRECT-FORM                  50
9999999999999999999999999999000001000000000123     


1004 lrecl - VB
25th position is the type of record identifier and 1 thru 10 is the group identifier.
The inital records are header(000) and lookup data.(003/004) in the 25 position and trailer is 999.
The group starts with 200(25 position) or the unique id in pos 1 thru 10.
Inside this group, there are 400 (25th position) type records and their subsequent records that need to be sorted, based on value present in pos 63
The records under the 400 with the 400 should move with it up or down togather, while keeping their order same,

I tried this :
SORT FIELDS=(3005,3,CH,A,3014,2,CH,A,3012,2,CH,A)                     
INREC IFTHEN=(WHEN=INIT,OVERLAY=(3012:C'0000',3008:SEQNUM,4,ZD,       
                                 RESTART=(1,10))),                   
      IFTHEN=(WHEN=GROUP,                                             
              BEGIN=(25,3,ZD,EQ,200),                                 
              PUSH=(3005:ID=3)),                           
      IFTHEN=(WHEN=GROUP,                                             
             BEGIN=(25,3,ZD,EQ,400),                                 
             END=(25,3,ZD,EQ,200),                                   
             PUSH=(3012:ID=2,112,2))                                 
OUTFIL BUILD=(1,1004)                                                 

But the second 200 record goes to the bottom. :(
Expected output is as below.

0000000000000000000000000000000001XXXX     
000000000000000000000000000300000107My Agent
000000000000000000000000000400000107Your Agent
070000012 001DDDDDDDDDD 200000001DDDDDDDDDD 03YYAP          KLL             
070000012 001DDDDDDDDDD 210000001294119481                          00         
070000012 001DDDDDDDDDD 300000001070000012 R  000000000000000000000000      SAA
070000012 001DDDDDDDDDD 305000001$000,000.00         27991231  $999,058.55     
070000012 001DDDDDDDDDD 35000000100002500008008008008002SDB                 000
070000012 001DDDDDDDDDD 400000001STARING-PAGE                 05                 
070000012 001DDDDDDDDDD 409000001               OWNER                         
070000012 001DDDDDDDDDD 400000001SECND-PAGE                   05               
070000012 001DDDDDDDDDD 405000001          Happy Pharrell
070000012 001DDDDDDDDDD 400000001RECORDS1-COVER               20
070000012 001DDDDDDDDDD 400000001MOREDATA0198HI.1             30
070000012 001DDDDDDDDDD 400000001RECORDS1-BODY                40
070000012 001DDDDDDDDDD 400000001DIRECT-FORM                  50
070000012 001DDDDDDDDDD 400000001RECORDS1-END                 70
070000012 001DDDDDDDDDD 400000001ERROR-PAGE                   99
070000012 001DDDDDDDDDD 408000001MOREDATA0108HI.1             

070000013 001DDDDDDDDDD 200000001DDDDDDDDDD 03YYAP          BLUE             
070000013 001DDDDDDDDDD 210000001194119418                          00         
070000013 001DDDDDDDDDD 300000001070000013 R  000000000000000000000000      SAA
070000013 001DDDDDDDDDD 305000001$000,000.00         27991231  $999,058.55     
070000013 001DDDDDDDDDD 35000000100002500008008008008002SDB                 000
070000013 001DDDDDDDDDD 400000001STARING-PAGE                 05                 
070000013 001DDDDDDDDDD 409000001               OWNER                         
070000013 001DDDDDDDDDD 400000001SECND-PAGE                   05               
070000013 001DDDDDDDDDD 405000001          Happy Pharrell
070000013 001DDDDDDDDDD 400000001DRIVER-MORRSEMENT            15
070000013 001DDDDDDDDDD 35600000100000.00                                     
070000013 001DDDDDDDDDD 35600000101000.00                                     
070000013 001DDDDDDDDDD 400000001RECORDS1-COVER               20
070000013 001DDDDDDDDDD 400000001MOREDATA0109LN.1             30
070000013 001DDDDDDDDDD 400000001RECORDS1-BODY                40
070000013 001DDDDDDDDDD 400000001DIRECT-FORM                  50
070000013 001DDDDDDDDDD 400000001RECORDS1-END                 70
9999999999999999999999999999000001000000000123     


Can someone please guide me as to what I am doing wrong or what needs adjusted to make it work.
Please assist.
Thanks in advance
Aka.
akanchu
 
Posts: 36
Joined: Fri Jan 23, 2009 3:11 am
Has thanked: 0 time
Been thanked: 0 time

Re: Sort inside a group of records

 

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post