Product SiteDocumentation Site

7.4.16. CHARS (Characters Remaining)


>>-CHARS(--+------+--)-----------------------------------------><
           +-name-+

Returns the total number of characters remaining in the character input stream name. The count includes any line separator characters, if these are defined for the stream. In the case of persistent streams, it is the count of characters from the current read position. (See Chapter 14, Input and Output Streams for a discussion of Rexx input and output.) If you omit name, the number of characters available in the default input stream (STDIN) is returned.
The total number of characters remaining cannot be determined for some streams (for example, STDIN). For these streams, the CHARS function returns 1 to indicate that data is present, or 0 if no data is present. For windows devices, CHARS always returns 1.
Here are some examples:

Example 7.23. Builtin function CHARS

CHARS(myfile)     ->   42   /* perhaps */
CHARS(nonfile)    ->   0
CHARS()           ->   1    /* perhaps */