*** Copied from other question ***
A Level Check Error indicates that the layout of a file has been changed later than the program trying to access the file has been compiled. This is to ensure that your data remains consistent after file changes. It means that you should re-compile the program.
For example (if you didn’t have level checking) – you have a customer file :-
CUSTNO 5,0 – Customer Number
CUSTNM 40A – Customer Name
You have a program which maintains this data file for you. You then change CUSTNO to be 6,0 long and use your program to add a new customer. Your program would fill the first 5 positions of the new 6,0 long customer number with a number and put the first character from the customer name in position 6 of the customer number. Then it would put the rest of the customer name (starting from position 2) in the customer name.
The level checking feature on the AS/400 is to avoid data inconsistencies like the example above.
A “level check” refers to the relationship between a “format level identifier” attribute of a file and the attribute that a program expects the file to have. When the level of the file doesn’t match what a program expects, a “level check” occurs.
A format level identifier is like a “signature” for a file.
A record in a database file has a series of fields. The fields occur in the record in a defined order. Each field has a set data type and a particular length. When the file is created, the system takes the attributes of all of the fields in a record (a “format”) and generates a hash that is unique. When a program is compiled and references that file, the compiler takes the level ID from the file and puts it into the compiled program object.
From then on, whenever that program tries to open that file, the first thing the program does is compare the level ID from the file to the one stored in the program. If the values don’t match, the result is a level check. Maybe field lengths have been changed in a redesigned file. Maybe the fields have been put in a different order. Or maybe some changed a 5-digit part number to a 5-character part identifier.
Whatever happened to the file, the program needs to run through the compiler again in order to extract the new file attributes.