Once the reformat specifications have been defined and are
stored in a compiled reformat file, you can run REFORMAT to actually
reformat the data in the batch file and write it to the output file.
REFORMAT is not an interactive program. That is, it does not
prompt for any information. It is usually run as a batch job, though
it can be run from a terminal directly or as a "streamed" job.
REFORMAT needs the names of three files: the "reformat" file
containing the reformat specifications, the "batch" file containing
the data to be reformatted, and the "output" file to which the reformatted
data is written. To specify these files, use MPE :FILE commands before running REFORMAT, as follows:
:FILE REFENTITY =reformatfile :FILE BATCH=batchfile :FILE OUTENTITY =outputfile
|
For example, assuming a reformat file named REF1, a batch file named BAT1, and an output file named OUT1, the following commands are needed to run REFORMAT:
:FILE REFENTITY =REF1 :FILE BATCH=BAT1 :FILE OUTENTITY =OUT1 :RUN REFORMAT.PUB.SYS
|
These file equations show the required files for running REFORMAT.
You will also probably want to list the reformatted data and, if
you are running REFORMAT from a terminal, you will want error messages
listed on the line printer rather than on the terminal screen.
A list of the reformatted data is very important when you
run REFORMAT the first time, so you can see whether your reformat
specifications are doing what you expect. To list reformatted data,
include the file TESTLIST in the file equation that sends the listing to
the line printer:
Another important file, particularly when you are running
a session, is the error message file. This file REFLIST normally is written to $STDLIST. Since $STDLIST in a session is the terminal, you may want to
equate this file to the line printer with the command:
Concatenating Batch Files |
|
Data from a batch file can be appended to data from another
batch file in an existing output file by issuing the following commands:
:FILE REFENTITY =reformatfilename :FILE OUTENTITY =outputfilename :FILE BATCH=firstbatchfilename :RUN REFORMAT.PUB.SYS
|
These commands will run REFORMAT using the three files specified
in the :FILE commands. Next, issue the following commands:
:FILE OUTENTITY =outputfilename;ACC=APPEND :FILE BATCH=secondbatchfilename :RUN REFORMAT.PUB.SYS
|
The outputfile now contains the reformatted data from the
first and second batch files.
Using a User-Defined Command |
|
You may want to combine the three :FILE commands required to run REFORMAT into one user-defined
command (UDC). You enter a UDC through a text editor, as follows:
REFORMAT REFSPECS, DATA, OUTPUT=$STDLIST FILE REFENTITY =!REFSPECS FILE BATCH=!DATA FILE OUTENTITY =!OUTPUT FILE REFLIST;DEV=LP FILE TESTLIST;DEV=LP RUN REFORMAT.PUB.SYS
|
Use the SETCATALOG command to set the UDC.
The UDC definition is recorded by the MPE :SETCATALOG command. Now, all you need to do in order to run
REFORMAT, is to enter the following command:
:REFORMAT reformatfilename, batchfilename, outputfilename
|
Suppose your reformat file is named REF1, your batch file is named BAT1, and your output file is OUT1, run REFORMAT as follows:
:REFORMAT REF1, BAT1, OUT1
|
Streaming REFORMAT |
|
You may also want to stream REFORMAT. You must first create
a text file of the commands to run the job through a text editor,
and then issue the MPE :STREAM command to actually run the program. For example:
!JOB USER.ACCOUNT !FILE REFENTITY =REF1 !FILE BATCH=BAT1 !FILE OUTENTITY =OUT1 !FILE TESTLIST;DEV=LP !FILE REFLIST;DEV=LP !RUN REFORMAT.PUB.SYS !EOJ
|
To stream this job, assuming you named the text file REFSTREM, use the following command:
In many cases, a streamed job is part of a group of streamed
jobs. When REFORMAT is part of a series of program executions, you
should precede the RUN REFORMAT command by a MPE :CONTINUE command. Otherwise, any fatal error in REFORMAT
(such as an inappropriate file name) prevents subsequent programs
from executing. For example:
!JOB !FILE ... !FILE ... !FILE ... !CONTINUE !RUN REFORMAT.PUB.SYS !SPLGO MYPROG !EOJ . . .
|