Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

DCL parameters in Apache under OpenVms

SOLVED
Go to solution
rAMIRO_2
Occasional Contributor

DCL parameters in Apache under OpenVms

Hello.
How is possible to pass parameters from an url to a CGI script made with a DCL? Can somebody write me a little example?
Many thanks everybody.
5 REPLIES
Wim Van den Wyngaert
Honored Contributor

Re: DCL parameters in Apache under OpenVms

This is how it looks on WASD

url : http://salpv1/report_ver_proc/?t=00:05

where t is the parameter value

in dcl you get

$ if www_form_t .eqs. ...

where t is the name of your parameter

Wim
Wim
Robert Atkinson
Respected Contributor
Solution

Re: DCL parameters in Apache under OpenVms

Parameters passed in the URL, i.e. 'action.htm?option=edit&call=3456', can be extracted using the string 'QUERY_STRING'.

Below is an example of how to create symbols with there corresponding values :-

$LOAD_PARAMS:
$ QUERY_STRING = F$EDIT("''QUERY_STRING'","UPCASE")
$ !
$ sh sym query_string
$ !
$ COUNT = 0
$ !
$LOAD_PARAMS_LOOP:
$ PARAM_LONG = F$ELEM(COUNT,"&",QUERY_STRING)
$ IF PARAM_LONG .EQS. "&" .OR. PARAM_LONG .EQS. "" THEN GOTO END_LOAD_PARAMS_LOOP
$ !
$ PARAM_NAME = F$ELEM(0,"=",PARAM_LONG)
$ PARAM_VALUE = F$ELEM(1,"=",PARAM_LONG)
$ !
$ 'PARAM_NAME' = "''PARAM_VALUE'"
$ !
$ sh sym 'param_name'
$ !
$ COUNT = COUNT + 1
$ GOTO LOAD_PARAMS_LOOP
$ !
$END_LOAD_PARAMS_LOOP:
$ .......

Form data can also be extracted, using Mark Daniels CGIUTL (http://wasd.vsm.com.au/wasd/) program :-

$LOAD_CGI_VARIABLES:
$ CGIUTL = "$CMS$SYSTEM:CGIUTL.EXE"
$ DEFINE /NOLOG /USER SYS$INPUT APACHE$INPUT
$ CGIUTL /URLDECODE /SYMBOLS /MAXSYM=254
$ !
$! sh sym cgiutl*
$ !

Using these two methods, I've written comprehensive browser-based applications, purely in DCL.

Let me know if you need any more help or examples.

Rob.

Karl Rohwedder
Honored Contributor

Re: DCL parameters in Apache under OpenVms

Example HTML for a form:

...

In DCL.COM you read these symbols via
$Read/Error=Exit/End=Error Apache$Input Data

You must then parse the querystring using your own code or using seom freeware. I have written
a small DCL routine to parse the string, see attached examples.
Robert Atkinson
Respected Contributor

Re: DCL parameters in Apache under OpenVms

Karl, how do you handle the string length limitations of DCL when parsing the HTTP request header?

Rob.

P.S. I like your coding style, but it must take forever with all that upper and lowercase text :-)
Ian Miller.
Honored Contributor

Re: DCL parameters in Apache under OpenVms

Re Karl Coding Style - it is said program source code is read many times and only written once - its worth the extra time writing readable DCL as DCL procedures have a a habit of persisting for years.
(I am also guilty of too much all uppercase DCL :-)
____________________
Purely Personal Opinion