View previous topic :: View next topic
|
Author |
Message |
asrinuyadav Warnings : 1 New User
Joined: 27 Aug 2007 Posts: 4 Location: bangalore
|
|
|
|
HI
I have one requirement , to add +2 to numeric filed in input record in a particular collum then write into output file
ex in input
rameshkumar 04 india
rakeshkumar 03 india
output:
rameshkumar 06 india
rakeshkumar 05 india
Thanks |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Have a look at OPTION COPY/SORT FIELDS=COPY and ADD in the documentation.
It is a really simple thing. you can search this forum for ADD to find some examples of its use, plus examples in the documentation. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Assuming that you only values less than 98, you can use the following DFSORT JCL which will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RAMESHKUMAR 04 INDIA
RAKESHKUMAR 03 INDIA
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(13:+2,ADD,13,2,ZD,EDIT=(TT))
//* |
|
|
Back to top |
|
|
asrinuyadav Warnings : 1 New User
Joined: 27 Aug 2007 Posts: 4 Location: bangalore
|
|
|
|
If you want to add only to the first record out of two record , then how we can use this code.
Thanks
Srini |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Before you get an answer, can you make sure that this is now the full requirement, please? |
|
Back to top |
|
|
asrinuyadav Warnings : 1 New User
Joined: 27 Aug 2007 Posts: 4 Location: bangalore
|
|
|
|
yes |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
"Yes I can make sure" or "Yes, I've made sure, and it is now complete"?
I'll assume the latter anyway.
Generate a sequence number which starts at one, in a field big enough, allowing for expansion, for your entire file.
Test the sequence number for 1. If yes, do the ADD. Cut the record down to original size before output.
Try to solve it from the manuals and searching the forum. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
use the following DFSORT JCL
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RAMESHKUMAR 04 INDIA
RAKESHKUMAR 03 INDIA
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(81,8,ZD,EQ,1),OVERLAY=(13:+2,ADD,13,2,ZD,EDIT=(TT)))
//* |
|
|
Back to top |
|
|
|