file i/o - MSG file
PARM fileset=./@# This script reads a file produced by LISTFILE,6 and measures CPU millisecs# using a MSG filesetvar savecpu hpcpumsecs :readmsgerrclear 259 msecs to read 22 recordsfile msg=/tmp/LISTFILE.msg; MSG continue :readmsg @.pub.sys listfile !fileset,6 >*msg 15,845 msecs to read 1,515 if hpcierr = 0 then # read listfile names into a variable setvar cntr setvar(eof, finfo('*msg', "eof")) while setvar(cntr, cntr-1) >= 0 do input rec <*msg endwhileendifecho ![hpcpumsecs - savecpu] msecs to read !eof records.deletevar cntr, eof, rec
Notes:
- Each read of a MSG file is destructive so it works with INPUT in a while loop.
- Example shows using POSIX names to keep temporary files.
- Shows setting two variables in one CI command line.
- Shows how to measure the performance of a script or UDC.