COUNT


ANSI, NCHAR

 

The COUNT verb determines the number of significant characters that currently exist in a variable or list of variables. The instruction uses the following format:

 

 

[label]

COUNT

{result}{sep}{source}

 

Where:

label

Optional. A Program Execution Label.

result

Required. A previously defined Numeric Variable that receives the results of the operation.

sep

Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.

source

Required. A previously defined Character String Variable, a National Character String Variable, a Numeric Variable, a list of string and/or numeric variables, or a VARLIST of string and/or numeric variables that is processed.

Flags Affected: OVER, ZERO

Note the following:

  1. If the {result} is equal to zero, the ZERO Condition Flag is set.

  2. If {result} is too small to contain the count, the OVER Condition Flag is set.

  3. After the operation is finished, {result} contains the total number of significant characters that exist in all of the variables in {source}. Significant characters are determined by the descriptions in the Notes 4 and 5.

  4. For numeric variables, the following rules apply:

  5. For character string variables, the following rules apply:

  6. Null Strings in {source} are ignored.

  7. If an ARRAY variable is used in the list without a specific array element indicated, all array elements of the variable are used.

 

 

See Also: Example Code, Character String Instructions

 



PL/B Language Reference CONVERTUTF DECODE64