Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

adding 1000 to salary in the record...

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: adding 1000 to salary in the record...
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: 2150
Location: At my coffee table

PostPosted: Thu Jan 08, 2009 9:15 pm    Post subject:
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 Moderator


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

PostPosted: Thu Jan 08, 2009 9:58 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Jan 13, 2009 9:58 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us