Note: You will probably need additional authority to troubleshoot the CGI
program. For example, you will probably need authority to the
QTMHHTTP user profile.
c. Set breakpoints in the program.
d. On the browser, issue a URL that would runthe CGI program.
The Pass and Exec directives that request the document and run a CGI
program must be in WRKHTTPCFG.
e. After the system issues an HTTP request on the browser, returnto the
AS/400 session that ran STRSRVJOB. It should have stopped at a program
breakpoint.
Ending and starting the server ensures that only one worker thread is running.
3. When finished with debug, reset the server values:
a. Issue the command ENDDBG
b. Issue the command ENDSRVJOB
c. Issue the command WRKACTJOB SBS(QHTTPSVR) JOBserver_instance
d. Issue the command STRTCPSVR *HTTP HTTPSVR(server_instance
Symptom
The system is not converting or handling special characters as expected.
Cause: The browser inserts special characters using escape sequences which
requires special handling by the CGI program.
Solution: Browsers create escape sequences (ISO 8859) for special characters (for
example,:.,!@#$%*,andsoon.) These characters come into standard input or
into the QUERY_STRING environment variable in the form %xx, where xxis
the two characters representing the ASCII hexadecimal value. (For example, a
comma comes in as %2C. For CGI input mode %%MIXED%%, these three
characters %xxare converted to EBCDIC, but the values of xxare not changed
to the corresponding EBCDIC code points.
There are two approaches to handling escape sequences:
1. Convert the EBCDIC representation of the ASCII escape sequence to an
EBCDIC escape sequence or use CGI input mode %%EBCDIC%%. This is
necessary because the QtmhCvtDB API assumes that escape sequences represent
EBCDIC code points, and the API converts them to the corresponding EBCDIC
character. For example, %2C, which represents anASCII comma, is converted
to EBCDIC X'2C', which is not an EBCDIC comma.
2. Convert the EBCDIC representation of the ASCII escape sequence to the
EBCDIC equivalent character.
The following approach outlined in the first conversion technique listed above:
Note: The hex representation of the %2C from the browser was 0x253243. When
this escape sequence is converted to EBCDIC, it ends up as 0x6CF2C3.
1. Convert the xxin %xxto the corresponding EBCDIC character. In this case
0xF2C3 is converted to 0x2C.
2. For the first approach, convert the EBCDIC character to the two-byte form.
Then you can reinsert the two bytes back into the input stream in the same
Chapter10. Troubleshooting your CGI programs 141