MIAMEX 89: Clone file channel

xcall MIAMEX, MX_FLSET, ch, status, recvar'adr {,stavar'adr}

MX_FLSET may be used within an SBX routine to link up with the control variables associated with a random or ISAM file that was opened in the calling program.

Parameters

ch

is the file channel (opened in the parent program) that you want to access.

status  (F,6)

returns to a code reflecting the outcome of the operation:

Value

Meaning

-1

Parameter error

0

File CH was not open

1

Success: file was opened for INDEXED access (ISAM 1.0)

2

Success: file was opened for INDEXED’EXCLUSIVE

3

Success: file was opened for RANDOM access

4

Success: file was opened for INPUT

5

Success: file was opened for OUTPUT or APPEND

6

Success: file was opened for INDEXED access (ISAM-A)

7

Success: file was opened for INDEXED’EXCLUSIVE (ISAM-A)

 

recvar’adr  (X,6)

is an unformatted variable whose origin or location is the same as the F,6 variable which you want to use for specifying the record number for this file. We have to resort to this trick of mapping it as an X type so that we can get the true address of the variable, because otherwise floating point arguments to subroutines are pushed on the stack. So, for example, you should map it like this:

MAP1 RECNOX                 ! (specify this to MIAMEX, MX_FLSET)

    MAP2 RECNO,F,6          ! (actual record number control var)

 

or

 

MAP1 RECNO,F,6              ! (actual record number control variable)

MAP1 RECNOX,X,6,@RECNO      ! (specify this to MIAMEX, MX_FLSET)

 

In either case, specify the recnox variable in the MIAMEX call, but use the recno variable to set the record number within the file.

statvar’adr  (X,6)

is only used in the case of an ISAM-A file, and is used to specify the ISAM status variable that will return the result of each ISAM-A operation. It must be mapped and specified to the subroutine using the same trick as for recvar’adr above.

Comments

Once you successfully execute the MX_FLSET operation, you can have full access to the RANDOM, ISAM, or ISAM-A file within the subroutine.

Refer to SBX Subroutines for more information on this and related MIAMEX functions.