FOR1001E
locator-text The length of the record to be written exceeded the maximum data length, data-length, allowed for records in the file. VS FORTRAN Version 2 Error Number: AFB164I, AFB201I (format 1), AFB201I (format 2), AFB204I, AFB212I, AFB213I

Explanation

Based on the type of formatting described by the FMT specifier (or by its absence) on the WRITE or REWRITE statement, one of the following exceeded data-length, which is the smaller of either the maximum length of the data that can fit in a record in the file or the value given in the RECL specifier, if any, on the OPEN statement:
  • For output using a format specification:
    • The length of the record described by the output item list and the format specification.
  • For list-directed output or namelist output:
    • For an output item of neither character type nor complex type, the formatted length of the item.
    • For an output item of complex type, the formatted length of the real or the imaginary part.

    The formatted lengths of the output from list-directed formatting for the various data types is listed in “WRITE Statement — List-Directed I/O to External Devices” in VS FORTRAN Version 2 Language and Library Reference. For namelist formatting, the lengths of the data are the same.

  • For unformatted output:
    • The total length of all the items in the output item list.

The maximum length of a record that can be written on a particular file depends on the values of certain specifiers given on the OPEN statement and on various file characteristics managed by the underlying operating system's access methods. Length is taken from one or more of the following:

locator-text gives more information about the location of the error, and can be one of the following:
  • The WRITE statement for an internal file failed.
  • The statement statement for unit unit-number which was connected to file-name, failed.

System action

If either the ERR or the IOSTAT specifier is present on the I/O statement, then before control returns to the program, the record described for the action RN is written.

If neither the ERR nor the IOSTAT specifier is present on the I/O statement, the condition is signaled. If the condition either is unhandled or is handled by moving the resume cursor and resuming, then the record described for the action RN is written. If the condition is unhandled, the enclave stops executing after the record has been written.

Qualifying Data: The basic set of four qualifying data for I/O conditions as shown in Table 1. Within this basic set, statement has a value of READ, and parm_count has a value of 10. In addition, there are these qualifying data:

No. Name Input/ Output Data Type and Length Value
5 access Input CHARACTER*10 For an external file, the value SEQUENTIAL, DIRECT, or KEYED, depending on if the file is connected for sequential, direct, or keyed access, respectively. For an internal file, this qualifying datum contains the value SEQUENTIAL.
6 fmt-type Input CHARACTER*8 One of the following values to indicate the type of formatting indicated by the FMT specifier (or its absence) on the WRITE or REWRITE statement:
  • blanks: Unformatted
  • FORMAT: Format specification
  • *: List-directed formatting
  • NAMELIST: Namelist formatting
7 data_len Input INTEGER*4 Maximum length of the data that can be written into the records in the file during this connection. If this length is controlled by a RECL specifier on the OPEN statement, this qualifying datum has that value given by that RECL specifier. Otherwise, this is the maximum amount of data that can be written in the records in the file. When the record format is one of the variable-length formats, that is, variable (V), variable blocked (VB), variable spanned (VS), or variable blocked spanned (VBS), the length given here is the LRECL value less 4 (unless the RECL specifier had a smaller value).
Name Action Taken after Resumption
RN A record is written, but its length does not exceed the maximum length allowed for the file, and no additional record is written. Formatted and unformatted output are handled slightly differently:
Formatted output:
  • For a data item of other than character type that doesn't fit in the record, that data item is ignored, that is, none of it is placed in the record. (If the records are of fixed-length format, blanks fill the rest of the record. Otherwise, no additional characters are added to the record.) The rest of the output item list and the rest of the format specification, if any, are ignored.
  • For a data item of character type, including a character constant in the format specification, that doesn't fit in the record, as much of the item as can fit is placed in the record. The rest of this item, the rest of the output item list, and the rest of the format specification, if any, are ignored.
Unformatted output:
  • As much of the data from the output item list as can fit is placed in the record. This includes the data item that would overflow the record; as much of it as can fit is placed in the record. The rest of this item and the rest of the output item list are ignored.

In either case, execution then continues.

RF This action depends on several factors:
  • The type of formatting, if any, specified in the WRITE or REWRITE statement,
  • if the file is connected for sequential, direct, or keyed access
  • The record format.
For output using a format specification:
  • Files connected for sequential access: For a formatted data item of other than character type that doesn't fit in the record, none of it is placed in the record from which it would overflow. (If the records are of fixed-length format, blanks fill the rest of the record. Otherwise, no additional characters are added to the record.) The entire formatted data item is placed into the next record beginning at character position 1. Should the maximum length record be too short to hold this data item, as much of the data as can fit is placed in this next record, and the rest of the data is lost. No error is detected for this loss of data.

    For a data item of character type (including a character constant in the format specification) that doesn't fit in the record, as much of the item as can fit is placed in this record, and the remainder continues into the next record or records for as many records as it takes to hold the entire item.

    After the formatted data item is placed in the next record, normal processing of the rest of the format specification and the output item list continues. This same condition could be detected again for the same WRITE or REWRITE statement.

  • Files connected for direct access: The action is the same as for sequential access. When applied to direct access, the term next record refers to the record with the next higher record number.
  • Files connected for keyed access: This action is the same as RN.
