Page 1 of 1

Copy a file using syncsort with different record length

PostPosted: Wed Feb 06, 2013 5:09 am
by macnano
Can someone help me on how to copy a file (recfm=fb & lrecl=40) to a new file (recfm=fb & lrecl=35)with shorter record lenght using syncsort? Also, if I would like to copy a file (recfm=fb & lrecl=35)to a new file (recfm=fb & lrecl=40) with longer record length and the populate the last 5 positions with a constant value e.g. ABCDE.

Thanks.

Re: Copy a file using syncsort with different record length

PostPosted: Wed Feb 06, 2013 6:12 am
by BillyBoyo
There is a SyncSort part of the forum where this should have been posted.
  OPTION COPY
  INREC BUILD=(1,35)


  OPTION COPY
  INREC OVERLAY=(36:C'ABCDE')

or

  INREC BUILD=(1,35,C'ABCDE')


If it is the same file, you can do it in one shot:

  OPTION COPY
  INREC OVERLAY=(36:C'ABCDE')


And, yes, that is the same as the one to extend the length.

Re: Copy a file using syncsort with different record length

PostPosted: Fri Feb 08, 2013 4:24 am
by macnano
Thanks for your quick response. This works for one output file. Now I have another question - if there are more than one output file and I have to splt the input file base on some criteria e.g. last 3 positions of the input file is AAA then the output will be SORTOF1, if it is BBB, then SORTOF2, and CCC then the output will be SORTOF3. The output files will not have the last 3 positions of the input file. i tried using INREC and INCLUDE statement but it did not work.

Re: Copy a file using syncsort with different record length

PostPosted: Fri Feb 08, 2013 4:35 am
by BillyBoyo
You need OUTFIL. OUTFIL has INCLUDE= or OMIT= to select records.

Re: Copy a file using syncsort with different record length

PostPosted: Fri Feb 08, 2013 4:53 am
by macnano
I was about to retract my post since I got it without using INREC but allocate the output datasets with LRECL=1708 where the input file LRECL=1711.
SORT FIELDS=COPY
OUTFIL FILES=1,
INCLUDE=(1709,3,CH,EQ,C'AAA')
OUTFIL FILES=2,
INCLUDE=(1709,3,CH,EQ,C'BBB')
OUTFIL FILES=3,
INCLUDE=(1709,3,CH,EQ,C'CCC')

Thanks