You can debug programs running on the server by setting a breakpoint in a function called by a Windows component, or in a server routine executed by a web component.
Both Windows desktop and web applications are a form of client/server application.
•A Visual LANSA desktop application can call functions running on the server and access a database on the server.
•Visual LANSA web components running in the browser execute a server routine in a server module running on the data/application server in order to access database tables.
Note: The Break at first executable statement option in debug settings applies to each platform on which the application executes code. That is, debug will break at the first web page executable statement and at the first server executable statement.
Windows Applications
As an example, this simple Windows Salary Review form initially launches a connect form, which logs onto the server. Log on could be an automatic process, which logs on the current user.
The form then calls a server function, passing Department Code and a Percentage. The called function retrieves the Employees in this department into a working list, calculating a proposed new salary for each based on the Percentage, and returns this list of employees to the calling desktop form, which then displays them.
The following steps look at how to debug both the desktop forms and the called server function.
1. Since this debug session needs a connection to and from the server, it is essential to ensure the server can find your PC. As a default, Visual LANSA Debug settings (see Options from the File menu) define Computer Name as the actual computer name. Ensure that Computer Name is changed to your PC's IP Address:
Note: If you use a VPN connection, you will need to check your PC's IP Address each time the VPN session is started.
2. With debug settings of Break at first executable statement, your application will
break at the first executable statement in the form and also at the first
executable statement in the called server function.
If you run the form in
debug mode, it will break at the CreateInstance event
routine.
Other breakpoints may now be set as required in the main form.
3. The application connects to the server using a Connect form which executes after the main form. If breakpoints are required, you can now open the Connect form in the editor and set breakpoints.
4. If you select the main form in the editor, click Continue Execution on the Debug ribbon.
5. Log onto the server in the Connect to Server form:
6. When connected, the main Salary Review form becomes active. A Department Code and Percentage number must be entered. Click on the Submit button to call the server function.
7. The called function is started on the server and stops at the first breakpoint:
7. You are now able to continue running the application and access all code running on both the PC and on the server.
See Client/Server Support Built-In Functions in the Technical Reference Guide for how to use LANSA communications Built-In Functions.
Web Applications
Your Visual LANSA development system provides a complete runtime environment. When you run a web application from a development system, Visual LANSA provides the data/application server locally.
Ensure that the Visual LANSA Web Administrator has been used to enable LANSA Web on the server to Allow Interactive Debugging.
If you are debugging an application checked into an IBM i server or deployed to a Windows or Linux server, ensure you have your PC's IP Address entered as Computer Name in Debug settings (see Options from the File menu).
As noted in Step 1. Set Debug Options, ensure that the Visual LANSA Web Administrator has been used to enable LANSA web on the server to Allow Interactive Debug.
Note: In order to run debug on a web application which is deployed to a server, you will need to start the application from the browser, with debug enabled:
http://<server name>:<port>/<application name>/<partition>/<webpage.html>?lang=eng&developer=yes&debug=yes, <VL IP address>;<debug server:port>
For example, on a Windows server, running the web page MY_Main:
http://<server name>:port/webapp/dem/my_main.html?lang=eng&developer=yes&debug=yes, 10.44.10.146:51247