This code, developed to run under TSO/E REXX, was designed to demonstrate the sequential input process of EXECIO. (The code was developed from an Assembler Workshop exercise, and has also been coded in Java.)
/* ---- REXX Sequential I/O Example (EXECIO) ---- */
Drop name. /* Clear STEM variable before read */
names = " ";
/* ---- Allocate the file and read all the names into STEM variables ---- */
"ALLOC DA(cobol.cntl(demo1d)) F(ut1) SHR" /* Assign input file */
"EXECIO * DISKR UT1 (FINIS STEM name."
"FREE F(UT1)" /* De-allocate the file */
Say name.0 " names read."; Say " ";
/* ---- Now concatenate the names with intevening blanks ---- */
Do n = 1 Until n > (name.0 - 1)
names = names || SUBSTR(name.n,1,8) || " "
End;
/* ---- Report names to screen and quit ---- */
Say names
Exit 0 /* leave program */
Copyright © KMS-IT Limited 2002