Reviewed and revised April 2024
xcall MIAMEX, MX_FILEVAR, op, ch, sts, recno {,stat}
MX_FILEVAR (MIAMEX 195) gets or sets the value of the file record number variable, and, in the case of ISAM-A, the stats variable.
Parameters
op (Num) [in]
specifies 0 for get, and 1 for set
ch (Num) [in]
is the file channel
sts (Signed Num)) [out]
returns 0 for success, -1 if file ch not open, or -2 for unsupported file type
recno (Num) [in/out]
the value of the record number variable—associated with the file in its OPEN statement—to be retrieved or set.
stat (Num) [in/out]
the value of the stat variable—associated with the file in its OPEN statement—to be retrieve or set.
Parameters
The need for this function arises from the fact that the various file OPEN statements create an internal ink between the file channel and the record number / status variables, which must have global scope. But that complicates the ability to create user defined functions that perform file operations based on the channel number as an argtument. Either you have to declare those control variable as ++extern inside or any such function, or you can use MX_FILEVAR to access those control variables. Another approach would be to use the "X" versions of the file i/o statement, which take the control variables as explicit arguments.
See Also
History
2019 July, A-Shell 6.5.1664: Function added to A-Shell.