I am taking over the responsibilties of maintaing a web page for the Mainframe Computer. This web page was designed using rexx. How can I debug this web page. I have tried using TRACE IR, but this does not work and displays the web page incorrectly. I want to be able to step through the web page and debug certain stopping points. This is a web page supportin RACF Administration type capabilites such as: (Add RACF ID, Change Password, Alter RACF ID, Connect RACF ID to groups). If some one has a good example of this type of processing I would be very interested.
So, is this like JSP with embedded rexx in a proto-page, or is the rexx doing a service as CGI, or the whole web server either inetd or listening?
Cound not get to this web site:
<LI class=g>Rexx Server Pages
modrexx.sourceforge.net/RSP.html - Cached - Similar
Rexx Server Pages (RSPs) are similar to Java Server Pages and PHP pages.
RSPs allow the programmer to embed Rexx code into an HTML page. This
allows ...
So, is this like JSP with embedded rexx in a proto-page, or is the rexx doing a service as CGI, or the whole web server either inetd or listening?
I believe that rexx is doing the service like CGI. Here is an example of the code:
. Menu Utilities Compilers Help .
. ------------------------------------------------------------------------------- .
. UC05 E /ZOS111/usr/lpp/websys/racfmain.rexx Line 00000000 Col 001 079 .
. Command ===> Scroll ===> CSR .
. ********************************* Top of Data ********************************** .
. /* REXX */ .
. /* */ .
. /* ==================================================================*/ .
. /* */ .
. /* COMPONENT_NAME: racfmain.rexx */ .
. /* */ .
. /* FUNCTIONS: */ .
. /* */ .
. /* UCOP Password Change - Initial Exec. */ .
. /* ==================================================================*/ .
. .
. .
. tmplname = '' .
. optfield = '' .
. .
. templateStart = 0 .
. templateEnd = 0 .
. .
. /* Use cgiutils to create a standard html header */ .
. 'cgiutils -status 200 -ct text/x-ssi-html' .
. file. = '' /* initialize the stem */ .
. out.= '' .
. .
. env.= "" .
. do i=1 to __environment.0 .
. parse var __environment.i varname '=' data .
. env.varname = data .
. if substr(varname,1,11) = '_BPX_USERID' then racfxid = data .
. end .
. .
. parse var env.SCRIPT_NAME pref '/' application suff '/' . /*@L1A*/ .
. .
. /*Check for the presence of the conf path of the CA domain built from the URI's .
. application string. @L3A*/ .
. .
. domainName=application /*@L3A*/ .
. upper domainName /*@L3A*/ .
. pathName = 'DOCUMENT_ROOT'||domainName /*@L3A*/ .
. .
. /* if the CA Domain path is not set, use the conf path without the .
. the CA Domain name @L3A*/ .
. if env.pathName ='' then do /*@L3A*/ .
. pathName = DOCUMENT_ROOT /*@L3A*/ .
. end /*@L3A*/ .
. .
. /* read template file */ /*@L3C*/ .
. address syscall 'readfile /usr/lpp/websys/racfmain.tmpl file.' .
. .
. if file.0 = 0 | file.0 = '' then .
. say 'RACFAAAI RACF WEB Change: Error in racfmain.rexx: '||, .
. 'Unable to read configuration data' .
. else do .
. /* In case there are leading blanks on the lines, remove them @L2A*/ .
. do i = 1 to file.0 /*@L2A*/ .
. file.i = strip(file.i) /*@L2A*/ .
. end /*@L2A*/ .
. .
/* read the section in template file that has APPLICATION tag
and with NAME=CONTENT here*/
call getsect 'APPLICATION' 'CONTENT' application
if out.0 = -1 then do
say 'RACFAABI RACF WEB Change: Error in racfmain.rexx: '||,
'No application of the name 'application ' exists'
exit 8
end
if out.0 = -2 then do
say 'RACFAACI RACF WEB Change: Error in racfmain.rexx: '||,
'CONTENT tag not found under APPLICATION 'application
exit 8
end
if out.0 = 0 then do
say 'RACFAADI RACF WEB Change: Error in racfmain.rexx: '||,
'Empty CONTENT in APPLICATION 'application
exit 8
end
else /* CONTENT found. Write as HTML unless an INSERT is found */
do i = 1 to out.0
record= strip(out.i) /* trim leading and trailing spaces*/
/* get the string inbetween %% and %% */
parse var record pref '%%' tmplname '%%' suff
/* the value with symbol '-' are not templet name,although they
are so called here. They are some additional info that's
needed in the html file */
if substr(tmplname,1,1) = '-' then
call getinsert tmplname optfield
if tmplname �= "" then do
/* Template name found. Write out the rest of the line
so far there's no template name in racfmain page, this
code is for future expending */
say suff
end
else
say record
end
end
exit 0
/*******************************************************************
* Procedure getsect - returns all lines of a specified template *
* section in stem variable out. *
*******************************************************************/
getsect: procedure expose file. out. tmplname typeStartline typeEndline,
templateStart templateEnd application /*@L1C*/
parse arg type section typename
/* application NAME must be upper case @L1A*/
if (type = 'APPLICATION') then do /*@L1A*/
upper typename
end
k= 1
out.= ''
out.0= 0
typetag= '<' || type || ' NAME=' || typename || '>'
typeendtag= '</' || type || '>'
sectiontag= '<' || section || '>'
sectionendtag= '</' || section || '>'
/* If the type is TEMPLATE and we have called getsect TEMPLATE before,
just use the saved value */
if (type = 'TEMPLATE' & templateStart <> 0) then do
typeStartline = templateStart
typeEndline = templateEnd
end
else do
/* find the NAME= type */
do while k <= file.0 & index(file.k, typetag) �= 1
k = k + 1
end
typeStartline = k
if k > file.0 then do /* can't find typetag */
out.0 = -1
return
end
/* find the type end tag */
do while k <= file.0 & index(file.k, typeendtag) �= 1
k = k + 1
end
typeEndline = k
if k > file.0 then do /* can't find type end tag */
out.0 = -1
return
end
end
/* start to search section end tag from the line following type */
k = typeStartline + 1;
/* find the section end */
do while k <= typeEndline & index(file.k, sectionendtag) �= 1
k = k + 1
end
sectionEndline = k
if k > typeEndline then do /* can't find sectionendtag */
out.0 = -2
return
end
/* find section */
k = typeStartline + 1
do while k <= sectionEndline & index(file.k, sectiontag) �= 1
k = k + 1
end
if k > sectionEndline then do /* can't find section tag */
out.0 = -2
return
end
/* start at the following line */
k = k + 1
do while k < sectionEndline
if substr(file.k,1,1) �= '#' then do
out.0 = out.0 + 1
j = out.0
parse var file.k pref '[' subvar ']' suff
if subvar �= "" then do
/* the subvar is tmplname and need to be substituted */
if subvar = "tmplname" & tmplname �= "" then
subvar= tmplname
else if subvar = "application" & application �= "" then /*@L1A*/
subvar=application /*@L1A*/
else /* it's something else just restore it in [] */
subvar= '[' || subvar || ']'
/* restore the sub in the statement */
out.j= pref || subvar || suff
end
else
out.j= file.k /* assign value to the output stem */
end
k = k + 1
end
return
/*******************************************************************
* procedure getinsert - Writes to output all lines of an INSERT *
******************************************************************/
getinsert: procedure expose file. tmplname application /*@L1C*/
parse arg field optstring /*@L1C*/
j= 1
fprint= 'no'
fdone= 'no'
/* get the substition variable in the [], field is tmplname in calling
function */
parse var field pref '[' subvar ']' suff
/* make it same as in the conf. file */
fieldtag= '<INSERT NAME=' || field || '>'
do while j <= file.0 & fdone = 'no'
frecord= strip(file.j)
/* go through conf. file non-comment lines */
if substr(frecord,1,1) �= '#' then do
if fprint = 'no' then do
/* find the matching insert section */
if index(frecord,fieldtag) = 1 then do
fprint= 'yes'
end
end
else if index(frecord,'</INSERT>') = 1 then do
fdone = 'yes'
end
else do
parse var frecord '%%' insertname '%%'
if insertname �= "" then
call getinsert insertname
else do
/* Write the record insertion code after making
proper variable substitution */
parse var frecord pref '[' subvar ']' suff
if subvar �= "" then do /* @L1A*/
if subvar = "optfield" then do /* @L1C*/
if optstring �= "" then
subvar= optstring
else
subvar= ""
end
else if subvar = "tmplname" & tmplname �= "" then
subvar= tmplname
else if subvar = "transactionid" then
subvar= ""
else if subvar = "application" & application �="" then /*@L1A*/
subvar = application /*@L1A*/
else
subvar= '[' || subvar || ']' /* @L1A*/
say pref || subvar || suff
end
else /* @L1A*/
say frecord
end
end
end
j = j + 1
end
return
Yes, as far as I can tell without library routines, it is something like CGI, and maybe not very fancy output even though nominally html ! Just another imperative script language!
Testing web services that have profound side effects means you must have an arena where you can have that side effect safely away from production and without exciting the admins.
Normally, to test CGI from a terminal, you just set CGI env variables, stdin if POST and capture stdout, stderr and the exit return code.