Page 1 of 1

Inserting comment lines

PostPosted: Thu May 24, 2012 10:45 pm
by ibmmf4u
Hi All,

My requirement goes this way, i need to insert new comment lines into a file. Pasted below is an example.

Inputfile:-
TEST1
TEST2
TEST3


Outputfile:-
FIELD
VALUE
TEST1
END OF FIELD
FIELD
VALUE
TEST2
END OF FIELD
FIELD
VALUE
TEST3
END OF FIELD


I just want to insert three new lines.

Can someone provide me the sort card in achieving the above.

Thanks in advance!!

Re: Inserting comment lines

PostPosted: Thu May 24, 2012 11:11 pm
by BillyBoyo
Look at your docs and see if your Syncsort supports the slash-operator on OUTFIL. This allows multiple records to be formatted with, for instance, BUILD. BUILD=(C'A',/,C'B',/,C'C',/C'D') should then produce four records, one byte long.

Re: Inserting comment lines

PostPosted: Fri May 25, 2012 12:45 am
by dick scherrer
Hello,

Yup, Syncsort supports OUTFIL amd BUILD.

There are many examples in our Syncsort part of the forum.

If you find something that is not clear, post what you found and your doubt. Someone will be able to clarify.

Re: Inserting comment lines

PostPosted: Fri May 25, 2012 10:06 am
by ibmmf4u
Hi Bill and Dick,

Thanks a lot. Pasted below is the piece of code that's working fine as per the requirement.

//STEP010   EXEC PGM=SORT
//SYSPRINT DD     SYSOUT=*
//SYSOUT    DD    SYSOUT=*
//SORTIN    DD    *
TEST1
TEST2
TEST3
//SYSIN   DD   *
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,
           BUILD=(C'FIELD',/,
                         C'VALUE',/,
                         1,8,/,
                         C'END OF FIELD')
/*


Output file:-

FIELD
VALUE
TEST1
END OF FIELD
FIELD
VALUE
TEST2
END OF FIELD
FIELD
VALUE


Thanks a lot again for your guidence once again.

Re: Inserting comment lines

PostPosted: Fri May 25, 2012 7:38 pm
by dick scherrer
Good to hear it is working - thank you for posting your solution :)

d