Created on May 11, 2021, 1:05 p.m. - by Michael, Nicholas
I want to remove the leading zeroes in the number.
For example, I have an input file.
try this code, let me know if you have any issue
INREC BUILD=(1,5,ZD,EDIT=(IIIII))
OUTREC BUILD=(1,5,JFY=(SHIFT=LEFT))
Try this,
//STEP1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
00015
00220
07000
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,5,ZD,EDIT=(IIIII))
OUTREC BUILD=(1,5,JFY=(SHIFT=LEFT))
/*
You can do it by SORT utility also, see below example
//STEP0050 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
11, 12.50
11, 120.60
11, 1000.80
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTREC FIELDS=(1,11,SQZ=(SHIFT=LEFT))
/*
Thank you Matthew
I used the below SORT utility and got the expected result.
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
15
220
7000
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTREC FIELDS=(1,5,SQZ=(SHIFT=LEFT))
/*
Your question and the solution are different. Initially, you wanted to remove the leading Zeros but your solution will remove the spaces. Please provide your requirements clearly.
You can do it in a single step as below -
OPTION COPY
INREC BUILD=(1,5,ZD,EDIT=(IIIII))
OUTREC BUILD=(1,5,SQZ=(SHIFT=LEFT))