Please enable JavaScript to view this site.

A-Shell Reference

Updated October 2019; see History

The "eXplicit" variations of READ, WRITE and UNLOKR take the following format:

XREAD #CH, RECNO, VAR {,VAR2...,VARN}

XREADL #CH, RECNO, VAR {,VAR2...,VARN}

XREAD'READ'ONLY #CH, RECNO, VAR {,VAR2...,VARN}

XWRITE #CH, RECNO, VAR {,VAR2...,VARN}

XWRITEL #CH, RECNO, VAR {,VAR2...,VARN}

XWRITEN #CH, RECNO, VAR {,VAR2...,VARN}

XWRITELN #CH, RECNO, VAR {,VAR2...,VARN}

XUNLOKR #CH, RECNO

 

These are equivalent to the standard versions of these statements (without the "X" and without the RECNO variable), except that instead of getting the record number implicitly, from the variable specified in the OPEN statement, the record number is specified, eXplicitly, in the statement.

While the "X" versions of the READ and WRITE file operations can be used in any context without penalty, there are two specific situations where they are extremely advantageous:

Within SBX routines, where they eliminate the need to use MX_FLSET to reset the address of the record number variable stored in the file's control structure. See Accessing Open Files for more information.
In parameterized/generic file operations where you don't know the record size at the time of writing the code. The standard variations of the WRITE statements will abort with a "record size overflow" error if the record variable specified in the WRITE is larger than the record size specified in the OPEN. The XWRITE variants avoid this limitation by automatically truncating the specified record variable to match the record size specified in the OPEN statement.

History

2019 October, A-Shell 6.5.1669:  Added XUNLOKR. Note that the appearance of XUNLOKR in a program will set the minimum version requirement in the RUN header to 1669.

2008, A-Shell build 1107: e"X"plicit variations of READ and WRITE added to A-Shell.