One way I did it was using FINDREP= with STARTPOS and ENDPOS to change space to zero. You can make multiple passes on the output record with multiple IFTHEN=(WHEN=INIT statements - BUILD first then FINDREP or other manipulation after the build.
If you have a more recent version that supports the UFF format, use OVERLAY and that format to reprocess the field and apply an EDIT= mask to result. You might be able to do it directly in the BUILD instead of using JFY. Alan -----Original Message----- >From: "Farley, Peter x23353" >Sent: Nov 11, 2019 5:08 PM >To: IBM-MAIN@LISTSERV.UA.EDU >Subject: SYNCSORT Question: JFY a numeric field with leading zeroes? > >We currently use SYNCSORT and need to parse an input CSV file with a trailing >number that we need to right-justify in a fixed-length field with leading >zeroes instead of leading blanks. > >So far I have not been able to find an example that shows how to write out >that trailing field as a right-justified number with leading zeroes instead of >leading blanks. > >Current SORT control cards look like the below. Please don't take the size of >the input fields literally, they can be smaller. I have just shown the >example input line with maximum expected input field lengths. > >OPTION COPY >OUTREC PARSE=(%00=(ENDBEFR=C',',FIXLEN=9), > %01=(ENDBEFR=C',',FIXLEN=7), > %02=(ENDBEFR=C',',FIXLEN=8), > %03=(ENDBEFR=C' ',FIXLEN=10)), > BUILD=(%00,%01,%02,%03,JFY=(SHIFT=RIGHT), > 15X),CONVERT > >Input file is RECFM=VB,LRECL=259, output file is RECFM=FB,LRECL=49 > >Sample input line: > >ABCDEFGH0,ABCDEF1,20190731,1000 > >Current output line using above control cards: > >ABCDEFGH0ABCDEF120190731 1000 > >Desired output line (15 trailing blanks): > >ABCDEFGH0ABCDEF1201907310000001000 > >TIA for any advice or RTFM pointer you can provide. > >Peter >-- > > > >This message and any attachments are intended only for the use of the >addressee and may contain information that is privileged and confidential. If >the reader of the message is not the intended recipient or an authorized >representative of the intended recipient, you are hereby notified that any >dissemination of this communication is strictly prohibited. If you have >received this communication in error, please notify us immediately by e-mail >and delete the message and any attachments from your system. > >---------------------------------------------------------------------- >For IBM-MAIN subscribe / signoff / archive access instructions, >send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN