Wednesday, January 17, 2007

Debug Tips: RPGLE w/ SQL

I learned this one today. We were debugging an RPGLE program w/ embedded SQL. While stepping through we discovered our bug pretty quick. So to end the debug session, we hit F3 to exit. This closed most of the files we had open. Yeah, a few files were left open. This could have posed a dirty data issue. After a brief analysis of the open files we discovered the files were opened by our embedded  SQL.

This led to a discussion about "open" files and the process involved with "running" a program. I learned that the AS400 actually opens a new "instance" of a program and you will have object locks on files. There are good reasons to do this. If you look at some web applications, such as a "shopping cart", you want more than one.

 I know I am omitting some details. I am a simple guy and I try to keep it simple. This has led me to a new process when I am debugging a program. If I think I might or do know I have some files open.

  • log out and log back in. (Sort of a reboot.)
  • check the library list. (I keep missing this.smile_sarcastic

If you have any ideas or suggestions, let me know.