Problem solve Get help with specific problems with your technologies, process and projects.

Error occurs during debugging

I've made some modifications to an interactive RPG IV program and it compiled fine, but when I started to debug it using STRISDB, all of my modifications did not take place. I got an error message, "this statement xxxx, is not in your program." If I press F11 on a field it displays the message, "this variable does not exist in your program." This happens in my new entries only, the entire old statement works fine. Any advice?
There are only a few possible causes for this.

1. You are debugging the 'wrong' version of the program. Either you compiled the new version into the wrong library, or your library list is wrong when you start debugging and you are running an old version of the program, or a restore operation has replaced the new version of the program with a previous version.

Solution: Try to find the new version of the program. Use WRKOBJ *ALLUSR/name_of_program *PGM and see what comes up. If there is more than one object found, be careful in sorting it out, especially if your system has complex version or change control environments. Use DSPPGM to see the creation dates of the objects.

If you can't find the new version, then it is likely that cause number two is the problem.

2. You created the object from your changed source using the CRTRPGMOD command, which creates a *MODULE object from the source, but you did not then use the CRTPGM command to create a *PGM object from the *MODULE object. So, the *PGM object you are running contains the previous version of the module.

Solution: Use the CRTPGM command to create a *PGM object from the *MODULE object. The CRTPGM command takes the modules you specify and binds them together into an executable program. Only a program can be executed; a module cannot be executed. Changing a module does not change any programs that use that module -- those programs MUST be recreated, because they now contain an old copy of the module object.

BUT, If you know that you don't normally use CRTRPGMOD followed by CRTPGM, then you probably usually use CRTBNDRPG to create the module and bind to a program in a single operation. This can fail AFTER creating the *MODULE object successfully. If you rely on the compiler listing, you may see that the compiler has created the module (in QTEMP), but it will tell you that there were errors in the binding stage. Look at the job log, and these errors will be shown.

Binding stage errors occur when symbols required by the program are not found in any of the modules or service programs which are being bound together to make the program. This can happen because the required modules or service programs were not specified in the RPGLE H-specs, or on the CRTBNDRPG or CRTPGM commands, or if the versions of these objects being bound do not contain the required symbols, or if the symbols do not match the types specified in the source.

(A symbol is a procedure or data item that is exported by one module and referenced by another.)

Use DSPPGM on the old version of the *PGM object to see what modules are required. On the first page of the display, it will say something like this:

Program creation information:

  Program creation date/time . . . . . . . . . . :   30/01/04  16:22:52 
  Type of program  . . . . . . . . . . . . . . . :   ILE               
  Program entry procedure module . . . . . . . . :   WIRCFLC           
    Library  . . . . . . . . . . . . . . . . . . :     QTEMP           
  Activation group attribute . . . . . . . . . . :   *CALLER           
  Shared activation group  . . . . . . . . . . . :   *NO               
  User profile . . . . . . . . . . . . . . . . . :   *USER             
  Use adopted authority  . . . . . . . . . . . . :   *YES               
  Coded character set identifier . . . . . . . . :   65535             
  Number of modules  . . . . . . . . . . . . . . :   1     

If the library name for the PROGRAM ENTRY PROCEDURE MODULE is QTEMP, then this program was created using CRTBNDRPG. Otherwise it was created using CRTRPGMOD and CRTPGM.

If the number of modules is 1, then no other modules than the program entry procedure module are required. Otherwise, look at the list of modules on following screens to see what other modules are required to be specified on the CRTPGM command (MODULE parameter).

If you continue to have problems with 'symbol not found' messages in the job log, you may need to add service programs to the CRTPGM command (parameter BNDSRVPGM). Again, this information can be seen for the old version using DSPPGM.


The Best Web Links: tips, tutorials and more.

Visit the ITKnowledge Exchange and get answers to your developing questions fast.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on Debugging