The cgiGetVarCnt procedure retrieves number of occurrences of a variable.
The cgiGetVarCnt procedure is used to retrieve the number of times a field appears in the CGI buffer.
count cgiGetVarCnt( szVarID 256A Const Varying OPTIONS(*NOPASS) ) |
| Variable ID | Description |
| *KEYWORDS | A count of the number of all occurrences of all fields returned to the CGI program. This count is that of all available values. |
| *FIELDS | A count of the number of unique fields in the URL encoded string. |
| HTML variable | A count of the number of occurrences of the specific HTML variable/field. |
If the function succeeds, the return value is the number of occurrences of the variable or keyword.
If the function fails, zero is returned.
First, call cgiInit() once for the invocation of the program, then use this procedure to return the count of the field values or keywords if needed.
.....DName+++++++++++EUDS.......Length+TDc.Functions+++++++++++++++++++++++++
D i S 10I 0
D nCount S 10I 0
D OPTIONS S 10A Dim(40)
.....C..n01..............OpCode(ex)Extended-factor2++++++++++++++++++++++++++++
C callp cgiInit()
.....C* First get the number of ITEMS selected by the web user
C eval nCount = cgiGetVarCnt('ITEMS')
.....C* Second, loop through each ITEMS value and store it in an array.
C for i = 1 to nCount
C eval Options(i) = cgiGetVar('ITEMS': i )
C endfor