When you change the definition of a file on the AS/400, you'll often have to recompile all objects that access that file. For example, if you add a century flag to a date field of a certain file, you need to change the DDS for the file and recompile it. Now all objects accessing that file will need to be recompiled if you re-create the file with LVLCHK(*YES), which is the default setting.
You can determine what programs to recompile by running the Display Program References (DSPPGMREF) command to an outfile, this prints the list of programs that you have to recompile. The problem comes with Query/400 programs that may use the changed file, since the DSPPGMREF command does not cross-reference Query programs. If a Query uses the changed file for input or output, the Query will abend the next time a program tries to run it, displaying the message, "Level for file does not match query."
To solve this problem, always code the file name into the Run Query (RUNQRY) command that runs your Query programs, so that the value of the QRYFILE parameter matches the name of the file that you defined in the Query. For example, instead of the line:
RUNQRY QRY(TRY) ...code the following: RUNQRY QRY(TRY) + QRYFILE((SRS/SRSD110A)) + OUTTYPE(*OUTFILE) + OUTFILE(TEMP/WORKING)
Sure, you have to type more into the CL program, but now you can use the Scan All Source (SCNALLSRC) command, which is part of QUSRTOOL, to search for the file name and obtain a complete picture instead of a partial one.
Editor's Note: You can also use the Find String with PDM (FNDSTRPDM) command instead of SCNALLSRC.