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

To get the count and sum from the I/P file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Tue May 18, 2010 12:35 pm
Reply with quote

I/P file layout:

A 100
B 200
C 300
D 400
E 500

Position :1st Byte--> Type, 3-5th byte---> Amount

Output File Layout should be:

5 1500

Position :1st Byte--> Sum of records count , 4-7th byte---> Sum Of amount Amount

Requirement : O/P file should contains total no of records present in the I/P file and sum of the amount field.

Can anyone help me here?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 18, 2010 2:07 pm
Reply with quote

What if count exceeds 9 and sum 999???
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Tue May 18, 2010 2:12 pm
Reply with quote

The requirement is like that only to concider upto 9 for count and summation 9999 (4-7 bytes in O/P file).
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue May 18, 2010 2:16 pm
Reply with quote

Open the file in an editor, use a calculator and get the crap requirement done.
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Tue May 18, 2010 2:18 pm
Reply with quote

This is a part of daily batch process so I think we can not not do like that.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue May 18, 2010 2:37 pm
Reply with quote

Debasis Misra wrote:
The requirement is like that only to concider upto 9 for count and summation 9999 (4-7 bytes in O/P file).

Output you have shown is having sum from 3rd byte..
Below sort step will give you required output.
Code:

//STEP10   EXEC PGM=SORT                                         
//SORTIN       DD *                                               
A 100                                                             
B 200                                                             
C 300                                                             
D 400                                                             
E 500                                                             
/*                                                               
//SORTOUT DD SYSOUT=*                                             
//SYSOUT  DD SYSOUT=*                                             
//SYSIN    DD  *                                                 
  SORT FIELDS=COPY                                               
  OUTFIL REMOVECC,NODETAIL,                                       
  TRAILER1=(COUNT=(M11,LENGTH=1),X,TOT=(3,3,ZD,EDIT=(TTTT)))     
/*                                                               

I am sure this is homework.
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Tue May 18, 2010 3:29 pm
Reply with quote

thanks a lot, its working fine.
Its not home work, believe mw icon_biggrin.gif
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 FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts To get the count of rows for every 1 ... DB2 3
Search our Forums:

Back to Top