Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups 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 -> Interview Questions
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
References
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1182
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: 182
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: 182
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Interview Questions All times are GMT + 6 Hours
Page 1 of 1