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
 

 

calculate total amount in one file and send to outfile

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
nmr

New User


Joined: 27 Sep 2007
Posts: 14
Location: hyderabad

PostPosted: Mon Dec 31, 2007 6:12 pm    Post subject: calculate total amount in one file and send to outfile
Reply with quote

hi all,

before posting i search in the forum i did not get proper answer so i am posting

Code:

policy        amount
6064            1000
6064            4000
6064            2000
6064            3000
6064            4000
6065            4000
6065            5000
6065            6000
             -------
               29000
            --------


my requirement i want to calculate total from the amount field and need to send only total amount(29000) to another file

can any body give me an idea for this requirement
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Dec 31, 2007 6:47 pm    Post subject:
Reply with quote

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*                     
//SORTIN   DD *                           
6064 1000                                 
6064 4000                                 
6064 2000                                 
6064 3000                                 
6064 4000                                 
6065 4000                                 
6065 5000                                 
6065 6000                                 
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                           
  SORT FIELDS=COPY                         
  OUTFIL REMOVECC,NODETAIL,               
         TRAILER1=(TOT=(6,4,ZD,LENGTH=7)) 
/*                                         
Back to top
View user's profile Send private message
nmr

New User


Joined: 27 Sep 2007
Posts: 14
Location: hyderabad

PostPosted: Mon Dec 31, 2007 9:16 pm    Post subject: Reply to: calculate total amount in one file and send to ou
Reply with quote

hi krisprems

your giving code is working fine i am getting total amount in the output file
but the total i am geeting in the 4th position in the out put file, i want the amount field to start in 73 coloumn, how can we do this, you have any solution for this.
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: Mon Dec 31, 2007 9:16 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80 and that's what you want for the output file as well, but the job can be changed appropriately for other attributes. I also assumed you wanted a 5-byte total with leading zeros, but that can be changed if appropriate as well.

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
6064            1000
6064            4000
6064            2000
6064            3000
6064            4000
6065            4000
6065            5000
6065            6000
/*
//SORTOUT  DD DSN=...  output file (FB/80)
//SYSIN    DD *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    TRAILER1=(73:TOT=(17,4,ZD,EDIT=(TTTTT)))
/*


SORTOUT would have:

Code:

                                                                        29000
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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