Get Content Length

cgiGetContentLen

The cgiGetContentLen procedure returns the length of the CGI data (URL encoded string) available to the CGI program.

The cgiGetContentLen procedure is used to retrieve the length of the URL encoded string available to the CGI program.

length  cgiGetContentLen(
  void          10I 0    Const OPTIONS(*NOPASS)
)

See also: GetEnvVar

Parameters

void [optional]
[input Int(4) (10i0) const]  This parameter is not used. A value of zero (0) may be passed to allow pre-OS/400 Version 5.1 systems to specify the procedure call with parentheses.

Return Value

If the function succeeds, the return value is the length of the CGI URL encoded string sent to the CGI program. Use this value to determine the size of the buffer needed to store the URL encoded string.

Remarks

The value returned is the numeric form of the GetEnvVar('CONTENT_LENGTH') environment variable. This function simply converts the textual data returned by GetEnvVar to numeric, and returns it to the caller.

Example

.....DName+++++++++++EUDS.......Length+TDc.Functions+++++++++++++++++++++++++
     D nUrlLen         S             10I 0 
 
.....C..n01..............OpCode(ex)Extended-factor2++++++++++++++++++++++++++++
 
     C                   eval      nURLLen = cgiGetContentLen()