RF (cont.) For list-directed and namelist output:
  • For the formatted data item (or the real or imaginary part of an item of complex type) that's longer than the record, none of the data is placed in the record. (If the records are of fixed-length format, blanks fill the rest of the record. Otherwise, no additional characters are added to the record.) The rest of the output item list is ignored.

    For data of character type, this error is not detected. Such data is automatically spanned across records without this being considered an error.

For unformatted output:
  • Files connected for sequential access: For non-VSAM files that have a record format of variable spanned (VS) or variable blocked spanned (VBS), a record of the size required by the output item list is written. This is just as though the LRECL value specified an unlimited record length. Such records generally cannot be read using languages other than Fortran because the lengths of records in the file exceed the LRECL value associated with the file.

    For other files connected for sequential access, this action is the same as RN. .

  • Files connected for direct access: As much of the data from the output item list as can fit is placed in the record. This includes the data item that would overflow the record; as much of it as can fit is placed in the record. The rest of this item plus the remaining data items in the output item list are written into as many records as necessary to hold the data. Each successive record is written as the record with the next higher record number.
  • Files connected for keyed access: This action is the same as RN.

Programmer response

Ensure that the length of the record described or implied by the output item list and the format identifier, if any, is no longer than the maximum length record that can be written to the file. Either the length of the record to be written or the maximum record length allowed for the file must be changed to correct the condition or conditions described in “Explanation.” If the length of the record being written isn't what you intended, then you might have to change:
  • The type of formatting indicated by FMT specifier (or its absence) in the I/O statement. For example, perhaps you intended to write the file using a format specification rather than using list-directed formatting.
  • The format specification. This can include errors in the edit descriptors, field widths, repetition factors, nesting levels, Hollerith constants (H edit descriptor), and character constants.
  • The output item list. There could be errors in the number of items in the list, in the data types and lengths of individual items, and in the specification of implied DOs in the output item list.
If the length of the record is what you intended, then the maximum record length allowed for the file must be increased. If you are creating a new file, you might have to change:
  • The record length given in the RECL specifier of the OPEN statement
  • The LRECL parameter on a DD statement or a TSO ALLOCATE command (when dynamic file allocation is not involved) or the LRECL parameter for the FILEINF callable service (when dynamic allocation is involved)
    For record formats of variable spanned or variable blocked spanned, you can make the record length larger than the block size. You can also define the record to be of unlimited length in one of these ways:
    • When dynamic file allocation is not involved, provide a value of X for the LRECL parameter of a DD statement or a TSO ALLOCATE command.
    • When dynamic file allocation is involved, provide a value of -1 for LRECL in the arguments for the FILEINF callable service.

    For any of the variable-length record formats, that is, for variable (V), variable blocked (VB), variable spanned (VS), or variable blocked spanned (VBS), the length given as LRECL includes a 4-byte record descriptor word. Therefore, the LRECL value must be four bytes larger than the largest amount of data that you want to write in a single record.

  • The RECFM and BLKSIZE parameters on a DD statement or a TSO ALLOCATE command when dynamic file allocation is not involved or as parameters for the FILEINF callable service when dynamic file allocation is involved. Note that when not all of the RECFM, LRECL, and BLKSIZE parameters have been specified for a particular program, the defaults in the Unit Attribute Table are applied for the omitted ones. Sometimes this causes inconsistencies among the parameters; this is resolved as described in “Considerations for Specifying RECFM, LRECL, and BLKSIZE” in Chapter 12, or in VS Fortran Version 2 Programming Guide for CMS and MVS.
  • The use of a particular device or file itself if the device or file isn't capable of accepting a large enough record
  • The maximum record length given as the second sub-parameter of the RECORDSIZE parameter on the DEFINE command that defined a VSAM cluster

If you are writing on an existing file whose previous contents you want to retain, then you generally cannot increase the record length without recreating the file.

The person at your installation who gives system support for Language Environment can change your installation's default values for record format, record length, and block size for various units. This is done by customizing the the Unit Attribute Table. As part of this process, the SFLRECL or SULRECL parameters on the AFHODCBM macro instructions can specify larger default values for formatted or unformatted I/O. Each unit (other than the error message unit) can be given different default values.

Symbolic Feedback Code

FOR1001