Running convert5 in Batch Mode [ COBOL/HP-UX Compatibility Guide for the Series 700 and 800 ] MPE/iX 5.0 Documentation
COBOL/HP-UX Compatibility Guide for the Series 700 and 800
Running convert5 in Batch Mode
If you wish to run convert5 in batch mode, you must first write a
parameter file containing the parameters required by convert5. When you
then run convert5, it first validates all of the parameters you have
entered, and if these are all valid, each invocation of convert5 extracts
a full set of parameters from this file. If the parameters are not
valid, no conversion takes place.
The Parameter File
This is a free-format line sequential file which contains a parameter on
each line. If you enter any lines of space characters, these are ignored
by convert5.
The first word on each line of the parameter file identifies the type of
parameter you are specifying. This can be any of the following (in
upper- or lower-case characters):
LISTFILE
SOURCEFILE
FD
PROGRAM
SUBROUTINE
IDENTIFIER
RUN
If you enter an asterisk (*) as the first non-space character on any
line, this line is treated as a comment line.
In addition a line may start with a record number (see the section Record
Number Parameters later in this chapter) followed by a valid 88-level
condition.
The Listfile Parameter.
This parameter specifies the name of a file where any error messages or
status values reported from convert5 are recorded. When you specify this
parameter, it remains valid until you specify the parameter again, so
ensuring that all the information reported during a run can be placed in
the same listing file. If you specify the parameter again with another
filename, subsequent messages are sent to this second file, while if you
specify the parameter with following spaces, these messages are sent to
your screen.
The parameter has the following format:
LISTFILE file-name
If you specify neither a LISTFILE parameter nor a file-name after
LISTFILE, messages are written to the screen.
The Sourcefile Parameter.
This mandatory parameter gives the name of the DG Interactive COBOL
source program which convert5 is to scan for information on the files to
be converted. The parameter has the following format:
SOURCEFILE file-name
The FD Parameter.
This mandatory parameter gives the internal name of the file as it is
appears in the FD entry of the DG Interactive COBOL source program you
specified in the SOURCEFILE parameter. The parameter has the following
format:
FD file-name
The Program Parameter.
This mandatory parameter gives the name of the source program which
convert5 creates. The parameter has the following format:
PROGRAM file-name
The program name must not be the same as the name used in the SOURCEFILE
or LISTFILE parameter.
The Subroutine Parameter.
This parameter gives the name of a COBOL subroutine that you supply as it
will appear in a CALL statement in the file conversion program. For
files which contain multiple records this subroutine will identify the
correct record definition, allowing you to convert files of any logical
complexity. The parameter has the following format:
SUBROUTINE program-name
The Identifier Parameter.
The IDENTIFIER parameter specifies the name of an item in the file record
whose value can be used to uniquely determine a type of record in a file
with more than one record type. The parameter has the following format:
IDENTIFIER file-name
Record Number Parameters.
If you have specified an IDENTIFIER parameter, you must specify a number
of parameters that indicate which values of the item named in the
IDENTIFIER parameter correspond to which record types. Each parameter
has the following format:
record-number condition
where:
record-number indicates a record type (1 means the first 01 level entry
in the FD, 2 means the second 01 level entry, and so on). Note that
record identification is carried out in the order in which the
record-numbers are specified.
condition is an 88-level record-type which, if true, indicates that the
associated record-number gives the correct record type. The OTHERWISE
condition indicates the correct record type for those values of the item
named in the IDENTIFIER parameter which you have not previously specified
in the Record Number parameter. All record number parameters must
immediately follow the IDENTIFIER parameter, and must be in the order you
want record identification to be carried out.
See "Example Parameter List" for an example of the use of these
parameters.
The Run Parameter.
The mandatory RUN parameter invokes convert5 with those parameters that
have already been read. The parameter has the following format:
RUN
Example Parameter List.
The parameter list shown in Figure 16-2 is an example of a parameter file
that you could supply to convert5. This file generates file conversion
programs for three DG Interactive COBOL data files.
**********************************
* Parameters for first run *
**********************************
LISTFILE history.lst
SOURCEFILE payroll1.cbl
FD employee-file
PROGRAM progemp
IDENTIFIER employee-status
2 99 103 200 201
1 1 thru 2000
3 6786 9999
2 0 thru 9999
4 OTHERWISE
RUN
**********************************
* Parameters for second run *
**********************************
SOURCEFILE payroll2.cbl
* listing will go to history.lst
FD branch-file
PROGRAM progbran.cbl
SUBROUTINE branchek
RUN
**********************************
* Last run *
**********************************
LISTFILE logfile
SOURCEFILE payroll2.cbl
FD history-file
PROGRAM history.abc
RUN
In the above example, the parameters for the first run are designed to
provide for a file comprising four record types. These records are
identified by a data item in one of the records. If this item has the
value 6786 or 9999, it is record type 3. If the values lie within the
range 1 to 2000 excluding 99, 103, 200 and 201, it is record type 1. Any
other values within the range 0 to 9999 are record type 2, while any
values lying outside this range are record type 4.
The second file which is to be converted during the run of this parameter
file also contains multiple records. However, record identification in
this case is carried out via the user-supplied subroutine named
"branchek".
The third file converted on the final run comprises only one record type,
and so record identification is not necessary.
The above example illustrates that record identification via level 88
data items is carried out in the order in which the parameters are
presented. You should also note that you can identify the same record
type more than once. You may find this useful if more than one parameter
is required to cover all possible combinations of data value.
Running convert5 with a Parameter File
To invoke convert5 in batch mode enter the command:
convert5 parameter-filename
where parameter-filename is the name of your parameter file.
convert5 now runs in batch mode, extracting a full set of parameters from
the parameter file with each invocation. The parameters supplied in the
file are always validated completely. If any errors are detected during
this validation, no conversion takes place.
You can validate the entries in a parameter file by entering:
convert5 parameter-filename validate
If you enter this command, the contents of the parameter file are
validated, but no conversion takes place, even if all of the parameters
are valid.
MPE/iX 5.0 Documentation