Virtuoso Process Overview [ VIRTUOSO CODE GENERATOR Reference Manual ] MPE/iX 5.0 Documentation
VIRTUOSO CODE GENERATOR Reference Manual
Virtuoso Process Overview
The Virtuoso Code Generator reads a Virtuoso source file. Within the
source file, references may be made to macros which are defined in a
Virtuoso macro file. The generator will retrieve information from the
System Dictionary when instructed to do so by the generator constructs
contained in the Virtuoso source.
Figure 1-6 illustrates the input and output for the Virtuoso Code
Generator. The input to the process is a Virtuoso source file. The
source file can be a Virtuoso model or custom logic. The input file is
considered a model when the source file is not specific to a particular
business problem and can be reused over and over. The file contains
custom logic if the problem being solved is very specific and cannot be
addressed by a model.
Figure 1-6. Virtuoso Overview
Generator Constructs
The Virtuoso Code Generator produces code based on a set of instructions
or constructs. The constructs make up a powerful meta-language which
allows you to control the text that is to be generated. It is the
constructs that give you the flexibility to generate any type of text.
They provide the control that is needed to generate high performance
application logic. Constructs are used when developing macros and models
as well as when custom logic is being developed.
HP System Dictionary Integration
The System Dictionary contains information about data in the computer
system, such as databases and forms files. This information can include
the data names, definitions, structure, and size; how the data is used
and where it is located; and information about data relationships.
Information in the System Dictionary refers to data structure.
Virtuoso accesses System Dictionary definitions to generate specific
output text from generic Virtuoso text. The System Dictionary provides
the information necessary to turn generic code into specific code. The
macros and models access the System Dictionary, and so they can be reused
in your application environment while specifics are placed in the System
Dictionary.
The HP System Dictionary is used to store application information and
documentation. System Dictionary is a central repository for
descriptions of data resources. It can also be used to describe and
document your data processing applications. These descriptions of your
applications are used to generate code by retrieving entities,
relationships, and attributes from the dictionary using the Virtuoso Code
Generator constructs and then incorporating this information into the
generated code. This makes it possible for the logic in a model or macro
to be independent of the specific data descriptions, since these can be
retrieved from the System Dictionary.
Thus, the specific information about the application that is to be
generated from a model can be stored in System Dictionary. For example,
if a model displays a FORMSPEC form and then allows the user to enter
data that will be added to a TurboIMAGE dataset, the name of the form and
the dataset would be stored in the System Dictionary rather than in the
model itself. Since you create the macros and models that are used for
application development, the requirements for the types of data that must
be stored in the System Dictionary are entirely up to you.
Using a Model
A model is a Virtuoso source file that can be reused to solve different
problems. When the problem that you are solving matches the logic
provided by a model, the model can be used to automatically generate the
application logic. Thus a single model can be used to generate different
programs. These programs are called modules. For example, a model that
displays a FORMSPEC form, allows a user to enter data, and then adds the
data to a dataset can be reused when solving different business problems.
If you have an inventory application that allows a user to enter PART
information, this model could be used to solve the problem. The model
could also be used when adding a new customer to the customer database.
This concept is illustrated in Figure 1-7.
Figure 1-7. Reusing Program Structures
To specify the specific data for the model, you enter the information
required by the model into System Dictionary. For example, the form and
the dataset that are used by a model would be entered in the System
Dictionary and tied to a specific program to be generated from the model.
Within the model, Virtuoso constructs would retrieve the information and
allow the data to be replaced into the Virtuoso source code.
If custom logic was needed to perform specific processing for the problem
being solved, this code would be created in a file which would be
incorporated into generated application logic by Virtuoso. This custom
logic is still created using Virtuoso source statements which allows you
to use macros to perform a majority of your processing.
Generating an Application with Virtuoso
The Virtuoso Code Generator can be used to construct large data
processing applications. With Virtuoso, each program or subprogram that
is part of that application is generated individually.
Before getting started you will want to define the data resources for
your application in the System Dictionary. The definitions of the
TurboIMAGE databases, FORMSPEC formsfiles, etc. are described in the
System Dictionary. Automated utilities are provided as part of System
Dictionary to load the definitions of TurboIMAGE databases and FORMSPEC
formsfiles. These utilities should be run before attempting to generate
code.
The steps involved in generating a program or subprogram with Virtuoso
are illustrated in Figure 1-8:
Figure 1-8. Virtuoso Development Process
1. Evaluate Feasibility of Using a Reusable Component
For each program or subprogram, determine whether a model can be
used to solve the problem. A model can be used when your problem
requires the same basic logic that is performed by the reusable
logic in an existing model. Custom logic can be added to the
reusable logic to handle any specific requirements that you may
have.
If there is no model that performs the required processing,
determine if the problem you are solving is a good candidate for
becoming a new model. This would be the case when you have seen
the same problem before or are confident that the same type of
problem will come up again in the future.
When the problem that you are solving is very unique and is not
well suited for a model, you will develop custom logic. Although
you will not be able to take advantage of a model to solve your
problem, you can use macros to develop your logic which will still
give you the productivity of a high level language.
2. Create Custom Logic
Create custom logic required to adapt the models and macros to the
problem that is being solved. Custom logic is simply a Virtuoso
source file. It is included at a predefined location in either a
model or a macro. A file containing the custom logic for each
predefined location will be created.
3. Define Application Meta-Data
Enter the System Dictionary definitions required by the Virtuoso
source statements. The information will typically include the
names of datasets, databases, and forms used by the application
logic. Even in the situation where custom logic was developed,
dictionary defintions may be required depending on the macros that
have been developed for your organization.
4. Generate the Logic
Once you have generated the logic, you will want to maintain the
logic at the Virtuoso level. If you make changes in the generated
code, the changes will be lost when the source code is regenerated
at a later date. In maintenance you can have high productivity
equivalent to the productivity experienced in development.
5. Generate the Copylib Members
Virtuoso uses the System Dictionary utility System Dictionary
COBOL Definition Extractor (SDCDE) to create the COBOL record
definitions that are used in all COBOL programs.
6. Compile and Prep
7. Test the Application
MPE/iX 5.0 Documentation