DEFINE WORK FILE
n
|
[ATTRIBUTES
{operand3}...]
|
Note:
The elements shown in square brackets [...] are optional, however, at
least one of them must be specified with this statement.
This document covers the following topics:
For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.
Related Statements: CLOSE WORK
FILE
| READ WORK
FILE
| WRITE WORK
FILE
Belongs to Function Group: Control of Work Files / PC Files
The statement DEFINE WORK FILE
is used to assign a file
name to a Natural work file number within a Natural application.
This allows you to make or change work file assignments dynamically within a Natural session or overwrite work file assignments made at another level.
When this statement is executed and the specified work file is already open, the statement will implicitly close the work file.
Note:
For Unicode and code page support, see Work Files and Print Files on Windows, UNIX and OpenVMS
Platforms in the Unicode and Code Page
Support documentation.
Operand Definition Table:
Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
operand1 | C | S | A | U | yes | no | |||||||||||||
operand2 | C | S | A | U | yes | no | |||||||||||||
operand3 | C | S | A | U | yes | no |
Note:
If a format U operand is specified in Unicode (UTF-16), it is
converted to session code page characters before it is evaluated.
Syntax Element Description:
Syntax Element | Description | |
---|---|---|
DEFINE WORK FILE
n
|
Work File Number:
|
|
operand1
|
Work File Name:
The file name ( If Note: |
|
TYPE
operand2
|
TYPE Clause:
The value of |
|
DEFAULT
|
Determines the file type from the extension. Format: Depends on the work file type. Note: |
|
TRANSFER
|
Is used to transfer data to and from a PC with Entire Connection. This work file type represents a data connection between a Natural session on UNIX or OpenVMS and an Entire Connection terminal on a PC. Format: Notes:
|
|
SAG
|
Format: binary | |
ASCII
|
Files in ASCII are "text" files with records terminated by [a carriage return] line feed. Format: ASCII |
|
ASCII-COMPRESSED
|
Is a file in ASCII format, with the exception that all trailing blanks are removed. Format: ASCII |
|
ENTIRECONNECTION
|
With this work file type, you can read and write (using the
statements Format: Note: |
|
UNFORMATTED
|
A completely unformatted file. No formatting information is written (neither for fields nor for records). Format: |
|
PORTABLE
|
Files which can handle dynamic variables exactly and can also be transported: for example, from a Little Endian machine to a Big Endian machine, and vice versa. Format: |
|
CSV
|
Comma-separated values. Each record is written to one line in the file. By default, a header is not written. The default character which is used to separate the data fields is a semicolon (;). For further information, see Work Files in the Configuration Utility documentation. |
|
ATTRIBUTES
{operand3}... |
ATTRIBUTES Clause:
Several attributes separated by a comma or a blank can be specified, for example: DEFINE WORK FILE ATTRIBUTES 'APPEND,KEEP' If multiple values for the same attribute type are specified, the last value is taken, for example: DEFINE WORK FILE ATTRIBUTES 'APPEND,NOAPPEND' In this case, Example for ... DEFINE WORK FILE 11 'x.tmp' ATTRIBUTES 'BOM' * * write work file with BOM * DEFINE WORK FILE 11 'x.tmp' ATTRIBUTES 'NOBOM' * * write work file without BOM ... Note: The following is an overview of the attribute types and their possible values: |
|
Enable/Disable
Append Mode:
|
||
APPEND |
Activates the append mode. In this mode, new records are added at the end of the file. | |
NOAPPEND |
Deactivates the append mode. The file is rewritten from the start. This is the default value. | |
Enable/Disable Write
BOM Mode:
|
||
BOM |
Activates the write BOM (byte order mark) mode. A BOM will be written that precedes the work file data. | |
NOBOM |
Deactivates the write BOM mode. No BOM will be written. This is the default value. | |
Keep/Delete File
after Work File Close:
|
||
DELETE |
The work file is deleted after a close work file operation. | |
KEEP
|
The work file is kept after a close work file operation. This is the default value. |
For further information on work files, see Work File Formats.