Converting a Triple Quota file to a single ASCII record with all 3 values on 1 record

The mentor script below will read a quota file built using the Triple_Quotas option and convert it to ASCII such that each quota has a single record with all 3 values (regular, reset-able, and target) all on a single ASCII record. This makes creating a custom quota report much easier to do.

This spec reads a quota file using triple quotas and creates a single record fo each quota with all 3 values on it.

Default output file will be called <studyname>.qdata

Layout of output record

1-16 Quota Name
36-43 Value of Quota
51-58 Resetable Quota value
61-68 Target Value of Quota

>define @studyname tripq ”study name
>define @dirname ”directory where the quota file is. Leave blank if running locally
”>define @write_0_target_quotas ”Use this define if you want to write out the quota with 0 targets
>define @outname @studyname~.qdata ”Name for output file


quotaname: [1.19$]
value: [36.8]
target: [2.3,3,…,18#”.t “]
reset: [2.3,3,…,18#”.r “]

reset_value: [51.8]
target_value: [61.8]

‘next line converts quota file to ASCII file with the name <studyname>.aqu similar to out option in quotamod
~write_quota @dirname@studyname~.quo, @studyname

‘next block of code adds sequence number to records so that file can be sorted back into original sort order
~in @studyname~.aqu ascii=100 select=[32#”=”]
~out @studyname~.tmp1 ascii


seq_numb: [71.8]

proc= mark_seqnumb:
Modify seq_numb = CaseNumber
WriteCase }

~exc proc=mark_seqnumb

‘sort file by quota name so can put the 3 quota records together
~in @studyname~.tmp1 ascii=100
~out @studyname~.tmp2 ascii
~sort quotaname

‘set up proc to read in 3 records, write record out if you are reading the target record
~in @studyname~.tmp2 ascii=100 numbuf=2 study=orig
~in $ newbuf study=output
~out @studyname~.tmp3 ascii length=100


proc= combine:

if target
error “got target” quotaname
copy output!target_value = value
>ifdefine @write_0_target_quotas
choosefile “output”
if output!target_value > 0
choosefile “output”
if reset
error “got reset” quotaname
copy output!reset_value = value
error “got regular” quotaname
copy output!quotaname = quotaname
copy output!value = value
copy output!seq_numb = seq_numb

~exc proc=combine on orig

‘now sort file in original sequence order so final file is in original sort order
~in @studyname~.tmp3 ascii=100
~out @outname ascii length=70

~sort seq_numb

‘delete temp files
>delete @studyname~.tmp1
>delete @studyname~.tmp2
>delete @studyname~.tmp3