NAMEFILE (NAMF)
Syntax
![]()
Command
Mandatory parameter Optional parameter Mandatory keyword Optional keyword |
NAMEFILE (<File id>, <File name>[, REMOVEFILE | CLEARATFIRSTREAD])
Description
Assigns a file to a file identifier. Any current file assigned to alias name is closed.
Diagram
Returned value type
None
Parameters
Parameter | Description |
<File id> | Identifier that refers to the file from source code. |
File name | Name of the file to assign to the file id. A path may be included. |
REMOVEFILE (REMF) | If REMOVEFILE (REMF) is specified and this filename already exists, then the old file with the specified name will be removed. |
CLEARATFIRSTREAD |
If CLEARATFIRSTREAD is specified the file will be treated as an existing file but will be cleared when
the first action on it is a Readfile command. |
Remarks
When the file does not exist and REMOVEFILE or CLEARATFIRSTREAD is not specified, the application will wait for the file to be present at the first statement accessing the file. If the file does not exist, RESOK will be set to "False".
When CLEARATFIRSTREAD is specified the file will be treated as an existing file but will be cleared when the first
action on the file is the Readfile command.
If the file did not exist, an empty file will be created by
setting CLEARATFIRSTREAD. To disable the creation of empty files, the generation switch "DELEMPTYRETAINFILE" can be set to true.
Only the name of the file of the File Id is changed. No file is created or overwritten by this command.
Examples