z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


charin()

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

Read syntax diagramSkip visual syntax diagram
>>-charin--(--+------+--+----------+--+-----------+--)---------><
              '-name-'  '-,--start-'  '-,--length-'      

Function

Returns a string of up to length characters read from the stream specified by name. The location for the next read is the current location increased by the number of characters returned. This function does no editing of the data.

Parameters

name
The name for the stream can be a path name or a string that was returned from the stream open or popen commands. If name is omitted, the standard input stream is used.
start
For a persistent stream, specifies the byte number in the file where the read begins. start should not be specified for other types of streams.
length
The number of bytes returned by the function. If length bytes are not available in the stream, the function returns the number of bytes that are available and marks an error condition on the stream. For non-persistent streams, this function either blocks until length bytes are available, or returns with fewer bytes, depending on the file type and open flags. If length is 0, no characters are read, a null string is returned, and the read position is set based on the value of start.

Example

To read the next 256 characters:

say charin(file,,256)                                    
To set the read location to the sixth 80-byte record:
call charin file,5*80+1,0

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014