This is a snippet from a REXX CGI that has been running for a few years:
/* get the POST data into the "qs" variable */
qs=""
do while(lines())
qs=qs||linein()
qs=strip(qs,'t',d2c(13)) /* remove trailing CR chars */
end
...
/* set the environment variable QUERY_STRING to the
contents of qs variable */
environment("QUERY_STRING",qs)
address syscall 'pipe p.'
"cgiparse -form >>/dev/fd"p.2
address syscall "close "p.2
address mvs "execio * diskr "p.1"(stem s."
address syscall "close "p.1
do i=1 to s.0
interpret s.i
drop s.i
end
drop s.
This has a potential problem if too much data tries to go to the pipe. If that
happens, the cgiparse will block, which will stop the REXX program before the
"execio * diskr "p.1 command. This will cause the CGI to stop and never return.
Not good. This has never happened in my experience, but the chance remains. If
I weren't too afraid, I would fix this. I think the following would work.
/* get the POST data into the "qs" variable */
qs=""
do while(lines())
qs=qs||linein()
qs=strip(qs,'t',d2c(13)) /* remove trailing CR chars */
end
...
/* set the environment variable QUERY_STRING to the
contents of qs variable */
environment("QUERY_STRING",qs)
stdin.0=0
stdout.0=0
stderr.0=0
call bpxunix "cgiparse -form",stdin.,stdout.,stderr.
do i=1 to stdout.i
intepret stdout.i
drop stdout.i
end
drop stdout.
drop stderr.
drop stdin.
--
John McKown
Systems Engineer IV
IT
Administrative Services Group
HealthMarkets(r)
9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone *
[email protected] * www.HealthMarkets.com
Confidentiality Notice: This e-mail message may contain confidential or
proprietary information. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original message.
HealthMarkets(r) is the brand name for products underwritten and issued by the
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The
MEGA Life and Health Insurance Company.SM
> -----Original Message-----
> From: IBM Mainframe Discussion List
> [mailto:[email protected]] On Behalf Of Dana Mitchell
> Sent: Tuesday, July 24, 2012 2:42 PM
> To: [email protected]
> Subject: Using CGIPARSE in REXX
>
> Can anyone give me an example or a pointer to one that shows
> how to use CGIPARSE in a CGI REXX? I can get it to display
> expected results when I code it in REXX, but without the
> equivalent of EVAL command, I don't see how one makes use of
> the output from CGIPARSE.
>
> thanks
> Dana
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>
>
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN