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 Wanted to calculate TRK when i have B... Balu5491 JCL & VSAM 7 Wed Jul 19, 2017 5:43 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


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