OPM and Rexx/400 interfaces are provided by programs in library WWWSERVER.
The WWWAPI service program in library WWWSERVER provides the ILE entry points. A bind directory named BNDDIR in library WWWSERVER is provided to aid in developing ILE applications.
Includes are provided to aid in developing scripts in the following programming environments:
WWWRexx Rexx/400 function. The first
parameter is a string that indicates which API to perform.
The following is a directory of the available APIs:
The Get Form Variable Enum function can be used to retrieve form variables that have or can have multiple values.
char *WwwGetFormVarc(char *pszFormVar);
pszFormVar is the null-terminated name of the form variable to retrieve.
The name is dependent on the form being processed.
Return Value: Pointer to the null-terminated form variable's value.
Do not attempt to free the returned pointer.
Return values:
NULL : pszFormVar is NULL
other : Form variable value; empty string is returned if
value not found or set
Form Variable is the name of the form variable to retrieve.
The name is dependent on the form being processed.
Form Variable Length is the length of the form variable name.
Variable Value is the returned form variable value.
Variable Value Bytes Provided is the number of bytes provided
for the form variable value.
Variable Value Bytes Available is the length of the form variable value.
Bytes available return values:
0 > BA <= BP : Complete form variable value returned
BA > BP : Partial form variable value returned
0 : Form variable value not found or set
-1 : Form variable length parameter is less than
or equal to zero or greater than 1024
-2 : Variable value BP is less than or equal to zero
-98 : Required parameter was omitted
-99 : Internal error occurred (e.g., memory could not
be allocated)
Value = WWWRexx("GETFORMVAR", FormVariableName)
WWWRexx is the Rexx/400 function that handles all Web
Server/400 API calls.
"GETFORMVAR" is the verb that performs the Get Form Variable
API. This is a static string.
FormVariableName is the name of the HTML form variable to
retrieve. The name is dependent on the form being processed.
Return Value: A string containing the value of the HTML form
variable.
Get form variable enum is independent of the method used to send the form data to the script. The value returned is unescaped.
char *WwwGetFormVarEnumc(char *pszFormVar,
long lNumber);
pszFormVar is the null-terminated name of the form variable to retrieve.
The name is dependent on the form being processed.
lNumber identifies the form variable value to retrieve. The first value
has a number of 1, the second value has a number of 2, and so on for the rest of the
values. All of the values have been retrieved when the next number does not return
a value.
Return Value: Pointer to the null-terminated form variable's value.
Do not attempt to free the returned pointer.
Return values:
NULL : pszFormVar is NULL
other : Form variable value; empty string is returned if
value not found or set
Form Variable is the name of the form variable to retrieve.
The name is dependent on the form being processed.
Form Variable Length is the length of the form variable name.
Number identifies the form variable value to retrieve. The first value
has a number of 1, the second value has a number of 2, and so on for the rest of the
values. All of the values have been retrieved when the next number does not return
a value.
Variable Value is the returned form variable value.
Variable Value Bytes Provided is the number of bytes provided
for the form variable value.
Variable Value Bytes Available is the length of the form variable value.
Bytes available return values:
0 > BA <= BP : Complete form variable value returned
BA > BP : Partial form variable value returned
0 : Form variable value not found or set
-1 : Form variable length parameter is less than
or equal to zero or greater than 1024
-2 : Variable value BP is less than or equal to zero
-4 : Number is less than or equal to zero
-98 : Required parameter was omitted
-99 : Internal error occurred (e.g., memory could not
be allocated)
Value = WWWRexx("GETFORMVAR", FormVariableName, Number)
WWWRexx is the Rexx/400 function that handles all Web
Server/400 API calls.
"GETFORMVAR" is the verb that performs the Get Form Variable
API. This is a static string.
FormVariableName is the name of the HTML form variable to
retrieve. The name is dependent on the form being processed.
Number identifies the form variable value to retrieve. The first value
has a number of 1, the second value has a number of 2, and so on for the rest of the
values. All of the values have been retrieved when the next number does not return
a value.
Return Value: A string containing the value of the HTML form
variable.
long WwwReadc(void *pBuffer,
long lBufferSize);
pBuffer is the return buffer.
lBufferSize is the size in bytes of the return buffer.
Return Value: Number of bytes returned in the buffer.
Return values:
>0 : Number of bytes read into the buffer 0 : No data to read -1 : Buffer size is less than or equal to zero -98 : Required parameter was omitted
Return Buffer is the buffer in which to return the data read.
Return Buffer Size is the size in bytes of the return buffer.
Bytes Read is the number of bytes returned in the buffer.
Bytes read return values:
>0 : Number of bytes read into the buffer 0 : No data to read -1 : Return buffer size is less than or equal to zero -98 : Required parameter was omitted
Buffer = WWWRexx("READ", MaxBytesToRead)
WWWRexx is the Rexx/400 function that handles all Web
Server/400 API calls.
"READ" is the verb that performs the Read API. This
is a static string.
MaxBytesToRead is maximum number of bytes to read.
Return Value: A string containing what was read.
long WwwWritec(void *pBuffer,
long lBytesToWrite);
long WwwWriteCrLfc(void *pBuffer,
long lBytesToWrite);
long WwwWriteHeaderc(void *pBuffer,
long lBytesToWrite);
pBuffer is the buffer containing the data to write.
lBytesToWrite is the number of bytes to write.
Return Value: Number of bytes written.
Return values:
>0 : Number of bytes written 0 : No data written -1 : Bytes to write is less than zero -98 : Required parameter was omitted
Input Buffer contains the data to write.
Bytes To Write is the number of bytes to write.
Bytes Written is the number of bytes written.
Bytes written return values:
>0 : Number of bytes written 0 : No data written -1 : Bytes to write is less than zero -98 : Required parameter was omitted
Note that a normal Rexx/400 SAY will send its output over
standard output and can be used in place of the WRITE API in
Rexx/400. Important: The OS/400 PTF SF26297 must be applied
to V3R1 systems for the SAY to work. If this PTF is not applied
and a SAY with no parameters is included in your Rexx/400
procedure, the procedure will cause an exception.
BytesWritten = WWWRexx("WRITE", DataExpression)
BytesWritten = WWWRexx("WRITECRLF", DataExpression)
BytesWritten = WWWRexx("WRITEHEADER", DataExpression)
CALL WWWRexx "WRITE", DataExpression CALL WWWRexx "WRITECRLF", DataExpression CALL WWWRexx "WRITEHEADER", DataExpression
WWWRexx is the Rexx/400 function that handles all Web
Server/400 API calls.
"WRITE", "WRITECRLF", and
"WRITEHEADER" are the verbs that perform the Write API. These
are static strings.
DataExpression is the expression to write.
Return Value: The number of bytes written.
char *WwwGetEnvc(char *pszEnvVar);
pszEnvVar is the null-terminated name
of the environment variable to retrieve.
Return Value: Pointer to the null-terminated environment variable's value.
Do not attempt to free the returned pointer.
Return values:
NULL : pszEnvVar is NULL
other : Environment variable value; empty string is returned
if value not found or set
Environment Variable is the name
of the environment variable to retrieve.
Environment Variable Length is the length of the environment variable name.
Variable Value is the returned environment variable value.
Variable Value Bytes Provided is the number of bytes provided
for the environment variable value.
Variable Value Bytes Available is the length of the environment variable value.
Bytes available return values:
0 > BA <= BP : Complete environment variable value returned
BA > BP : Partial environment variable value returned
0 : Environment variable value not found or set
-1 : Environment variable length parameter is less
than or equal to zero or greater than 1024
-2 : Variable value BP is less than or equal to zero
-98 : Required parameter was omitted
-99 : Internal error occurred (e.g., memory could not
be allocated)
Value = WWWRexx("GETENV", EnvironmentVariableName)
WWWRexx is the Rexx/400 function that handles all Web
Server/400 API calls.
"GETENV" is the verb that performs the Get Environment
Variable API. This is a static string.
EnvironmentVariableName is the name of the environment
variable to retrieve.
Return Value: A string containing the value of the environment
variable.
long WwwUnEscapec(char *pszEscaped,
char *pszUnEscaped);
pszEscaped is the null-terminated buffer containing the data to unescape.
pszUnEscaped is the null-terminated buffer in which to return the unescaped data.
If the pointer is NULL the unescaped data is returned in the escaped buffer
(i.e., unescaped in place).
Return Value: Number of unescaped bytes in the return buffer.
Return values:
>=0 : Number of unescaped bytes -98 : Required parameter was omitted
Unescape In Place indicates which buffer to return the
unescaped data in. A value of '1' returns the data in the escaped buffer.
A value of '0' returns the data in the unescaped buffer.
Escaped Buffer contains the data to unescape.
Escaped Length is the number of bytes to unescape.
Unescaped Buffer is the buffer in which to return the unescaped
data. Not used if unescape in place is set to '1'.
Unescaped Bytes Provided is the number of bytes provided
for the unescaped data. Must be greater than or equal to the escaped length.
Not used if unescape in place is set to '1'.
Unescaped Bytes Available is the number of unescaped bytes in
the return buffer.
Bytes available return values:
>=0 : Number of unescaped bytes
-1 : Escaped length parameter is less than or equal to zero
-2 : Unescaped BP is less than escaped length
-3 : Unescape in place parameter is invalid
-98 : Required parameter was omitted
-99 : Internal error occurred (e.g., memory could not be
allocated)
Unescaped = WWWRexx("UNESCAPE", EscapedData)
WWWRexx is the Rexx/400 function that handles all Web
Server/400 API calls.
"UNESCAPE" is the verb that performs the Unescape Read Data
API. This is a static string.
EscapedData is the value to unescape.
Return Value: A string containing the unescaped data.
long WwwEscapec(char *pszUnEscaped,
char *pszEscaped,
long lEscapedBytesProvided);
pszUnEscaped is the null-terminated buffer containing the data to escape.
pszEscaped is the null-terminated buffer in which to return the escaped data.
If the pointer is NULL the escaped data is returned in the unescaped buffer
(i.e., escaped in place).
lEscapedBytesProvided is the number of bytes provided for the escaped data.
Return Value: Number of escaped bytes available.
Return values:
0 >= BA <= BP : All escaped data returned
BA > BP : Partial escaped data returned
-2 : Escaped BP is less than or equal to the
unescaped length
-98 : Required parameter was omitted
Escape In Place indicates which buffer to return the
escaped data in. A value of '1' returns the data in the unescaped buffer.
A value of '0' returns the data in the escaped buffer.
Unescaped Buffer contains the data to escape.
Unescaped Length is the number of bytes to escape.
Escaped Buffer is the buffer in which to return the escaped
data. Not used if escape in place is set to '1'.
Escaped Bytes Provided is the number of bytes provided
for the escaped data. Must be greater than or equal to the unescaped length.
Not used if escape in place is set to '1'.
Escaped Bytes Available is the number of escaped bytes available.
Bytes available return values:
0 >= BA <= BP : All escaped data returned
BA > BP : Partial escaped data returned
-1 : Unescaped length parameter is less than or
equal to zero
-2 : Escaped BP is less than unescaped length
-3 : Escape in place parameter is invalid
-98 : Required parameter was omitted
-99 : Internal error occurred (e.g., memory could
not be allocated)
EscapedData = WWWRexx("ESCAPE", UnescapedData)
WWWRexx is the Rexx/400 function that handles all Web
Server/400 API calls.
"ESCAPE" is the verb that performs the Escape Data API. This
is a static string.
UnescapedData is the value to escape.
Return Value: A string containing the escaped data.
long WwwPrintfc(char *pszFormat,...);
pszFormat is the null-terminated formatting string. This string,
when expanded, cannot exceed 8K in length.
... are the variables required by the format string.
Return Value: Number of bytes sent to the browser.
Return values:
>=0 : Number of bytes sent to the browser -98 : Required parameter was omitted