qsysopr
asked on
cobol control-break question
I have a text file with6 fields
region pic x 3
section pic x 3
proj # pic x 5
type pic x 15
budget amt pic 9(9)
actual amt pic 9(9)
I have to create a report showing the following fields with thier proper
headings. also I must show a variance (+, -) showing the difference
between budget and actual amts. I am able to do this, but at the bottom of the report I must show totals for sections, and totals for regions.
When I attempt to do this I loose my calculated variance field. I know
I am doing this program incorrectly and am going nowhere. if it will
help I can e-mail my .txt file and my code.
thank you.
region pic x 3
section pic x 3
proj # pic x 5
type pic x 15
budget amt pic 9(9)
actual amt pic 9(9)
I have to create a report showing the following fields with thier proper
headings. also I must show a variance (+, -) showing the difference
between budget and actual amts. I am able to do this, but at the bottom of the report I must show totals for sections, and totals for regions.
When I attempt to do this I loose my calculated variance field. I know
I am doing this program incorrectly and am going nowhere. if it will
help I can e-mail my .txt file and my code.
thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I swear I won't cobol, but I am also sure that if I did and init routine I would also run a cleanup routine at the end.
More than likely I would use Eof to process some totalling code, then leaf out to cleanup of files and such.
> PERFORM PRINT-DETAIL
> PERFORM READ-NEXT
yah, very nice and crisply done
More than likely I would use Eof to process some totalling code, then leaf out to cleanup of files and such.
> PERFORM PRINT-DETAIL
> PERFORM READ-NEXT
yah, very nice and crisply done
Sunbow,
Using a 'switch-value' for EOF in a "sortwork-key" offers the advantage that even multiple files can be "levelled" automatically and that those files having EOF are automatically skipped for pocessing by the value of this EOF field!
Using a 'switch-value' for EOF in a "sortwork-key" offers the advantage that even multiple files can be "levelled" automatically and that those files having EOF are automatically skipped for pocessing by the value of this EOF field!
How is the progress on the report ?
did it work?
Pseudo code (not in COBOL)
mregtot = 0
msectot = 0
AS long as !eof()
mregion = region
msection = section
if section changes
do control break (where U will print that section's total...
endif
if region changes
do control break (where U will print that region's total...
endif
Calculate variance for each detail....
-----------
In Control break of section and region , reinitialise the respective totals to zero...