Forget my earlier example, as it's just one of several feeble attempts.
I want a percentage of the number of customer calls within a group of billed accounts. In the following example, of the 26,392 accounts which billed a couple of weeks ago, 997 of the customers called within a 14-day period.
Here is an input record, and yes, the fields are labeled:
TOTAL BILL = 026392 BILL & CALL = 000997 % OF BILLED =
The result of dividing the smaller by the larger is .037776598 which I would like to see as 3.78 or something similar.
TOTAL BILL = 026392 BILL & CALL = 000997
TOTAL BILL = 026392 BILL & ADJ = 000227
I'd like to see this o/p record:
TOTAL BILL = 026392 BILL & CALL = 000997 % OF BILLED = 3.78
TOTAL BILL = 026392 BILL & ADJ = 000227 % OF BILLED = 0.86
My routine formats the o/p as the first 40 bytes of the i/p record, a third label in position 42 ("% of billed") and a percentage calculated by dividing i/p field (35,6,ZD) by i/p field (14,6,ZD).
I was asked to come up with something quick (isn't it always the way?) and rather than write a COBOL program on the fly which I knew darn well would change once they began seeing the results, I used DATACOM queries to derive the data, ICETOOL to match and splice, and for the last piece I thought I'd try the above.
I've never used any SORT calculation except SUM, and looking through the manuals has given me lots of ideas and parameters, but I'm stuck here. If you could steer me in the right direction for finding a good resource for figuring this stuff out, I'd be grateful.
As soon as we come out of storm mode (I work for a power company in Maine and we have about 130K outages right now) and things settle down to a dull roar I'll try to spend some time with Mr. Overlay and learn more about all those instructions.
For all I know the client will want to see 4% so as not to be troubled with all those pesky decimal places, but better to err on the side of too much precision than too little.
Your explanation has been quite, um, illuminating.
And now, my shift in the storm rotation is coming to an end and I will be going home soon. Oh, how I do hope they decide to take us out of "storm mode" before my next turn in the five-person rotation comes around at midnight on Sunday morning!
Thank you for all your help and explanations. Between this and ICETOOL I'm doing all kinds of neat stuff with flat files. Who says you can't teach an old dinosaur new tricks?