To perform remote debugging for batch programs
-
Configure and start the Lawson Debug Server (ladebug).
-
Make sure that there is an entry for the Lawson Debug
Server (ladebug.exe) in laserv.cfg. The entry should be as follows:
ladebug "%gendir%\bin\ladebug.exe
-
Set the following parameters in %LAWDIR%\system\ladebug.cfg:
Parameter Description ENABLEDBG Set to TRUE to enable debugging for a Lawson Environment. If the ENABLEDBG parameter in ladebug.cfg is set to TRUE and if ladebug is running, Lawson client programs will check with the Lawson Debug Server to see if the application program is being debugged. Because this setting incurs some overhead, the ENABLEDBG parameter should always be set to FALSE in a production Lawson Environment. IPADDRESS To ease the setup of debugging, set this to ANY in order to specify Static IP address assignment for the debug server. RMTDBG_MAINTPORT The port that the remote debug service listens on for control messages.
The maintenance port (RMTDBG_MAINTPORT) can be dynamically assigned since Lawson programs using this port can get the port assignment out of ladebug.cfg.
Note: This port number must be unique for each installed Lawson Environment.RMTDBG_FINDMAINTPORT When set to TRUE, tells the remote debug service to find a free port number. RMTDBG_DBGPORT Not supported. RMTDBG_FINDDBGPORT Not supported. RMTDBG_IPADDRESS To ease the setup of remote debugging, set this to ANY in order to specify Static IP address assignment for the remote debug server. RMTDBG_ENABLEDBG Set to TRUE to enable remote debugging for a Lawson Environment.
The Remote Debug Connection Service server (laanimserv) is started when ladebug is started if RMTDBG_ENABLEDBG is set to TRUE. Likewise, it is stopped when ladebug is stopped. From an administrative point of view, this means that there are no new start/stop commands or any additional setup in laserv for the Remote Debug Connection Service.
- If ladebug is not running, start it with the startladebug command. If it is running and you just edited the ladebug.cfg file, stop ladebug with the stopladebug command and then restart it.
-
Make sure that there is an entry for the Lawson Debug
Server (ladebug.exe) in laserv.cfg. The entry should be as follows:
- Make a share on the Lawson server that allows access to the %LAWDIR%\Productline directory for the product line where you will be debugging. Map to that share from the remote client (PC).
- If the batch job has not been defined, add the job through the program’s batch parameter form.
-
If the job has not been run before, add the print
file directory for the job.
%LAWDIR%\print\domain_username\jobname\jobstep
-
From the source directory (for example, ifsrc), compile
the program you want to debug.
qcompile -D productline systemcode programcode
-
Create a Net Express project for the program to be
debugged.
- Launch the Micro Focus IDE and, from the File menu, select New, then Project, and then Empty Project.
- Enter the project name (for example, remoteGL200, or else something more generic if you want to use the same project for different programs).
-
Enter the project folder. Use the path to the Lawson
obj directory, using the local machine drive letter.
For example: L:\lawenv\apps\apps901\obj
- Click Create.
-
Add the COBOL source file to the project.
- From the Project menu, select Add Files to Project.
-
Double-click on the source file you want to add and
click Add.
If the file is not listed, connect to the application server through Lawson Interface Desktop (LID) and compile the program for debugging
-
Configure the remote debugging project.
- From the Project menu, select Types of Build, then Debug, and then Change.
- Remove the entry in the Build Subdirectory field and click OK.
- Close the Type of Build windows.
- From the Project menu, select Properties.
-
In the Project directives field, enter the following
line at the end of the listed directives but before the semicolon
(;).
case /outdd"stdout" /fixopt /initcall"lacobrts.dll"
- In the Environment section, select the Application button.
-
In the Variable field, type
path
. -
In the Value field, add the absolute server paths
to the Lawson %GENDIR%\bin directory, the jvm.dll file, and Net Express.
Separate each path value with a semi-colon.
IMPORTANT: Use the server path, not the local machine path.
For example, the Lawson \bin directory path might be:
C:\lawenv\univ\bin
The jvm.dll path might be:
C:\Program Files\jdk1.6\jre\bin\server
The Net Express path might be:
C:\netexpress\base\bin
For the Net Express path, you can also use %NETEXPRESSPATH% since this variable should be set as an environment variable by the Lawson installation.
- Click Set and then click OK.
- In the Project Properties window, click OK.
-
Set debug settings.
- From the Animate menu, select the Settings… option.
-
In the Start Animating at: field, remove the %TARGETDIR\
portion of the line. In the Command line parameters field, type
DataArea LawsonNTUserID JobName StepNbr
where DataArea is the name of the data area or data ID where you are debugging, LawsonNTUserID is your Lawson Windows user ID, JobName is the name of the batch job, and StepNbr is the step number. The user ID is the one that has the format "
NT....
". You can obtain your Windows user ID by running the listusermap utility with the-c
option. If you created the job through the batch parameter form, the step number is "1". If you created a multi-step job, use the Job Definition utility (jobdef) to check which step you want to use.Example:
lawenv NT00000001 CU201 1
- Select the Execute Remotely check box.
- In the Remote machine field, enter the name or IP address of the server.
-
In the Port number field, enter the port number for
the remote debugging session. To get the port number, execute the
following two commands. The first command starts a remote session
and the second assigns and returns a port number for the session.
rmdbgcontrol -s sessionid
rmdbgcontrol -p sessionid
where sessionid is the identifier you assign for the debugging session. It should be alphanumeric, can be up to 64 characters in length, and should be unique compared to any other session IDs that other developers create.
Note: You can see a list of any current session IDs by running rmdbgcontrol with the-l
option. The list appears in the laanimserv.log file in %LAWDIR%\system. -
In the Remote working directory field, enter the server
path to the COBOL object directory. For example:
C:\lawenv\apps\apps901\obj
-
In the Location of debug information field, enter
the local machine path to the server COBOL object directory. This
is your PC’s path (across the mapped drive, to the same directory
listed in the Remote Working Directory field. For example, assuming
you had already mapped to \lawenv\apps\apps901:
L:\obj
- Click OK to close the Properties window.
- From the Animate menu, select Start Animating.
-
Click Yes when you receive a message that asks you,
"Do you want to establish the connection now?"
If you receive any of the following messages, click No.
"The project directives have changed. Do you want to rebuild the whole project? Not doing so may lead to unpredictable results."
- On the Start Animating window, click OK.
- Set break points as needed.
-
From the Animate menu, select Run.
Net Express will stop execution if the program hits any of the break points.
- When you are finished debugging, select Stop Animating from the Animate menu.
-
To end the Lawson debug session, at the command line,
type
rmdbgcontrol -x sessionid
where sessionid is the identifier you assigned to the debug session when you started it.
Note: You can also use the-x
option to clear up a hung remote session before starting a new one.