FCONTROL()

FCONTROL()

Top  Previous  Next

 

The FCONTROL() function performs control actions on an open file.

 

 

Format

 

FCONTROL(fvar, action {, qualifier})

 

where

 

fvaris the file variable associated with an open file.

 

actionidentifies the action to be performed.

 

qualifieris additional information relevant to the action.

 

 

The FCONTROL() function performs the action defined by action against the file open as fvar.

 

The action values are listed below using the tokens defined in the SYSCOM KEYS.H include record:

 

FC$SYNC (1)

Controls or retrieves the state of forced writes for a hashed file. See synchronous (forced write) mode in the section that discusses dynamic files for more details.

 

If qualifier is False, forced writes are disabled. If qualifier is True, forced writes are enabled. For all values of qualifier, the previous state of forced writes is returned as the result of the function. Use a qualifier value of -1 to return the current state without updating it.

 

Note that, if the file is open to multiple file variables within the one process, this action affects all writes to the file regardless of which file variable is used.

 

FC$SET.SEQ.KEY (2)

Sets the sequential number to be used as the record id of the next record written using the CREATING.SEQKEY option to the WRITE statement. Applies only to hashed files. Returns True if successful.

 

FC$GET.SEQ.KEY (3)

Retrieves the sequential number to be used as the record id of the next record written, incrementing this value. This allows a program to reserve a sequential id without using the CREATING.SEQKEY option to the WRITE statement. Returns a null string if fvar does not reference a hashed file.

 

FC$CRLF (4)

Controls or retrieves the line terminator mode to be used for a directory file or sequential file. If qualifier is a valid mode setting, the file is switched into the specified mode. For all values of qualifier, the previous state of the line terminator selection is returned as the result of the function. Use a qualifier value of -1 to return the current state without updating it. See directory files for a discussion of the mode values. The SYSCOM KEYS.H record defines tokens for the mode settings:

0   FC$CRLF.LFLF terminator, CR is data character
1   FC$CRLF.CRLFCRLF pair terminator, keep lone CR or LF
2   FC$CRLF.BOTHCRLF or LF terminator, keep lone CR
3   FC$CRLF.NOCRCRLF or LF terminator, discard all CR

 

FC$ACCESS (5)

Checks whether the user has access to the field position specified by qualifier. If the file does not use data encryption, this action always returns True.

 

 

 

Example

 

OPEN "AUDIT" TO AUD.F ELSE STOP "Cannot open AUDIT file"

VOID FCONTROL(AUD.F, FC$SYNC, @TRUE)

 

This program fragment opens the AUDIT file and sets forced write mode. The same effect could have been achieved with the SYNC option to the OPEN statement.

 

 

See also:

OPEN, OPENPATH