April 1, 1981 File Manipulation with EXECs You =an, to a limited degree, read and write CMS disk files using EXE:s. You can stack files with a filetype of EXEC in the console stack and
thenread them, one record at a time, with &READ control statements. All data are truncated to eight characters. You can write a file, one
recordat a time, with the &PUNCH control statement, and then you can
read the spool punch file onto disk. Examples of these techniques
follow.STACKIN3 EXEC FILES There aLe two methods to stack EXEC files in the console stack. One is
illustratedusing a CMS EXEC file, as shown in the following PREFIX EXEC: SLNAME = &CONCAT &1 *
LI5TFILE&LNAME SCRIPT * (EXEC EXEC CMS &STACK SLOOP -END gREADFLAG EQ CONSOLE &READ VARS SNAME STYPE &MOD &SaFFIX = &SUBSTR &HAME 3 6 SNEWNAM = SCONCAT &2 &SUFFIX RENAME SNAME f,TYPE &MOD &NEWNAM STYPE &MOD SIF SRETCODE EQ 0 SSKIP &TYPE SNAME &TYPE NOT RENAMED -END
ThisEXEC procedure is invoked with two arguments, each two characters
in length, which indicate old and new prefixes for filenames. TheEXEC renames files with a filetype of SCRIPT that have the first prefix, only the prefix in the filename.
TheLISTFILE command, invoked with the EXEC option, creates a CMS EXEC file in the format:
&1 &2 filenameSCRIPT mode When the EXEC is invoked with the line: EXEC C!"!S &STACK the arqGment &STACK is substituted for the variable symbol &1 in each
line in theCMS EXEC. The execution of the CMS EXEC effectively stacks,
in the console stack, the complete file identifications of the files
listed:SSTACK filename SCRIPT mode &STACK filename SCRIPT mode
Thesesta=ked lines are read back into the EXEC, one at a time, and the
tokens "filename","SCRIPT", and "mode" are substituted for the variable
symbolsSNAME, &TYPE, and &MOD. asing the SSUBSTR and &CONCAT built-in functions, the new name for
each file is constructed, and theRENAME command is issued to rename the
files.
294IBM VM/370 CMS User's Guide
then
record
read the spool punch file onto disk. Examples of these techniques
follow.
illustrated
LI5TFILE
This
in length, which indicate old and new prefixes for filenames. The
The
&1 &2 filename
line in the
in the console stack, the complete file identifications of the files
listed:
These
tokens "filename",
symbols
each file is constructed, and the
files.
294