CSP was introduced with version 4.0 of Caché. CSP debugging was introduced with version 2.0 of Serenji. The procedure described here is not supported on earlier versions.
The key to CSP debugging is Serenji.csp, a CSP page that lets you connect a CSP-serving Caché process to Serenji in debug mode. When Serenji is installed on your PC, Serenji.csp is placed in your chosen installation folder (eg c:\Program Files\George James Software\Serenji). Copy it from there to a folder where a CSP application is being developed, and then point your browser at the URL that publishes this folder. For example, copying Serenji.csp to c:\cachesys\csp\user means that your browser can access it at http://localhost/csp/user/Serenji.csp
Serenji steps through the INT-code form of the routines generated when a CSP page is compiled. However, Caché actually executes the OBJ-code form of these routines, and in some circumstances the INT-code is automatically deleted during the compilation stage. When this happens Serenji is unable to help you debug the code. The following Caché command sets a flag that makes Caché keep INTs by default:
do SetEnvironment^%apiOBJ("defaultflags","k")
These flags apply per namespace, so if you are developing CSP applications in more than one namespace you will need to issue this command once in each.
To retrieve the default flags setting for the current namespace:
do GetEnvironment^%apiOBJ("defaultflags",.flags) write flags
The CSP Web Gateway is the component which links your web server to your Caché system. It resides on your web server, sending CSP requests to Caché and receiving the pages. By default it waits only 60 seconds for a response, after which it times out and takes appropriate action, such as resubmitting the request to a different Caché process. When you are debugging a CSP page you will often take more than 60 seconds to complete all the stepping and investigation that proves necessary. So you probably want to set a much longer timeout.
To set the timeout, go to the CSP Web Gateway Management page. The URL depends on the web server you are using. The examples here are valid for a browser that runs on the web server. By default, the CSP Management page can only be accessed from the server itself.
| IIS | http://localhost/csp/bin/cspmssys.dll |
| Apache | http://localhost/cgi-bin/nph-CSPcgiSys |
| Netscape | http://localhost/cspsys/ |
You want to set a large Server Response Timeout. This can be done per server on the Server Access page, or a default value can be set on the Default Parameters page. It may be necessary to close existing connections so that the new value takes effect, or even to restart your web server.
Start your browser, and point it at the Serenji.csp page. Follow the instructions there to enable debugging and open a second browser window. Direct that new window to your CSP page and you should see Serenji load up the routine whose execution will result in the page's HTML being sent back to the browser. Now use Serenji's debugging facilities as normal.
When you have finished debugging and wish to resume full-speed execution, use the button on the Serenji CSP Control Page in your first browser window.
The original Serenji 2.0 shipped while Caché 4.0 was still in beta. Because of a late change in Caché 4, if you still have this version of Serenji, the original Serenji.csp commences debugging within the routines generated for Serenji.csp rather than in your own CSP page's routines. To determine if your version of Serenji.csp has this problem, access it with your browser (see example above) and look at the CSP Control Page version number at the foot of the page. If it is 2.0.0 you should obtain an updated version of the file (2.0.1) that corrects this problem. Replace your original copies of Serenji.csp with the new one before trying to debug a CSP application. If you already have 2.0.1 or later, don't replace it.
To download the new version, use your browser's "Save As…" facility on the following link - Serenji.csp. This is typically accessed by right-clicking on the link and choosing the appropriate option.
Last reviewed: Nov 9, 2004
Copyright 1997, 2005 George James Software.