RECORD condition

Identifies truncated records.

Enabled/Disabled status

Always enabled.

Result

The length prefix for the specified file is sometimes transmitted inaccurately.

Raised

During a READ, WRITE, or REWRITE operation when:

  • The record variable is smaller than the record size. This can occur for either of the following reasons.
    • The record is larger than the variable in a READ INTO statement. The remainder of the record is lost.
    • The record length specified for a file with fixed-length records is larger than the variable in a WRITE or REWRITE statement. The remainder of the record is undefined. If the variable is a varying-length string, the RECORD condition is not raised if the SCALARVARYING option is applied to the file.
  • The record variable is larger than the record size. This can occur for any of the following reasons.
    • The record length specified for a file with fixed-length records is smaller than the variable in a READ INTO statement. The remainder of the variable is undefined. If the variable is a varying-length string, the RECORD condition is not raised if the SCALARVARYING option is applied to the file.
    • The maximum record length is smaller than the variable in a WRITE or REWRITE statement. The remainder of the variable is lost.
    • The variable in a WRITE or REWRITE statement indicates a zero length. No transmission occurs. If the variable is a varying-length string, the RECORD condition is not raised if the SCALARVARYING option is applied to the file.
  • The record variable length is either zero or too short to contain the embedded key. This occurs because the variable in a WRITE or REWRITE statement is too short to contain the embedded key.

Restrictions

  • If a file is closed in an ON-unit for the RECORD condition, the results of normal return are undefined. Exit from the ON-unit with the closed file must be achieved with a GO TO statement.
  • If the SCALARVARYING option is applied to the file using locate mode to transmit varying-length strings, a 2-byte length prefix is transmitted with an element varying-length string. The length prefix is not reset if the RECORD condition is raised. If the SCALARVARYING option is not applied to the file, the length prefix is not transmitted. On input, the current length of a varying-length string is set to the shorter of the record length and the maximum length of the string.

Syntax

RECORD file-reference

Parameter

file-reference
A scalar file reference.

Other Information

Condition codes
20 - 24
Implicit action
Prints a message and raises the ERROR condition.
Normal return
Continues execution with the statement immediately following the one for which RECORD was raised. Can also be undefined. See Restrictions above.