SORTing based on a particular field in 1st record ofa GROUP



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

SORTing based on a particular field in 1st record ofa GROUP

Postby RajeshT » Tue Oct 04, 2011 10:53 pm

Hi Everyone !!

Here is what i am trying to accomplish :- I have a file with a set of records. I have categorized the file into different groups based on the below criteria; {Header(H), Detail records(D), Trailer(S) }

INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,1,CH,EQ,C'H'),
END=(1,1,CH,EQ,C'S'),
PUSH=(201:ID=5,SEQ=5))
SORT FIELDS=COPY
OUTFIL BUILD=(1,210)

I now want to SORT each group in such a way that all the GROUPs should come together for which the value at position 50 (15 chars length) of the FIRST (HEADER) record in each group are EQUAL. Can someone please give me a direction here.


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

Re: SORTing based on a particular field in 1st record ofa GROUP

 

Re: SORTing based on a particular field in 1st record ofa GR

Postby BillyBoyo » Wed Oct 05, 2011 12:13 am

Is this one, syncsort-synctool/topic6350.html, any use to you?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: SORTing based on a particular field in 1st record ofa GR

Postby dick scherrer » Wed Oct 05, 2011 12:48 am

Hello,

Suggest you post a bit of sample input data and the output you want when that sample input is processed.

Mention the lrecl and recfm of the files.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: SORTing based on a particular field in 1st record ofa GR

Postby RajeshT » Wed Oct 05, 2011 6:39 pm

Thank you Billy, but that does not help to the resolve the issue.

Hi Dick, please see below the sample data;

RECFM : VB
LRECL : 204

INPUT
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
H01        R 1 111004     2025724               D0000         [b]AEC9547622[/b]       
S03        R 1 111004     2025724               D000000000000008180        2665
H01        R 1            4427758195            D0000         [b]0013260659[/b]       
S03        R 1            4427758195            D00000000000000BFA5        291C
H01        R 1 111004     2025722               D0000         [b]EEC9547622[/b]       
S03        R 1 111004     2025722               D000000000000008300        91DC
H01        R 1 111004     2025723               D0000         [b]DEC9547622[/b]       
S03        R 1 111004     2025723               D0000000000000043C1        3592
H01        R 1            59017731              D0000         [b]9251155000[/b]       
S03        R 1            59017731              D00000000000000817B        41A1
H01        R 1 111004     2025724               D0000         [b]AEC9999999[/b]       
S03        R 1 111004     2025724               D000000000000008180        2665
H01        R 1 111004     2025722               D0000         [b]EEC9547622[/b]       
S03        R 1 111004     2025722               D000000000000008300        91DC

OUTPUT
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
H01        R 1 111004     2025724               D0000         [b]AEC9547622[/b]       
S03        R 1 111004     2025724               D000000000000008180        2665
H01        R 1 111004     2025724               D0000         [b]AEC9999999[/b]       
S03        R 1 111004     2025724               D000000000000008180        2665
H01        R 1 111004     2025722               D0000         [b]DEC9547622[/b]       
S03        R 1 111004     2025722               D000000000000008300        3592
H01        R 1 111004     2025723               D0000         [b]EEC9547622[/b]       
S03        R 1 111004     2025723               D0000000000000043C1        91DC
H01        R 1 111004     2025722               D0000         [b]EEC9547622[/b]       
S03        R 1 111004     2025722               D000000000000008300        91DC
H01        R 1            4427758195            D0000         [b]0013260659[/b]       
S03        R 1            4427758195            D00000000000000BFA5        291C
H01        R 1            59017731              D0000         [b]9251155000[/b]       
S03        R 1            59017731              D00000000000000817B        41A1

The fields highlighted in BOLD are of size 10 chars starts from 63rd position in the file. I want all the groups are in SORTed order based on this particular field. Any set of records starts with a character "H" at position 1 is the beginning of the first record in group and then followed by an "S" at position 1 is the beginning of the END record of the group. Please let me know if you require any additional information. I have tried pasting the sample data in COURIER NEW font, but i could not find the FONT option.

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

Re: SORTing based on a particular field in 1st record ofa GR

Postby dick scherrer » Wed Oct 05, 2011 11:16 pm

Hello,

To preserve alignment and improve readability, use the "Code" tag when posting source, jcl, data, etc. When Code'd, the bold tag does not work. Your post has been Code'd but the bold tags were not removed.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: SORTing based on a particular field in 1st record ofa GR

Postby RajeshT » Thu Oct 06, 2011 11:14 am

Hi,

Looks like i found the resolution;

INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,1,CH,EQ,C'H'),
END=(1,1,CH,EQ,C'S'),
PUSH=(201:63,10,211:ID=5,SEQ=5))
SORT FIELDS=(205,10,CH,A,215,5,CH,A,220,5,CH,A)
OUTFIL BUILD=(1,20)


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

Re: SORTing based on a particular field in 1st record ofa GR

Postby BillyBoyo » Thu Oct 06, 2011 12:16 pm

Well done Rajesh. Good work.

You don't have "data" records in your example, but they should all get grouped together.

I'm not sure why you felt the other topic would not help you. I don't really see a substantial difference between your code and the other one.


INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,1,CH,EQ,C'H'),
END=(1,1,CH,EQ,C'S'),
PUSH=(201:63,10,211:ID=5,SEQ=5))
SORT FIELDS=(205,10,CH,A,215,5,CH,A,220,5,CH,A)
OUTFIL BUILD=(1,20)


INREC IFTHEN=(WHEN=GROUP,BEGIN=(39,2,CH,EQ,C'10'),
PUSH=(401:10,9,410:ID=9)),
IFTHEN=(WHEN=(39,2,CH,EQ,C'10'),OVERLAY=(419:C'A',304,6)),
IFTHEN=(WHEN=(39,2,CH,EQ,C'20'),OVERLAY=(419:C'B',304,6)),
IFTHEN=(WHEN=(39,2,CH,EQ,C'30'),OVERLAY=(419:C'C',304,6))
OPTION DYNALLOC
SORT FIELDS=(401,9,CH,A,     
             410,9,ZD,A,     - GROUP NUMBER
             419,1,CH,A,     - A FOR '10', B FOR '20', C FOR '30'
             420,6,CH,A)     
OUTREC BUILD=(1,400)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: SORTing based on a particular field in 1st record ofa GR

Postby dick scherrer » Thu Oct 06, 2011 8:50 pm

Good to hear you have it working - thank you for letting us know :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post