I tried using syncsort to achieve below result. My objective is to concatenate records.
//STEP1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
76940 43-188 2009-07-28
76940 43-1889 2009-07-28
76940 43 18898 2009-07-28
//*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC FIELDS=(1,17,SQZ=(SHIFT=LEFT,MID=C'_'),18,11)
OUTREC BUILD=(1,28,SQZ=(SHIFT=LEFT,MID=C'#'))
/*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
76940 43-188 2009-07-28
76940 43-1889 2009-07-28
76940 43 18898 2009-07-28
//*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC FIELDS=(1,17,SQZ=(SHIFT=LEFT,MID=C'_'),18,11)
OUTREC BUILD=(1,28,SQZ=(SHIFT=LEFT,MID=C'#'))
/*
Expected output:
76940_43-188#2009-07-28
76940_43-1889#2009-07-28
76940_43 18898#2009-07-28
76940_43-1889#2009-07-28
76940_43 18898#2009-07-28
Output i am getting:
76940_43-188@#2009-07-28
76940_43-1889@#2009-07-28
76940_43_18898@#2009-07-28
76940_43-1889@#2009-07-28
76940_43_18898@#2009-07-28
But MID command places _ delimiter on all spaces. I dont want to get _ as part of value when using MID syntax. Please help me on this.