View previous topic :: View next topic
Author
Message
Huan-Nguyen New User Joined: 17 Jan 2006Posts: 17
I need to replace the value @ and # to blank (space) only for the last record in the input file(record format VB and rec length 512)
Input file
Code:
123456789@@@
ABCD12456578NNNNN
NNNNNVVVVVVV
XXXXXXXXXXXXXMMMMMMMMM@@@@@NNNNNNNN###VVV
Expected Output
Code:
123456789@@@
ABCD12456578NNNNN
NNNNNVVVVVVV
XXXXXXXXXXXXXMMMMMMMMM NNNNNNNN VVV
Back to top
murmohk1 Senior Member Joined: 29 Jun 2006Posts: 1436 Location: Bangalore,India
Huan,
Is there a way to identify the last record directly?
Back to top
vkphani New User Joined: 29 Oct 2003Posts: 29
Huan-Nguyen,
As it is only for teh last record you wanna change, why don't you just edit the file and put spaces.
Back to top
murmohk1 Senior Member Joined: 29 Jun 2006Posts: 1436 Location: Bangalore,India
Phani,
Quote:
As it is only for teh last record you wanna change, why don't you just edit the file and put spaces.
You suggestion might be good for dev file but not on PROD files.
Back to top
Huan-Nguyen New User Joined: 17 Jan 2006Posts: 17
murmohk1 wrote:
Huan,
Is there a way to identify the last record directly?
I will change the design to identify the last record. Thanks,
Back to top
shankar.v Active User Joined: 25 Jun 2007Posts: 196 Location: Bangalore
Huan-Nguyen,
Please check with the folllowing code for your requirement.
Code:
//S EXEC PGM=SORT
//SORTIN DD DSN=XXXXX.YYYYYYY.V512,DISP=OLD
//SORTOUT DD DSN=&&SYMNAMES,DISP=(,PASS)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,VTOF,BUILD=(80X),
TRAILER1=(C'LASTREC,+',COUNT=(M11,LENGTH=8),80:X)
/*
// EXEC PGM=SORT
//SORTIN DD DSN=XXXXX.YYYYYYY.V512,DISP=OLD
//SYMNAMES DD DSN=*.S.SORTOUT,DISP=(OLD,DELETE),VOL=REF=*.S.SORTOUT
//SORTOUT DD DSN=XXXXX.YYYYYYY.V512.OUT,DISP=(,CATLG),
// DCB=(XXXXX.YYYYYYY.V512),SPACE=(CYL,(1,1))
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
ALTSEQ CODE=(7B40,7C40)
INREC IFTHEN=(WHEN=INIT,OVERLAY=(513:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(513,8,ZD,EQ,LASTREC),OVERLAY=(5:5,508,TRAN=ALTSEQ))
OUTFIL OUTREC=(1,4,5,508)
/*
//
Input:
Code:
123456789@@@
ABCD12456578NNNNN
NNNNNVVVVVVV
XXXXXXXXXXXXXMMMMMMMMM@@@@@NNNNNNNN###VVV
Output:
123456789@@@
Code:
ABCD12456578NNNNN
NNNNNVVVVVVV
XXXXXXXXXXXXXMMMMMMMMM NNNNNNNN VVV
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Huan,
Shankar's "solution" will pad your variable length records with blanks so they will ALL be 512 bytes. So a record that was 20 bytes long will be increased to 512 bytes long. This is a very bad idea as it negates the reason for having a VB file. (This is a case of a little knowledge being a dangerous thing.)
Here's a DFSORT job that will do what you want and preserve your original record lengths:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (VB/512)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=T1,BUILD=(1,4,5:SEQNUM,8,ZD,13:5)
OUTFIL FNAMES=SYM,NODETAIL,REMOVECC,VTOF,
BUILD=(80X),
TRAILER1=('TARG,+',COUNT=(M11,LENGTH=8))
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=... output file (VB/512)
//SYSIN DD *
OPTION COPY
ALTSEQ CODE=(7B40,7C40)
INREC IFTHEN=(WHEN=(5,8,ZD,EQ,TARG),
BUILD=(1,4,5:13,TRAN=ALTSEQ)),
IFTHEN=(WHEN=NONE,BUILD=(1,4,5:13))
/*
Back to top
Huan-Nguyen New User Joined: 17 Jan 2006Posts: 17
Frank,
Thank you very much for your help. I will try to run it by tomorrow and will let you know the result . Thanks,
Back to top
Huan-Nguyen New User Joined: 17 Jan 2006Posts: 17
Frank,
It works perfectly with your JCL. Many thanks,
Back to top
Please enable JavaScript!