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

in DFSORT I want to add =2 to one numaric fileds


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

New User


Joined: 27 Aug 2007
Posts: 4
Location: bangalore

PostPosted: Tue Jul 31, 2012 5:27 pm
Reply with quote

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 31, 2012 5:58 pm
Reply with quote

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

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jul 31, 2012 10:41 pm
Reply with quote

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
View user's profile Send private message
asrinuyadav
Warnings : 1

New User


Joined: 27 Aug 2007
Posts: 4
Location: bangalore

PostPosted: Wed Aug 01, 2012 5:02 pm
Reply with quote

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 01, 2012 5:05 pm
Reply with quote

Before you get an answer, can you make sure that this is now the full requirement, please?
Back to top
View user's profile Send private message
asrinuyadav
Warnings : 1

New User


Joined: 27 Aug 2007
Posts: 4
Location: bangalore

PostPosted: Wed Aug 01, 2012 5:44 pm
Reply with quote

yes
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Aug 01, 2012 6:00 pm
Reply with quote

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

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Aug 01, 2012 10:19 pm
Reply with quote

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
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
No new posts DFSORT - VB file RDW getting overridden DFSORT/ICETOOL 3
Search our Forums:

Back to Top