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 Usergroups Profile Log in to check your private messages Log in
 

 

Summing up columns within 1 row

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Summing up columns within 1 row
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 Moderator


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

PostPosted: Fri Jul 21, 2006 8:42 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Summing on Mixed Case Literals Roy Ware SYNCSORT 3 Tue Jan 03, 2017 10:18 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Consolidating and summing file contents Kevin Lindsley SYNCSORT 14 Thu Jun 09, 2016 5:24 am
No new posts Combine columns without breaking words Indrajit_57 SYNCSORT 1 Sat Mar 19, 2016 9:33 am


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