Start of change

Field names

Listed here are the requirements for specifying field names on the Open Query File (OPNQRYF) command parameters.

The field name used as the first part of an element in the list specified on the MAPFLD parameter must be a simple name, and the field names in the record format identified on the FORMAT parameter are always treated as simple names. Any other field name specified on an OPNQRYF command parameter (QRYSLT, KEYFLD, JFLD, GRPFLD, GRPSLT, or the field-definition expression part of the MAPFLD parameter) is a qualified field name, specified as follows:

field-name
Specify a simple field name that identifies a field that is defined on the MAPFLD parameter, or with a field name that is unique among all field names from all record formats included in the list specified on the FILE parameter. This form is not allowed if there is no MAPFLD parameter definition for the specified field name and the FILE parameter includes more than one record format that contains a field with the specified name, even if the same file and record format is specified more than once in the list on the FILE parameter.

For example, AMOUNT is valid if the field named AMOUNT is defined on the MAPFLD parameter. It is also valid if AMOUNT is not defined on the MAPFLD parameter, as long as there is only one field named AMOUNT in any record format specified on the FILE parameter.

file-name/field-name
Specify a field name that is qualified with the simple name of the file specified on the FILE parameter whose record format contains the field, but only if the simple file name is unique among all file names specified on the FILE parameter. This form is not allowed if the same simple file name is specified more than once in the list specified for the FILE parameter, even if different library, member, or record format names are used.

For example, WHS01/PARTNBR is valid if there is a field named PARTNBR in the record format for file WHS01, and file name WHS01 is only specified once on the FILE parameter.

file-nbr/field-name
Specify a simple field name that is qualified with the number of the element in the FILE parameter list for the record format that contains the field. The file-nbr qualifier must be specified without leading zeros. This form is only required if the same simple file name is specified more than once in the list specified on the FILE parameter.

For example, 2/BALDUE is valid if the second file record format in the list specified on the FILE parameter contains a field named BALDUE.

*MAPFLD/field-name
Specify a simple field name that is qualified with the special value *MAPFLD if the field is defined on the MAPFLD parameter. When the field is defined, this form has the same meaning as specifying the simple field name with no qualifier. If the field is not defined on the MAPFLD parameter, *MAPFLD cannot be specified.

For example, *MAPFLD/AVGBAL is valid if the AVGBAL field is specified as the first part of one of the mapped field list elements specified on the MAPFLD parameter.

End of change