Page 1 of 1

Remove characters from every record but the last

PostPosted: Fri Oct 15, 2010 10:30 pm
by GRAMBO
I have an FB file, and at the end of each line in position 122, I have 2 characters (carriadge return/line feed).
I need these to remain on every line, but need them removed from the last line. Any idea how I can remove this?

eg. the end of my data line would view like....
001,200710,00000063800,..
001,200710,00000063800,..
001,200710,00000063800,..
001,200710,00000063800,..
001,200710,00000063800,..

but I require
001,200710,00000063800,..
001,200710,00000063800,..
001,200710,00000063800,..
001,200710,00000063800,..
001,200710,00000063800,
(note the blank at the end of the last line)

Thanks.

Re: Remove characters from every record but the last

PostPosted: Fri Oct 15, 2010 10:46 pm
by Frank Yaeger
You can use a DFSORT job like the following to do what you asked for.

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/123)
//***> USE MOD OUT FILE
//OUT DD DISP=MOD,DSN=...  output file (FB/123)
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) INPUT REMOVE TRAILER
SUBSET FROM(IN) TO(OUT) INPUT KEEP TRAILER USING(CTL1)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=OUT,OVERLAY=(122:2X)
/*