>GENERATE FILE [ DICTIONARY 3000 ] MPE/iX 5.0 Documentation
DICTIONARY 3000
>GENERATE FILE
Generates the PASCAL declarations for the file definitions in the
Dictionary.
Prompts
The following prompt is issued when the command-subcommand GENERATE FILE
is entered:
_____________________________________
| |
| FILE(S)> |
_____________________________________
FILE(S)> Enter the name(s) of the files to be extracted
from the Dictionary and from which data
declarations will be generated. More than one
file can be entered in a command line as long
as each file name is separated by a comma ( , )
or a space. Also, the file names can not
exceed the first 72 characters in the command
line. DICTPDE will continue to prompt for file
names until [[RETURN]] is entered in response
to this prompt.
If a parent file is entered in response to this
prompt, DICTPDE will generate data declarations
for the parent file as well as for the related
child files and associated elements. The
parent file will be generated as a record. The
primary name of the parent file will be the
record name. The child elements will be
generated as fields within the record. The
aliases of the child files will be the field
names (unless a child file does not have an
alias, then the first 8 characters of the
primary name will be used as the alias). Note
that any element associated to the secondary
format for a file will not be extracted by
DICTPDE.
A data declaration can be generated for a
specified file only once to an output file.
However, many data declarations can be
generated for a specified file if each
declaration generated for that file is written
to a different output file.
Pressing [[RETURN]] in response to this prompt
indicates that no more file names are to be
entered. DICTPDE will then stop prompting for
file(s) names and begin the code generation
process. The generated code will be echoed to
the terminal as it is written to the output
file.
Discussion
GENERATE FILE allows you to identify the files to be used for code
generation.
Example
The following examples show how the GENERATE FILE command-subcommand is
used and the code that it generates.
The first example shows the data declaration generated for a simple file;
that is, a file without any child files. The file type for a simple file
must be defined in the Dictionary as: FORM, AUTO, DETL, MAST, KSAM, MPEF
or MPER.
The file CUSTFORM is defined in the Dictionary as follows:
FILE : CUSTFORM
FILE-TYPE : FORM
FILE-ALIAS : CUSTALIAS
CUSTFORM has the following elements associated with it:
ELEMENT : ACCOUNT LAST-NAME FIRST-NAME CREDIT
ELEMENT-ALIAS : ACCOUNTALIAS
ELEMENT-TYPE : I X X R
ELEMENT-LENGTH : 4 16 10 4
The code is generated as follows:
>generate file
FILES(S)> custform
TYPE
CUSTFORM =
RECORD
ACCOUNTALIAS : INTEGER;
LAST_NAME : PACKED ARRAY[1..16] OF CHAR;
FIRST_NAME : PACKED ARRAY[1..10] OF CHAR;
CREDIT : REAL
END;
Note that the alias name for the element ACCOUNT was used when the code
was generated. This is the name by which this element is known by the
file CUSTFORM. Also note that the hyphens in the element names have been
replaced by underscores when the code was generated. (See Naming
Considerations later in this section for more information on converting
hyphens to underscores.)
The next example shows the code generated for a parent file (this file
must be defined in the Dictionary as type BASE or VPLUS). The file
STOREFF is defined in the Dictionary as follows:
FILE : STOREFF
FILE-TYPE : VPLS
The following files are related to STOREFF:
FILE : CUSTFORM DATEFORM INVENTFORM
FILE-TYPE : FORM FORM FORM
FILE-ALIAS : CUSTALIAS
The file CUSTFORM has the following elements associated with it:
FILE : CUSTFORM
ELEMENT : ACCOUNT LAST-NAME FIRST-NAME CREDIT
ELEMENT-ALIAS : ACCOUNTALIAS
ELEMENT-TYPE : I X X R
ELEMENT-LENGTH : 4 16 10 4
The file DATEFORM has the following elements associated with it:
FILE : DATEFORM
ELEMENT : DATE
ELEMENT-ALIAS :
ELEMENT-TYPE : X
ELEMENT-LENGTH : 6
The file INVENTFORM has the following elements associated with it:
FILE : INVENTFORM
ELEMENT : STOCKNUM SUPPLIER BINNUM UNIT-COST
ELEMENT-ALIAS : BINNUMALIAS
ELEMENT-TYPE : X X R R
ELEMENT-LENGTH : 8 16 4 4
The code is generated for STOREFF as follows:
>generate file
FILE(S)> storeff
TYPE
CUSTALIAS =
RECORD
ACCOUNTALIAS : INTEGER
LAST_NAME : PACKED ARRAY[1..16] OF CHAR;
FIRST_NAME : PACKED ARRAY[1..10] OF CHAR;
CREDIT : REAL
END;
DATEFORM =
RECORD
DATE : PACKED ARRAY[1..6] OF CHAR;
END;
INVENTFORM =
RECORD
STOCKNUM : PACKED ARRAY[1..8] OF CHAR;
SUPPLIER : PACKED ARRAY[1..16] OF CHAR;
BINNUMALIAS : REAL;
UNIT_COST : REAL
END;
MPE/iX 5.0 Documentation