To debug online programs through command-line entry and the tmp directory

Note: This technique is designed for debugging the first transaction that a program processes can only be used once per program job. Also, this technique only applies to transactions from Lawson Interface Desktop (LID) or Lawson for Infor Ming.le. It does not apply when an RPG program calls another RPG program.
  1. If LAWENV is not called as part of your user profile’s sign-on program, you must call the LAWENV program to set the environment variables correctly.
    1. If you installed Lawson Core Technology on an IASP, at the IBM i command prompt, type

      SETASPGRP IASPName

    2. At the IBM i command line, type

      CALL LAWENV

    3. Type the name of an Environment and press Enter.
  2. Compile the program you want to debug. At the Qshell command line, type

    qcompile -D productline systemcode programcode

    Note: If you need to include modules in the compile, use qcompile -Dm productline systemcode programcode .
  3. End any jobs using the previously compiled version of the program. At the IBM i command line, type:

    CALL TMCONTROL PARM(’-rp’ Productline Program)

    Example (IBM i command line):

    CALL TMCONTROL PARM(’-rp’ LAWAPP9 PR14)

  4. Create a directory in the tmp directory in the IFS.

    MKDIR '/tmp/dbg_UserProfile_ProgramName'

    where UserProfile is the IBM i profile name of the user who will run the program and ProgramName is the name of the program, such as GL10.

  5. Access the online form either through Lawson Interface Desktop (LID) or Lawson for Infor Ming.le. When the user specified in the MKDIR command performs a transaction using the program, the transaction is effectively put on hold and a stream file called strsrvjob.txt is created in the /tmp/ dbg_UserProfile_ProgramName directory. The file contains the text for a STRSRVJOB command that will allow access to the job that runs the program.
  6. View the stream file.

    EDTF ’/tmp/dbg_UserProfile_ProgramName/strsrvjob.txt’

  7. Copy the STRSRVJOB command from the strsrvjob.txt file and paste it to the IBM i command line. Press Enter.
  8. Start debug. At the command line, type STRDBG and prompt it (F4). Make sure the library is the one where you compiled the source and that UPDPROD(*YES) is set. If the information is correct, press Enter.
  9. When source listing appears, set break points (F6), then press F12.
  10. Delete the the debugging directory and strsrvjob.txt file in order to take the transaction off of hold. At the IBM i command line, type:

    DEL ’/tmp/dbg_UserProfile_ProgramName/strsrvjob.txt’

    RMVDIR ’/tmp/dbg_UserProfile_ProgramName

  11. The debugger will appear if any break points are hit. After you are finished with debugging, end debug and the service job. At the IBM i command line, type:

    ENDDBG

    then

    ENDSRVJOB