[Info-vax] DEC BASIC: How to read a sequential
Hein RMS van den Heuvel
heinvandenheuvel at gmail.com
Sun Apr 15 13:24:28 EDT 2012
On Friday, April 13, 2012 8:41:23 AM UTC-4, StGallen wrote:
> All,
> DEC Basic 1.3. VMS 7.3.2
>
> I need to open a sequential file with variable record length.
Input or output?
> How can I do this, especially since I cannot define the size of the STRINGS in
> the MAP file?
Other have explained alternatives.
You can still use a MAP if you like.
Just declare a large enough string ( STRING my_data = 200 )
Don't make it too large because the record will be zero-filled on each GET
Process taking the actual count into consideration (RECOUNT and LEFT$)
The silly program below shows that the record cleared beyond recount.
There will not be a CR-LF unless explcit in the record,
and no 'see through' of prior longer reads.
Hein
1 OPTION TYPE = EXPLICIT
on error go to hell!
!
DECLARE INTEGER I, L
MAP (buf) string my_record = 2000
MAP (buf) string x=20, y=20, z=20
OPEN "login.com" FOR INPUT AS FILE #1, RECORDTYPE ANY, MAP buf
FOR i = 1 to 5 step 1
GET #1
L = RECOUNT
PRINT I,L, "<"; X; ">", "<"; Y; ">", "<"; Z; ">"
NEXT I
GOTO 2
hell: PRINT ERT$(ERR) UNLESS ERR = 11
RESUME 2
2 END
More information about the Info-vax
mailing list