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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: To get the count and sum from the I/P file
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    Post subject:
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    Post subject:
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: 2435
Location: Netherlands, Amstelveen

PostPosted: Tue May 18, 2010 2:16 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    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
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
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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