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

Summing up columns within 1 row


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Deepti Bhopatkar

New User


Joined: 11 Apr 2006
Posts: 8
Location: Pune

PostPosted: Fri Jul 21, 2006 12:21 pm
Reply with quote

Hi ,

Following is my quey . The file format is follows -

Code:

Name   Emp code  Basic  HRA Bonus
abc    123       50     25  25


I have to copy this file into another file and add 1 extra column which is
GROSS and GROSS = Basic + HRA + Bonus ( picture clause of all the amounts is same s9(9) v comp3 ) . The layout of output will be as follows -

Code:

Name   Emp code  Basic  HRA Bonus GROSS
abc    123       50     25  25    100


In short can we add some columns within 1 single row thru sort? If yes , How?

Thanks !
Deepti
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 21, 2006 8:42 pm
Reply with quote

You can a use a DFSORT job like the one below to do what you asked for. You didn't give the starting position of your fields, so I assumed the following layout:

Code:

Name     = 1-10
Emp code = 11-15
Basic    = 16-20
HRA      = 21-25
Bonus    = 26-30
Gross    = 31-35


Code:

//S1    EXEC  PGM=ICEMAN                                         
//SYSOUT    DD  SYSOUT=*                                         
//SORTIN DD DSN=... input file                             
//SORTOUT DD DSN=...  output file 
//SYSIN    DD    *                                               
  OPTION COPY                                                   
  OUTREC FIELDS=(1,30,                                           
    31:16,5,PD,ADD,21,5,PD,ADD,26,5,PD,TO=PD,LENGTH=5)   
/*
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts DB2 Views with Multiple SQL & Col... DB2 8
No new posts SORT - To repeat a string in same col... SYNCSORT 3
No new posts JCL - To repeat a string in same colu... JCL & VSAM 2
Search our Forums:

Back to Top