Externally described printer-file record-format considerations

When a program using externally described printer files is compiled, the compiler extracts the file descriptions for the files referred to in the program and makes these file descriptions part of the compiled program. When you run the program, you can verify that the record formats with which the program was compiled are the current record formats. To do this, you use the LVLCHK parameter on the create file command when the file is created.

The system assigns a unique level identifier for each record format when the file it is associated with is created. The system uses the information in the record format description to determine the level identifier. This information includes the name of the record format, the names, attributes, and order of the fields in the format, the indicators used, and the names and the order of the indicators in the record format. If you use the INDARA keyword to remove the indicator from the output buffer, the indicators used are not included in the level identifier information.

When the file is opened, if level checking is specified (LVLCHK parameter), the system does a format-by-format comparison of the level-checking values specified in the program to the level-checking values specified in the printer file. If any of the formats specified in the program do not exist in the file, or if any of the level checking values are different, an error occurs. Formats can be added to or removed from a printer file without affecting existing application programs that do not use the added or deleted formats.

You should display the file description to determine if the changes affect your program. You can use the Display File Field Description (DSPFFD) command to display the file description or, if you have the source entry utility (SEU), you can display the source file. Not every change in a file necessarily affects your program. You might not have to recompile your program. If you do not have to recompile your program, you should specify LVLCHK(*NO) for the file (CHGPRTF or OVRPRTF command).

You can add a field to the end of a printer file record format without having to recompile your program as long as you do not want to use the field in your program. If you delete a field from the end of the record format, you do not have to recompile your program if you are not using the field. However, if you add a field to or delete a field from a record format anywhere other than at the end, you must recompile your program. Otherwise, the field offsets in the record passed to and from the program are wrong for processing.

In general, anything that changes the length or position of any fields in the record format used by the program will require that the program be recompiled.