Page 1 of 2

Syncsort - split records into different files by groups

PostPosted: Sat Mar 28, 2009 11:46 am
by bodhi
Hi is it possible to copy the data until the condition matched. My requirment is that I need to split the data into three different files based on header or trailer condition.File always have 3 header and 3 trailer.

e.g
input file

HEADER 1234
ram
shyam
TRAILER02
HEADER 1234
tom
jack
TRAILER02
HEADER 1234
rohit
bodhi
TRAILER02

output files
file 1

HEADER 1234
ram
shyam
TRAILER02

file 2

HEADER 1234
tom
jack
TRAILER02

file 3

HEADER 1234
rohit
bodhi
TRAILER02

It is possible to do so in sort? Please let me know if you need more clarification.


Thanks
Bodhi

Re: Syncsort - split records into different files by groups

PostPosted: Sat Mar 28, 2009 8:37 pm
by dick scherrer
Hello,

Which release of Syncsort is used on your system?

Re: Syncsort - split records into different files by groups

PostPosted: Sat Mar 28, 2009 9:37 pm
by bodhi
Hello,

I am using SYNCSORT FOR Z/OS 1.2.2.3R.

Thanks
Bodhi

Re: Syncsort - split records into different files by groups

PostPosted: Sat Mar 28, 2009 9:57 pm
by dick scherrer
Hello,

I believe what you want to use is WHEN=GROUP, but you would need to have the current Syncsort release installed (1.3.x).

Re: Syncsort - split records into different files by groups

PostPosted: Sat Mar 28, 2009 10:11 pm
by bodhi
Hi Dick,

Thank you for the information.WHEN=GROUP is i know which is not working with this release.Apart form this option is there is any other way to split the file.

Regards
Bodhi

Re: Syncsort - split records into different files by groups

PostPosted: Sun Mar 29, 2009 3:27 am
by dick scherrer
Hello,

WHEN=GROUP is i know which is not working with this release
Possibly the current release could be installed?

Apart form this option is there is any other way to split the file.
If it was my requirement and i couldn't get the current release installed now, i'd write code to do what was needed. . .

Re: Syncsort - split records into different files by groups

PostPosted: Wed May 13, 2009 12:23 am
by arcvns
Hello,

Here's a SyncSort 1.2 job which should work for you. I cant test this now.
I have assumed an input/output LRECL=80. You might need to modify it as per your requirement.

//STEP1    EXEC PGM=SORT
//SYSOUT     DD SYSOUT=*
//SORTIN     DD DSN=Input file
//OUT1       DD DSN=Output file1
//OUT2       DD DSN=Output file2
//OUT3       DD DSN=Output file3
//SYSIN      DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),OVERLAY=(89:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
        OVERLAY=(97:SEQNUM,8,ZD,89:81,8,ZD,SUB,97,8,ZD,M11,LENGTH=8))
  SORT FIELDS=COPY
  OUTFIL FNAMES=OUT1,INCLUDE=(89,8,ZD,EQ,1),BUILD=(1,80)
  OUTFIL FNAMES=OUT2,INCLUDE=(89,8,ZD,EQ,2),BUILD=(1,80)
  OUTFIL FNAMES=OUT3,SAVE,BUILD=(1,80)
/*

Post back if you come across any issues. Good luck :)

Re: Syncsort - split records into different files by groups

PostPosted: Wed May 13, 2009 12:45 am
by dick scherrer
Hi Arun,

Welcome to the forum :)

Good to "see" you. . .

d

Re: Syncsort - split records into different files by groups

PostPosted: Wed May 13, 2009 6:18 pm
by arcvns
Thanks Dick. :D

Re: Syncsort - split records into different files by groups

PostPosted: Thu Jun 11, 2009 6:19 pm
by bodhi
Thank you Arun,

It is working fine .

Bodhi.