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
 

 

How to add two column values in Sort.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Raghavendra P K

New User


Joined: 24 Aug 2007
Posts: 24
Location: bangalore

PostPosted: Tue Aug 28, 2007 1:06 pm    Post subject: How to add two column values in Sort.
Reply with quote

Hi,
I have a Flat file in which i have 4 columns A,B,C and D.
I want to add values of COlumn B and Column C . Can this be done using Sort utility.
Back to top
View user's profile Send private message

shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Aug 28, 2007 1:25 pm    Post subject:
Reply with quote

Code:
// EXEC PGM=SORT                                 
//SORTIN DD *                                   
1111111111 9999999.99 9999999.99                 
2222222222-8888888.88 8888888.88                 
3333333333 7777777.77-7777777.77                 
4444444444-6666666.66-6666666.66                 
5555555555+5555555.55 5555555.55                 
6666666666 4444444.44+4444444.44                 
7777777777+3333333.33+3333333.33                 
8888888888 2222222.22 2222222.22                 
9999999999 1111111.11 1111111.11                 
/*                                               
//SORTOUT DD SYSOUT=*                           
//SYSOUT DD SYSOUT=*                             
//SYSIN DD *                                     
 OPTION COPY                                     
 INREC OVERLAY=(33:11,11,SFF,ADD,22,11,SFF,     
 EDIT=(STTTTTTTT.TT),SIGNS=(+,-))               
/*                                               
//

Output:
Code:
1111111111 9999999.99 9999999.99+19999999.98
2222222222-8888888.88 8888888.88+00000000.00
3333333333 7777777.77-7777777.77+00000000.00
4444444444-6666666.66-6666666.66-13333333.32
5555555555+5555555.55 5555555.55+11111111.10
6666666666 4444444.44+4444444.44+08888888.88
7777777777+3333333.33+3333333.33+06666666.66
8888888888 2222222.22 2222222.22+04444444.44
9999999999 1111111.11 1111111.11+02222222.22
Back to top
View user's profile Send private message
Raghavendra P K

New User


Joined: 24 Aug 2007
Posts: 24
Location: bangalore

PostPosted: Tue Aug 28, 2007 2:49 pm    Post subject: How to add two column values in Sort.
Reply with quote

Hi Shankar,
Its working . I have one more question ,after adding two columns i want to sort the file. I know that if i use one more sort step i can do that ,is there any way where i can add and sort the files in a single sort step.

thanks,
Raghav
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Aug 28, 2007 2:58 pm    Post subject:
Reply with quote

Raghavendra P K,
Remove the OPTION COPY and give SORT FIELDS=(p,m,f,o)
Back to top
View user's profile Send private message
Raghavendra P K

New User


Joined: 24 Aug 2007
Posts: 24
Location: bangalore

PostPosted: Tue Aug 28, 2007 4:06 pm    Post subject: Hi i have used another step
Reply with quote

hi Shankar,
i have used another step its working fine.

thanks,
Raghav
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 Aug 28, 2007 7:49 pm    Post subject:
Reply with quote

Quote:
i have used another step its working fine.


Shankar is correct that INREC is processed before SORT, so you can add the fields and then do the SORT in one step.

Why exactly did you feel you had to use another step? Please explain what you're doing and show the job you used, so we can tell you if you can in fact do it in one step.
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 BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 1 Tue Jul 25, 2017 12:12 am
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm


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