IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to sum selected columns of a file using sort utility


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
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
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: 1287
Location: Chennai, India

PostPosted: Tue Nov 20, 2007 12:38 pm
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top