You are here: Development Standards > Routines > General Routines > GENOPEN.PUB

# GENOPEN.PUB

GENOPEN.PUB is a public program that OPENs and CLOSEs data files.

`0100 ENTER FILE[ALL],FILE$,IND,TASK,TPL$,MSG$,Y$,GENOPEN$`

Variable | Description
FILE[ALL] | Standard file array
FILE$ | File to open
IND | FILE[] array index. Values are 1- NUM(STBL(“CHANNELS”)). A negative array index indicates that the file should be locked.
TASK | Determines the task GENOPEN.PUB is to perform. 0 = OPEN the file in F$ on the index array channel in F0 1 = Get the string template for the file in F$ 2 = OPEN the file in F$ on the index array channel in F0 and get the file’s string template 3 = Search for the file in F$ in the FILE[] array and return the channel index (if found) in F0 4 = CLOSE the data file on index array channel F0 5 = Search for the file in F$ in the FILE[] array and return the channel index (if found) in F0, or open the file if the file was not found and return the FILE[] array index in F0 (if TASK is negative on return, the file was OPENed by GENOPEN.PUB) 6 = Search for the file in F$ in the FILE[] array and return the channel index (if found) in F0, or open the file and retrieve the string template if the file was not found 7 = Search for an open index in the FILE[] array and open the file in F$ on that index. 8 = Search for an open index in the FILE[] array, open the file in F$ on that index, and return the file's string template. 9 = Check if file in F$ exists. Return -9 in TASK if file is not found. 10 = Unlock a previously locked file. 11 = Lock a previously unlocked file. 12 = Open OSMN file and return the string template.
TPL$ | GENOPEN.PUB returns the string template retrieved (if any)
MSG$ | An error message is returned if the operation is unsuccessful
Y$ | GENOPEN.PUB and the CALLing program share the current command, in case the user aborts processing
GENOPEN$ | String template used by GENOPEN.PUB

Exit Points | Explanation
EXIT | GENOPEN.PUB never returns an error. If a file OPEN is unsuccessful, a message is returned in MSG$.

This chart breaks down the GENOPEN$ template:

Field | Description
CRYP:N(1*) | Set to 1 if file to be opened is an encrypyted file.
RET:C(1*) | Set to "U" if a file is not available to be locked or unlocked.
METHOD:N(1*) | Not used