I use this script to process file of 275,000 type '4' records.
Sometimes it fails with an error:
"Out of memory error"
If I comment out some of the total lines and rerun it will then finish.
I had a print statement in the Type 2 code section. There are about 2700 of these records.
Any suggestions? Is it simply file size or could the output file be running out of disk space?
Thanks,
Sometimes it fails with an error:
"Out of memory error"
If I comment out some of the total lines and rerun it will then finish.
I had a print statement in the Type 2 code section. There are about 2700 of these records.
Any suggestions? Is it simply file size or could the output file be running out of disk space?
Thanks,
Code:
BEGIN{ print "Counting claims ...\n"}
/^0/ { print "======> Header: ",$0; }
/^2/ { ++pharm_cnt;} -- Type 2 record
/^4/ { ++claim_total; -- Type 4 record
# unpack() converts from fixed width # to signed #
ing_cost_amt += unpack(substr($0,122,9));
disp_fee_amt += unpack(substr($0,131,9));
copay_amt += unpack(substr($0,140,9));
sales_tax_amt += unpack(substr($0,149,9));
claim_bill_amt += unpack(substr($0,158,9));
ing_cost_clm_amt += unpack(substr($0,495,9));
retail_price_amt += unpack(substr($0,504,9));
admin_fee_amt += unpack(substr($0,257,9));
pat_paid_amt += unpack(substr($0,569,9));
}
/^6/ { ++d; batch_billed_amt += unpack(substr($0,22,11));}
/^8/ { ++e; print "======> Tape Control: ",$0 }
END {
# print all the totals;
}