Skip to content

FILE-SUFFIX

FUNCTION

This Script-IV variable interacts with the OPEN command and with the file suffix indicator in data, sort, and text file names. This value is up to four characters long.

SYNTAX

FILE-SUFFIX

NOTES

  • The file suffix indicator is the @ character. It can be specified anywhere in a data, sort, or text file name, either in the link definition or in the DATA-FILE IS, SORT-FILE IS, or TEXT FILE IS clause of the OPEN command. Examples of file names with a file suffix indicator are ARCUST@ , AR@T, A@, ARCUST#, AR#T, A#.

  • The FILE-SUFFIX variable is saved separately for each operator.

  • If the link specifies a data or sort file name that contains the @ character, the OPEN LINK command will replace the @ character with the value in the FILE-SUFFIX variable. If the OPEN LINK command uses a DATA-FILE IS, SORT-FILE IS, or TEXT-FILE IS name, the name must be a string value. If the @ character is contained in either name the compiler must be able to resolve it at compile time.

    The following examples are valid for file names:

    DATA-FILE IS "FILEX@"
    DATA-FILE IS A$ + FILE-SUFFIX
    DATA-FILE IS DATA-NAME + FILE-SUFFIX
  • The FILE-SUFFIX variable value must be set by a LET command. The assignment statement must be on a line by itself. For example:

    LET FILE-SUFFIX = "ZZZ"
    LET A$ = FILE-SUFFIX, B$ = "ABC"

    Are valid assignments. In the first line, the value of FILE-SUFFIX is set with the LET command, and the command occupies its own line. In the second line, the first statement is valid because FILE-SUFFIX is to the right of the equal sign, so the statement is not a FILE-SUFFIX assignment.

  • If the value of the FILE-SUFFIX variable is null or spaces, the file suffix indicator is ignored and dropped from the file name for the current OPEN command. Nothing is replaced in the file name.

  • If the resulting file name, that is, the name plus the suffix value, is more than 14 characters long, the name will be truncated to 14 characters.

EXAMPLES

LET FILE-SUFFIX = COMPANY-CODE
OPEN LINK 4SCUST
DATA-FILE IS "4SCUST@"
SORT-FILE IS "4SCUST@"
TEXT-FILE IS "4SCUST@"

SEE ALSO

LET, OPEN

From the Script-IV Language Reference, version 8.9.1. Open this page in the PDF