After reading the client browser input and loading the external HTML, a CGI
would start performing its process and preparing the HTML output buffer to
be returned to the client browser.
The external HTML is now in memory, divided in sections ("/$section_name")
containing output variables (/%variable_name%/).
Note 1.
All variables - across all sections - with a given name are considered repetitions (instances) of the same variable.
When a variable value is assigned, its value is the same for for all its instances
in all sections.
As soon as the CGI is able to establish the value of an output variable,
it should substitute its name with its value.
QUpdHtmlVar
This is done calling procedure QUPDHTMLVAR.
The following parameters are passed:
- variable name (without delimiters) (char 30)
- variable value (char 1000)
- (optional) action (indicator)
|
"1" | = | set this variable (default) |
"0" | = | clear all variables and set this one |
- (optional) desired blanks trimming (char 6)
|
"%trim" | = | trim left and right (default) |
"%triml" | = | trim left only |
"%trimr" | = | trim right only |
"%trim0" | = | don't trim |
Example of substituting output variable /%firstname%/ with value "John":
... ... ...
SPECIAL-NAMES.
copy CPYSPCNAME of CGICBLDEV2-QCBLLESRC.
... ... ...
* Variables for QUpdHtmlVar procedure
05 myindic PIC 1.
05 varnameout PIC X(30).
05 varvalout PIC X(1000).
... ... ...
* Substitute the output variable /%firstname%/
move 'firstname' to varnameout
move 'John' to varvalout
call 'QUPDHTMLVAR' using varnameout varvalout. |
Example of substituting output variable /%firstname%/ with value "John"
... ... ...
SPECIAL-NAMES.
copy CPYSPCNAME of CGICBLDEV2-QCBLLESRC.
... ... ...
* Variables for QUpdHtmlVar procedure
05 myindic PIC 1.
05 varnameout PIC X(30).
05 varvalout PIC X(1000).
... ... ...
* Substitute the output variable /%firstname%/
move '0' myindic.
move 'firstname' to varnameout
move 'John' to varvalout
call 'QUPDHTMLVAR' using varnameout varvalout myindic. |
Note 2. When a section is written to the HTML output buffer,
all its output variables are inspected. Output variables not having been assigned any value
are assigned the value "*** missing data".
Note 3. Whenever an output variables end delimiter is missing,
the entire line will be displayed as all asterisks.
|