View previous topic :: View next topic
|
Author |
Message |
sant532
New User
Joined: 02 Jun 2008 Posts: 48 Location: India
|
|
|
|
Hi all,
I'm having a flat file with below records
ABC0001HR25000
ABD0002DN15000
ABE0003MF20000
now i want to add 1000 to salary(which is last 5 digits for all records) and the output should be like below:
ABC0001HR26000
ABD0002DN16000
ABE0003MF21000
Can you ppl suggest me any way to do it! |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Take a look at arexp under the OUTFIL statement |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
sant532,
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(10:10,5,ZD,ADD,+1000,TO=ZD,LENGTH=5)
/*
|
|
|
Back to top |
|
|
genesis786
Active User
Joined: 28 Sep 2005 Posts: 210 Location: St Katherine's Dock London
|
|
|
|
Hi Frank,
What will happen to record something like this:
ABE0003MF99000
How can this be handled? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
What will happen to record something like this:
ABE0003MF99000
|
99000+1000 = 100000. Since that's a 6 digit value and only 5 digits are allowed (LENGTH=5), the first digit will be truncated and the result would be:
ABE0003MF00000
Quote: |
How can this be handled? |
Well, that's up to the programmer to decide. If you don't want the value truncated, then you can use LENGTH=6 (or more) to allow for a larger value. If you want to "flag" the value in some way, you can use IFTHEN to check for it. And so on. |
|
Back to top |
|
|
|