EXECIO Example 3
/**************************** REXX *********************************/
/* This exec reads five records from the data set allocated to */
/* MYINDD starting with the third record. It strips trailing blanks*/
/* from the records, and then writes any record that is longer than*/
/* 20 characters. The file is not closed when the exec is finished.*/
/*******************************************************************/
"EXECIO 5 DISKR myindd 3"
DOi=1to5
PARSE PULL line
stripline = STRIP(line,t)
len = LENGTH(stripline)
IF len > 20 THEN
SAY 'Line' stripline 'is long.'
ELSE NOP
END
/* The file is still open for processing */
EXIT 0
Figure 3. EXECIO Example 3
EXECIO Example 4
/**************************** REXX *********************************/
/* This exec reads first 100 records (or until EOF) of the data */
/* set allocated to INVNTORY. Records are placed on data stack */
/* in LIFO order. If fewer than 100 records are read, a message is */
/* issued. */
/*******************************************************************/
eofflag = 2 /* Return code to indicate end of file */
"EXECIO 100 DISKR invntory (LIFO"
return_code = RC
IF return_code = eofflag THEN
SAY 'Premature end of file.'
ELSE
SAY '100 Records read.'
EXIT return_code
Figure 4. EXECIO Example 4
Using EXECIO to Process Information ...
Chapter 12. Processing Data and Input/Output Processing 165