Addition using DFsort

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
raulravi
Member
Posts: 47
Joined: Mon Apr 18, 2011 9:51 am
Location: India

Addition using DFsort

Post by raulravi » Mon Jan 02, 2012 6:20 pm

Hello Frank,

Code: Select all

My file looks like

----+--
*******
1501   
1588   
1598   
1600   


I want to add the position1 + position2 +position3 +position4.
Eg:
1+5+0+1 = 7
1+5+8+8 = 22==> 2+2 = 4.
1+5+9+8 = 23==> 2+3 = 5.
1+6+0+0 = 7
Can we do this kind of operation in DFSORT?

Raul

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Jan 03, 2012 5:56 am

You can use a DFSORT job like the following:

Code: Select all

//S1 EXEC PGM=SORT                                                    
//SYSOUT DD SYSOUT=*                                                  
//SORTIN DD *                                                         
1501                                                                  
1588                                                                  
1598                                                                  
1600                                                                  
//SORTOUT DD SYSOUT=*                                                 
//SYSIN DD *                                                          
  OPTION COPY                                                         
  INREC IFTHEN=(WHEN=INIT,                                            
    BUILD=(1,1,ZD,ADD,2,1,ZD,ADD,3,1,ZD,ADD,4,1,ZD,TO=ZD,LENGTH=2)),  
   IFTHEN=(WHEN=INIT,                                                 
    BUILD=(1,1,ZD,ADD,2,1,ZD,TO=ZD,LENGTH=1))                         
SORTOUT will have:

Code: Select all

7      
4      
5      
7      
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others