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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: in DFSORT I want to add =2 to one numaric fileds
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Tue Jul 31, 2012 5:58 pm    Post subject: Reply to: in DFSORT I want to add =2 to one numaric fileds
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    Post subject:
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    Post subject: Reply to: in DFSORT I want to add =2 to one numaric fileds
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Wed Aug 01, 2012 5:05 pm    Post subject: Reply to: in DFSORT I want to add =2 to one numaric fileds
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    Post subject: Reply to: in DFSORT I want to add =2 to one numaric fileds
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7233

PostPosted: Wed Aug 01, 2012 6:00 pm    Post subject: Reply to: in DFSORT I want to add =2 to one numaric fileds
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    Post subject:
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    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 How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am
No new posts Symbolic Parameters in SYSIN DD state... madishpa DFSORT/ICETOOL 3 Mon Jun 27, 2016 6:23 pm
No new posts DFSORT to match two files and write John F Dutcher DFSORT/ICETOOL 6 Thu May 12, 2016 5:17 pm


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