With this principle, you can create a derived instance
from a reference instance and then use this derived instance to generate
the reference instance without duplicating its design. There are two
derivation types: the Design derivation and
the Code derivation. With the Design
derivation type, you create a derived instance to generate
the instance from a Library different from the one specified in the
reference instance. With the Code derivation type,
you create a derived instance that inherits the complete source code
(code generated from the design and specific code) of the reference
instance.
Design derivation
This derivation type is
available for the following entities: Program, Screen, Server, Data
Structure (for the generation of the Copybooks and the error messages), Dialog
(for the generation of the error messages), and Server Dialog.
It
is useful when an instance must be generated from different Libraries
(for example: A Program that must be generated for the CICS and IMS platforms).
You can create a derived instance that points to a reference instance
and to a generation Library. This derived instance does not contain
any design. You can then generate the reference instance from another
Library without duplicating its design.
To create the derived
instance, you must use the creation wizard of the entity. For example,
you use the Program creation wizard to create an instance that is
derived from a Program instance. Enter its required fields and check
the
Derive box. Then, select
Design
derivation in the
Derivation type field
and specify the instance it is derived from in the
<Entity>
to derive field.
Tip: If you leave the Name empty,
check the Derive box and enter the reference
instance. The name of the derived instance is automatically initialized
with the name of the reference instance. You just need to complement
this name with the Library or any other distinctive code. This way,
they can be easily associated among all the available instances.
The
derived instance is displayed under the same entity as the instance
it is derived from, in the same location of the
Design
Explorer view. Double-click the instance to open it. The
derived instance contains the following tabs:
- The Overview tab with a link to the reference
instance that contains the design, and a link to the generation Library
- The Definition tab for Program, Dialog,
and Screen entities only. This tab displays the COBOL target and the
generation variants elements
- The -CR Lines tab that contains the links
between entities, called 'references'
- The Keywords tab
Then, you must generate the derived instance. It actually
generates the reference instance but with the parameters of the generation
Library that is selected in the derived instance.
Note: If the design
of the reference instance has been modified, the generation of the
derived instance takes this modification into account, except if the
change was only a change of Library.
The generated COBOL
file will be created, nested under this derived instance. This way,
you can keep as many COBOL files of the same instance as there as
generation targets.
Code derivation
This derivation type is
reserved for entities in which specific code can be inserted: Programs,
Screens, and Servers. It is useful when this specific code is distributed
among various Libraries.
You can create a derived instance
that does not contain any design but points to a reference instance.
The derived instance inherits the complete source code of the reference
instance.
When you generate a derived instance that was created
with a
Code derivation type, the following
steps take place:
- The instance that is referenced by the derived instance is generated
if it has not already been generated, or if an element of its design has been modified.
- The complete source code (the code generated from the design and
the specific code) is passed on to the derived instance, where it
is considered as the generated code. A reconciliation then synchronizes
this generated code with the specific code of the derived instance.
Note: If you generate a derived instance, its reference instance
is generated again if necessary, but the reverse is not true: If you
generate a reference instance, its derived instance is not generated.
From
the same design of the same Pacbase instance, you can
then generate two source files with different COBOL codes. You can
repeat these operations from the derived instance, by selecting it
as the reference instance of a new derived instance.
The derived
instance is simple because it contains one field only: a reference
to the generatable instance (a Program, Screen, or Server).
To
create the derived instance, you must use the creation wizard of the
entity. For example, you use the Program creation wizard to create
an instance derived from a Program instance. Enter its required fields
and check the
Derive box. Then, select
Code
derivation in the
Derivation type field.
You must specify the instance it is derived from (such as a Program,
Screen, or Server, or the derived instance of these entities).
Tip: If you leave the Name blank, check
the Derive box and enter the reference instance.
The name of the derived instance is automatically initialized with
the name of the reference instance. You just need to complement this
name with any distinctive code. This way, they can be easily associated
among all the available instances.
The derived instance
is displayed under the same entity as the instance it is derived from,
in the same location of the
Design Explorer view.
Double-click the instance to open it. The derived instance contains
the following tabs:
- The Overview tab with a link to the reference
instance that contains the design, and a link to the generation Library
- The Definition tab for Program and Screen
entities only. This tab displays the COBOL target elements
- The -CR Lines tab that contains the links
between entities, called 'references'
- The Keywords tab