[Info-vax] DEC BASIC: How to read a sequential

David Froble davef at tsoft-inc.com
Sat Apr 14 09:58:03 EDT 2012


Johnny Billquist wrote:
> On 2012-04-13 14:41, StGallen wrote:
>> All,
>> DEC Basic 1.3. VMS 7.3.2
>>
>> I need to open a sequential file with variable record length. How can
>> I do this, especially since I cannot define the size of the STRINGS in
>> the MAP file?
>>
>> Also if I open the file without a MAP file, how do I read the records
>> from the file?
>>
>> Any help deeply appreciated.
>>
>> Many thanks!
> 
> Syltrem gave one suggestion.
> Another, which I think works (it works under BASIC+2 anyway) is:
> 
> +++
> OPEN filename AS FILE n, ORGANIZATION SEQUENTIAL VARIABLE, &
>   RECORDTYPE ANY
> 
> GET #1
> MOVE FROM #1, A$=RECOUNT
> +++
> 
> that will give you the record in A$. Repeat until EOF.
> 
> In general, the answer to the question of how to get data without a MAP 
> is the MOVE statement.
> 
>     Johnny
> 

Basic has various ways for this simple request.  Linput would be prefered, if the file is 
sequential variable, or sequential fixed.  I'd only use GET in special cases, such as 
embedded <CR><LF> in the data, where I'd have to parse out the actual records.

But, help for this is built in, and HELP OPEN, HELP LINPUT, and such will tell all you how 
to use the commands, and most often show examples.



More information about the Info-vax mailing list