Altering the RECORDs in a GROUP



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

Altering the RECORDs in a GROUP

Postby RajeshT » Wed Oct 12, 2011 5:36 pm

Hi Good Day !!

I'm trying find a way to alter the records in a GROUP. I wanted to bring in the THIRD record in a group as FRIST record, would it be possible to make it that way ? Can someone help. Mentioned below is an example that i'm looking at. RECFM=FB and LRECL=200.

INREC  IFTHEN=(WHEN=GROUP,   
       BEGIN=(5,5,CH,EQ,C'ABCDE'),
       END=(5,3,CH,EQ,C'IEA'), 
       PUSH=(205:ID=5,SEQ=5))
SORT FIELDS=COPY           


Once the group is identified with the above criteria, i'm want to know to how to push the THIRD record as FIRST one in the GROUP.

INPUT
ISA*ABCDE*00**00**00*
GK*PR*KROGER*1*006990
GS*PR*123456789121212
N3*7171 GOODLETT FAR
N4*CORDOVA*TN*380160*
IEA*77368*20110930~ 

OUTPUT
GS*PR*123456789121212
ISA*ABCDE*00**00**00*
GK*PR*KROGER*1*006990
N3*7171 GOODLETT FAR
N4*CORDOVA*TN*380160*
IEA*77368*20110930~


Appreciate the response.

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

Re: Altering the RECORDs in a GROUP

Postby BillyBoyo » Wed Oct 12, 2011 8:17 pm

If you identify sequence-within-the-group as being three, then you can set it to, say, zero. Sort the file with the sequence number of the type you have just adjusted after the rest of the group stuff.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Altering the RECORDs in a GROUP

Postby RajeshT » Wed Oct 12, 2011 8:47 pm

Hi Billy,

Can you please be more elaborate ? how do i set the sequence number as ZERO after initially identifying it as THREE.

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

Re: Altering the RECORDs in a GROUP

Postby BillyBoyo » Wed Oct 12, 2011 8:52 pm

In the position where you have the sequence for the group, and you have identified it as number three, simply put zero there (a zero of the same size and type as the sequence number).

so

000001
000002
000003
000004
000005

becomes

000001
000002
000000
000004
000005

which you then sort (logically or exactly within the group)

000000
000001
000002
000004
000005


Then you can drop all the extra stuff as no longer needed.

The original third record in the group should now be the first.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Altering the RECORDs in a GROUP

Postby RajeshT » Wed Oct 12, 2011 10:16 pm

:)

Understood. And it worked.
STEP-1
INREC  IFTHEN=(WHEN=GROUP,       
       BEGIN=(1,4,CH,EQ,C'ISA*'),
       END=(1,3,CH,EQ,C'IEA'),   
       PUSH=(81:ID=5,SEQ=5))     
SORT FIELDS=COPY                 
OUTFIL BUILD=(1,90)             

STEP-2
SORT FIELDS=COPY                                             
OUTREC IFTHEN=(WHEN(86,5,CH,EQ,C'00003'),OVERLAY(86:C'00000'))

STEP-3
SORT FIELDS=(81,10,CH,A)


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

Re: Altering the RECORDs in a GROUP

Postby BillyBoyo » Wed Oct 12, 2011 10:51 pm

Good for you. I think you can streamline things a little, perhaps to one step. For instance, can the final sort could be in step-2 with INREC instead of OUTREC? You have a working solution you got to yourself, so if that leaves you with time, see if you can smarten it up a bit. It is a useful exercise, as you will end up knowing what you can do where in the sort process. Check your manual.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Altering the RECORDs in a GROUP

Postby BillyBoyo » Wed Oct 12, 2011 11:57 pm

Just as an afterthought, what if there is no third record? Which should appear as the first? As an exercise, even if not possible with your actual data, how about trying 2nd record first, if only two records?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post