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 Profile Log in to check your private messages Log in
 
How to sum selected columns of a file using sort utility

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
MGayathri

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Tue Nov 20, 2007 12:19 pm    Post subject: How to sum selected columns of a file using sort utility
Reply with quote

Hi,
I have file with cloumns(c1,c2,c3), for each row I need to add c2,c3 and cross check whether it talllies with c1.Is it possible to do it with any utility.
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Nov 20, 2007 12:38 pm    Post subject: Reply to: How to sum selected columns of a file using sort u
Reply with quote

Gayathri,

Yes, this is possible with the SORT utilities. Check the manuals for the exact syntax.
Back to top
View user's profile Send private message
MGayathri

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Tue Nov 20, 2007 12:42 pm    Post subject:
Reply with quote

If you have any links regarding this syntax,please let me know
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Nov 20, 2007 1:24 pm    Post subject:
Reply with quote

MGayathri,
Quote:
Hi,
I have file with cloumns(c1,c2,c3), for each row I need to add c2,c3 and cross check whether it talllies with c1.Is it possible to do it with any utility.

Let us assume a file with LRECL=15,RECFM=F and having fields
C1:position 1 and length 5,
C2:position 6 and length 5 and
C3:position 11 and length 5.

The following sort jcl will give the SORTOUT which contains the records of sum of fields C2 and C3 is equal to C1 and OMIT which contains the records of sum of fields C2 and C3 is not equal to C1.
Code:
// EXEC PGM=SORT                                       
//SORTIN DD DSN=INFILE,DISP=SHR
//SORTOUT DD DSN=OUTFILE1,.....
//OMIT DD DSN=OUTFILE2,.....
//SYSOUT DD SYSOUT=*                                   
//SYSIN DD *                                           
 OPTION COPY                                           
 INREC OVERLAY=(16:6,5,ZD,ADD,11,5,ZD,M11,LENGTH=6)     
 OUTFIL INCLUDE=(1,5,ZD,EQ,16,6,ZD)                     
 OUTFIL FNAMES=OMIT,SAVE                               
/*
//
Back to top
View user's profile Send private message
MGayathri

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Tue Nov 20, 2007 1:29 pm    Post subject:
Reply with quote

Thanks a lot for your response icon_smile.gif
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Tue Nov 20, 2007 1:30 pm    Post subject:
Reply with quote

MGayathri

Please check with the following link for DFSORT/ICETOOL Reference Material
http://ibmmainframes.com/viewtopic.php?t=1348
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm

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