This code, developed to run under Windows/98, was designed to demonstrate the sequential input and output process in Windows/REXX.

/* REXX for Windows Seq. I/O Demo - Read several names and list on screen. */
name. = "";                       /* Clear STEM variable before read */
names = ""; ans = "";
i = 1; n = 1;
/*
   Set up the file for processing
*/
infile = .STREAM~NEW("c:\REXXdata\demo1i");
Signal on notready
Do Forever                        /* Phase 1 - Read all the names in. */
   inline = (infile~LINEIN())
   name.i = Substr(inline,1,8)
   i = i + 1;
End;
/*
   Input complete, report results.
*/
notready:
i = i - 1;
Say i "- names read."; Say " ";
Do Forever                        /* Phase 2 - Build the output line. */
   If n > i Then; Leave;
   names = names || name.n || " ";
   n = n + 1;
End;
Say names
Say "REXX for Windows Seq. I/O Demo - Successfully completed."
Exit 0                            /* leave program */

Compare this with the TSO/E REXX version, by clicking here.

Copyright © KMS-IT Limited 2002