View previous topic :: View next topic
|
Author |
Message |
Debasis Misra Warnings : 1 New User
Joined: 16 Sep 2008 Posts: 72 Location: Bangalore
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
What if count exceeds 9 and sum 999??? |
|
Back to top |
|
|
Debasis Misra Warnings : 1 New User
Joined: 16 Sep 2008 Posts: 72 Location: Bangalore
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Open the file in an editor, use a calculator and get the crap requirement done. |
|
Back to top |
|
|
Debasis Misra Warnings : 1 New User
Joined: 16 Sep 2008 Posts: 72 Location: Bangalore
|
|
|
|
This is a part of daily batch process so I think we can not not do like that. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
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 |
|
|
Debasis Misra Warnings : 1 New User
Joined: 16 Sep 2008 Posts: 72 Location: Bangalore
|
|
|
|
thanks a lot, its working fine.
Its not home work, believe mw |
|
Back to top |
|
|
|