IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

adding 1000 to salary in the record...


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sant532

New User


Joined: 02 Jun 2008
Posts: 48
Location: India

PostPosted: Thu Jan 08, 2009 8:38 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Jan 08, 2009 9:15 pm
Reply with quote

Take a look at arexp under the OUTFIL statement
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jan 08, 2009 9:58 pm
Reply with quote

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
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Tue Jan 13, 2009 7:00 pm
Reply with quote

Hi Frank,

What will happen to record something like this:

ABE0003MF99000

How can this be handled?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jan 13, 2009 9:58 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
Search our Forums:

Back to Top