The Number 1 independent website for ACL information!

TexasACL User Group
About Us
Training
Why ACL
Essays & Scripts
ACL News
Events
Links
FAQ
Site Map
Support Us
COMMENT:  This script was in Porter Broyles' library.  The author of it and the following comment is unknown, but he suspects it might be David Coderre.

Sorry. I was worried about that - the first and last records are usually the tricky ones - but I had other stuff to do and so I let it slide. Glad you caught it.
See highlighted changes - give it a try and let me know.
***************************************************************

SET safety off
DELETE unit_date.fil OK
DELETE format unit_date OK
OPEN pcard
SORT on Unit Date to v_temp OPEN
Count
prev_unit=blanks(14)
prev_date=`19100301`
Ctr=1
rec_ctr=1

GROUP if prev_unit=unit
EXTRACT Unit Date to Unit_Date if rec_ctr=count1
Prev_unit=unit
prev_date=date
ctr=ctr+1
rec_ctr=rec_ctr+1
ELSE
EXTRACT Prev_Unit Prev_Date if ctr>1 to Unit_Date
EXTRACT Unit Date to Unit_Date
Prev_unit=unit
prev_date=date
ctr=1
rec_ctr=rec_ctr+1
END

OPEN Unit_Date

DELETE temp.fil OK
DELETE format temp OK
DELETE Ctr OK
DELETE Rec_Ctr OK
DELETE COUNT1 OK
SET safety on