Remove characters from every record but the last



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Remove characters from every record but the last

Postby GRAMBO » Fri Oct 15, 2010 10:30 pm

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.
GRAMBO
 
Posts: 8
Joined: Fri Oct 15, 2010 10:22 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Remove characters from every record but the last

Postby Frank Yaeger » Fri Oct 15, 2010 10:46 pm

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)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post