MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sort to add two or more columns in same record.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Samaravelpandian
Beginner


Joined: 08 May 2007
Posts: 1
Topics: 1

PostPosted: Tue May 29, 2007 4:02 am    Post subject: Sort to add two or more columns in same record. Reply with quote

Please let me know the syntax for adding two columns using SORT JCL.

ie) input
account col1 col2 col3
a1 20 10 20
a2 10 10 10

output
account col1+col2+col3
a1 50
a2 30
using a SORT utility ?
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Tue May 29, 2007 4:29 am    Post subject: Reply with quote

Samaravelpandian,

Why do u keep posting the same question in three places ?
Anyway try the code:
Code:

//STEP010  EXEC PGM=SORT                                               
//SORTIN   DD *                                                         
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
A1 20 10 20                                                             
A2 10 10 10                                                             
/*                                                                     
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTREC FIELDS=(1,3,4,2,ZD,ADD,7,2,ZD,ADD,10,2,ZD,EDIT=(TT),80:X)     
/*                                                                     
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//                                                                     

OUTPUT
Code:

---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8-
********************************* TOP OF DATA **********************************
A1 50                                                                           
A2 30                                                                           
******************************** BOTTOM OF DATA ********************************

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Tue May 29, 2007 4:32 am    Post subject: Reply with quote

Samaravelpandian

Sort jcl for ur requirement is as follows:
Code:

//*******************************************************             
//STEP1    EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
A1 20 10 20                                                           
A2 10 10 10                                                           
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
           SORT FIELDS=COPY                                           
           OUTREC BUILD=(1,2,(4,2,ZD,ADD,7,2,ZD,ADD,10,2,ZD))         
/*                                                                     

Output:
Code:

A1             50 
A2             30

_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12382
Topics: 75
Location: San Jose

PostPosted: Tue May 29, 2007 8:18 am    Post subject: Reply with quote

Samaravelpandian,

Please follow the board rules. Do Not post the same question in multiple forums. Next time I see the repeat the same mistake you will loose the privileges to post on this board

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group