We have numerous programs on our system (iSeries...V5R2) that are SQLRPG. We recently changed one of the large physical files that one of the SQLRPG's run over. We changed the physical via a compile of the with LVLCHK *no. (fields added to the end of the file) We started to experience some issues with this one program (SQLRPG) in particular. We did a recompile of the program and the issue seemed to go away. I guess my question is that I was not aware that when using SQLRPG, and you do a file change LVLCHK *no, you would still need to do a recompile of the programs. Have anyone experienced or heard of this issue?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Yes, you have to be very careful when using embedded SQL and fetching into an external DS.

There is no level check on external data structures, Your program will run with out notification of a level change. You may get a SQL mapping error but it wont cause an error message.If you are updating files, your going to have a long night.


There will be lots of problems if the program isn’t coded properly. Otherwise, it should be fine. You don’t show any relevant code nor give any indication what errors were seen (or “issues”), so it can only be guesswork. One common mistake is to code SELECT * FROM… instead of a proper select-list.


Discuss This Question: 2  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • RolandT
    I think that the concept of LVLCHK was the best thing that ever happened. I cringe at the thought that anyone would create a file with level check *no. The concepts prevents a programmer from shooting himself in the foot. Recompile the programs and you'll sleep better at night.
    0 pointsBadges:
  • mygoodname
    Whether a change in the file layout will affect your program is dependent on the fields being selected or the structures they are placed into. If you are using the existing file layout as an external data structure or you are otherwise bringing every field into the program, you will need to recompile. If your SQL is using a specific subset of the already existing fields, the field definitions have not changed, and you have a static defined structure to receive them that does not rely on the file layout, the program should continue to work without a recompile.
    0 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: