Introduction

CA Gen enables application development on Windows workstations and supports application deployment to integrate multiple platforms on z/OS (CICS and IMS), UNIX, Linux, Windows, .NET and J2EE.

CA is Computer Associates. And CA Gen is one of their product.

38) What are GEN Attributes rules, modeling considerations



38) GEN Attributes rules, modeling considerations

· Although not a requirement, each entity type should have at least one attribute for view reference and Transformation.

· Each attribute is implemented as a field in a record during database Transformation.  When the database is implemented as a relational database, each attribute is implemented as a column in at least one table.  It can be implemented in multiple tables because of usage as a foreign key, and when denormalization occurs.

· Fixed-length text (CHAR) attributes are limited to 255 characters.  The length specification excludes the decimal point, which is implied.  Varying-length text (VARCHAR) attributes can be longer than 255 characters, but only 255 characters can be displayed in a single field on a screen.  Up to 4096 characters can be displayed in a window, but only if they are displayed in a multi-line entry field.

· The maximum length of variable length text (VARCHAR) strings varies by DBMS and GEN, COOLGEN release.  Specific DBMSs support different maximum lengths of VARCHAR (variable character string) datatypes.  These string datatypes include maximum number of columns in an index, maximum length of a compound key, maximum number of columns in a table, and the maximum length of table (row length and number of bytes total).

· For numeric attributes, the actual precision of arithmetic operations and number of significant digits depends on the version of the platform, compiler, and DBMS.  In general, you should get at least 15 significant digits of accuracy.

· Numeric attributes are limited to 18 digits.  The number domain is transformed into a format of small, integer, or packed based on length:


37) What are some Performance Considerations while modeling in GEN, COOLGEN, CA-GEN ?



37) What are some Performance Considerations while modeling in GEN, COOLGEN, CA-GEN ?

Two tips.


· Use denormalization and extended READs (READ several entity views at a time) rather than collapsing entity types together to improve retrieval performance when entity types are joined by a relationship that allows denormalization.

· Try to stabilize your Data Model as much as possible before performing action diagramming.  This reduces the likelihood that an attribute has been or will need to be added which should have been a foreign key from a relationship.  It also reduces the likelihood of attribute movements or identifier changes.  This can cause integrity issues or require you to change your action diagrams.


36) How does GEN implements Maximum Number of Attributes



36 )  How does GEN implements Maximum Number of Attributes


· Each DBMS has limits on the number of columns, identifiers, and foreign key columns.  Your specific DBMS documentation lists the maximum values for numbers of columns, tables, joins of views, and other values.  GEN, COOLGEN checks the number of identifiers, attributes, and so forth against DBMS limits only during generation.

35) What are properties of entity type and attribute in GEN ? CoolGen, CA GEN



35) What are properties of entity type and attribute in GEN ? CoolGen, CA GEN


Every entity type and attribute in the Data Model has a Data Structure Definition (DSD) name, which is used for record, table, field and column names in the database structure as defined by the Data Structure List and Data Store List.  If you do not specify DSD names for your entity types and attributes, the entity type and attribute names from the Data Model are used by GEN as DSD names.

· Entity type names, attribute names, and DSD names may each be up to 32 characters in length.  However, table names and column names for generated DDL are limited to 18 characters.During Transformation, a table name or attribute name is derived from the DSD name and is referenced for records and fields in the Data Structure List.  To create the derived name from a DSD name, GEN will:

-Truncate the DSD name, if it is too long

-Add numbers as necessary to ensure uniqueness if the truncated name is not unique

-Add numbers to the name if it is reserved wordGEN does not allow special characters in entity names.  National language characters are supported in both entity names and DSD names.

· If no DSD name is specified for an entity type, the record and table are assigned the entity type's name.You can modify the record name, table name, or attribute name in the Data Structure List without affecting the DSD name in the Data Model.

· During database Transformation of an entity type, the record implementing the entity type is assigned the entity type's DSD name, if one exists, with length and reserved word checking.

· Avoid using Database Management System (DBMS) and target language reserved words for entity type or attribute names.  If you use a DBMS reserved word in the Data Model, GEN changes it during Transformation.  DBMS reserved words are checked again during Data Definition Language (DDL) generation and during code generation, since you may install on multiple platforms with the same database structure.  If the database structure is changed after Transformation, the change(s) are not used in Retransformation unless the Data Model is also changed.

· Other entity type properties describe the estimated number of entities and the anticipated increase in that number (growth rate).  GEN uses the volume and activity measurements to calculate dataset sizes during database Transformation.  Use anticipated sizes for production during data analysis.  Generated DDL may be adjusted to reduce space for testing.For related information, refer to the section on Transformation Calculations in the chapter Database Design.


34) What is difference between GEN conceptual and physical model



34) What is difference between GEN conceptual and physical model



Conceptual Versus Physical Model

One of the initial steps in application development is to build the Data Model, a conceptual model of your business from a data perspective.  When satisfied with the conceptual model, request Transformation (a selection in Design).  This creates a Data Structure List and Data Store List, a physical model of a database based on the Data Model.

· The detailed logic specifications for processes and procedures built with the GEN software refer to the Data Model (conceptual) rather than the Design specifications.

· GEN allows optimizations of the database structure (denormalization and adding of indexes) that do not change the meaning of the Data Model.  Use the Data Structure List to perform database optimization.

33) How to checkout a Cool Gen model, download a model



33) How to checkout a Cool Gen model, download a model

I. Steps Checkout a Model.

A. Preparation of Checkout
B. File Transfer
C. GEN  Model 

II.   Preparation of Checkout

A.  Online Process:  Using Host Encyclopedia 

Note:  Your subset definitions must be complete before continuing.

1.  Sign onto the host.
2.  Select "I" for GEN 
3.  Press "Enter" to continue
4.  Select "1" for Host Encyclopedia Functions
5.  Select "4" for Subset Management
6.  Select "13" for Download Subset
7.  Fill in the following screen (choosing the Model and Subset you want to download)
Note:  Software Version is 9.0.A2
Codepage is 1252 
8.  Press Enter to continue (If Online is selected the download will tie up your TSO session.  Select Batch to create JCL that can be submitted)
9.  If done online or batch it should take about 7 minutes for a 6 megabyte subset.  (Wait until complete.  This process creates the ief.tran file.)
 
 
 III.   File Transfer
Definition of Transfer facility:  TCP/IP (Transmission Control Protocol and Internet Protocol) is a communications protocol for exchanging information between computers and processes.  TCP/IP protocols are used on the Internet, Intranet, and many other private networks throughout the world. 

TCP/IP is an open standard intended to be hardware independent, supporting communications between any two computers, over any type of network.  For two computers to communicate they must each be running TCP/IP, each connected to a TCP/IP network (the same network, or networks that can communicate with each other), and with each computer authorized to accept communications from the other.


A.  Use FTP to copy ief.tran file to PC

Online:  

1. Open command prompt
2. Change directory to your subset directory.  Use the MD command to create the directory if it does not exist.  (i.e. MD SUBSET.IEF)    [note:  you can make this meaningful to what you are working on]

3. Type FTP SERVERNAME
4. Enter User ID
5. Enter Password
6. Type binary     
7. Note:  Important.  If not binary, when you make local the model you will receive a model scheme error. 
8. Type Get ief.tran  checkout.trn
9. Transfer statistics will be displayed upon completion.  
10.  Type quit, then exit.


IV.  GEN  Model 
 

 
1. In the GEN  Toolset select "Model"
2. Select "Encyclopedia"
3. Select "Check Out a Model"
4. Fillin in the Model Name, Subset and Local file name
5. Uncheck "Perform file transfers for encyclopedia options
6. Select OK





38) Explain GEN Subtype entity ? How it works?


38) Explain GEN Subtype entity ? How it works?

· When a parent entity type which includes subtypes is transformed, the parent entity type with its subtypes becomes one physical table.  All attributes defined within each subtype become optional columns on the table.   

· A subtype is sometimes promoted to an entity type in the Data Model for performance considerations.  An analysis of the impact of the subtype versus separate entity type should be done early in Analysis to avoid rework in action diagramming, database implementation, and data mapping from other systems.

· A promoted entity has a one-to-one relationship with the original entity with the following characteristics:

-The relationship is optional on the side of the original entity.

-The relationship is mandatory on the side of the promoted entity.

-The relationship is the identifier for the promoted entity.

-The relationship is mutually exclusive with any other relationships from the main (original) entity to other promoted subtypes from the same partitioning


Promoting Subtypes

· Involve your Database Administrator (DBA) in your discussions about whether to promote subtypes.  Your DBA should understand many of the factors to be considered in such a decision, which include such things as saving storage space, expending more processing time, impact on existing work, and the complexity of the proposed implementation.Use of subtypes can increase disk storage space with a consequent effect on I/O.  This is particularly true if the subtype represents a small portion of the occurrences of the parent entity type, as there will be wasted DASD for the empty columns.  The columns will contain either blanks or spaces.  This results in fewer occurrences of a single parent entity type on a data page, which increases I/O because more pages have to be READ to retrieve the data.  This effect may be minimized by the use of compression routines.

· You can use a third party vendor's compression routine (EDITPROC) to reduce the amount of disk space used.  There is some processing overhead associated with this.

· Promote subtypes to high-level entity types when faced with DBMS columns-per-table limitations, or concurrency or storage problems.

· Deciding to implement entity subtypes depends on how sensitive the installation is to wasted disk space versus increased I/O, additional INSERTs and DELETEs to create both parent and subtype rows in one table, and the access patterns for use of subtype predicates with or without parent predicates.  (Access patterns here means the answers to questions of access volume, required response times, and so forth.)Use of a subtype adds rows to a record.  This causes additional INSERTS and DELETEs in the database.  It also means additional INSERT and DELETE statements must be added to the action diagram.

· Not all subtype constraints are enforced by the code generator.  Relationships defined at the subtype level are always optional at the parent entity type level, and are only mandatory if they are against an occurrence of the subtype's type.

· Consider the effects of concurrency and reorganization and recovery administrative tasks when deciding to promote subtypes.



Subtype Views

· Attributes in the subtype can be referenced in views of the entity type or view of the subtype.  If you do not reference subtype attributes, you do not need a subtype view or the classifier.  If you do reference subtype attributes, you should reference the classifier.

· Subtype identifiers are defined to distinguish occurrences of the subtype from one another.  The indexes built for them in the Data Store List are defined as non-unique since the index will be on a table supporting all occurrences of the supertype (parent entity type).  Since identifying predicates must be static and classifying attributes do not have to be, using the classifier to make the subtype identifier unique is usually a poor choice.Put one identifier on the high level entity type (parent entity type).  Add indexes in the Data Store List as needed to enforce uniqueness constraints deemed important enough to warrant the additional index.

· An entity view cannot be matched to an entity subtype view.  View matching, and reuse of process and common action blocks, is more difficult if the same data is sometimes in an entity view and some times in an entity subtype.

· You should not have views of subtype attributes unless you also have views of the classifying value.  Test the classifier to see that the subtype attributes are valid.


· If you build a view of a subtype, the generated SQL SELECT for READs of that view automatically gets the classifying value added to the WHERE clause.

32) Gen Data Model Notation vs. UML Type Model notation



32)

What is the difference between Gen Data Model Notation vs. UML Type Model notation.

See pictures. First one is GEN model notation. Second is UML model notation.



31) Explaining Action Block in CA GEN , coolgen



What is an action diagram?
The Action Diagram tool lets you build the process action diagram, procedure action diagram, and the associated action blocks.
These specify the detailed logic of elementary processes, procedure steps, business algorithms, and derivation algorithms.
Parts of action diagram
The first part of an action diagram details the views that the process imports and exports. For more information on views,
The remaining pseudocode consists of action statements such as CREATE, READ, UPDATE, DELETE, and so forth, with levels of nesting enclosed in brackets.

Types of Action Blocks (AB)
Common Action Block
Foreign Action Block
External Action Block
Procedure Step Action Block
Building the Action Diagram

Building an action diagram requires three main activities:
Creating views
Defining logic for elementary processes and procedures
Defining action blocks

Creating Views
A view is a collection of associated attributes input to or output from a business activity

Types of views
Import views show information about an entity that a process receives (or imports)
Export views show information about the entity that a process produces (or exports)
Entity action views show stored information about an entity that a process manipulates during execution Local views are used for local operations

Assigning View Characteristics
Depending on the view you create, the following characteristics can be assigned: Supports entity actions
Lock required on entry
Used as both input and output
Supports Entity Actions
When an entity view is defined in the Import or Export view subset, the Supports Entity Action option specifies whether the view is transient or persistent.

Transient and Persistent
A transient entity view does not support the entity actions CREATE, READ, DELETE, or UPDATE. Transient views can be modified by MOVE and SET actions. Transient is the default for entity views in the import, export, or local view subset. A persistent entity view allows entity actions to be performed on the designated view.. Persistent views can be thought of as database buffers.

Lock Required on Entry
This Lock Required on Entry option allows locking of an occurrence in an import view at entry to the action block. Locking an occurrence prevents other transactions from changing the view

Used as Both Input and Output
The Used as Both Input and Output option allows import entity views to be exported and export entity views to be imported

Maximum Size of Views
The following restrictions apply to the maximum size of views:
For terminal-based applications, 32K for import and 32K for export.
For a single server load module, 32K for export.
For GUI applications developed under Windows NT, Win32, or UNIX, unlimited for import and export.

Group views
A group view is a collection of one or more associated entity views. Group views have cardinality, that is, each of their component views may occur more than once.

Detail Import Group Views
Detailing group views consists of the following activities: Describe group views
Specify cardinality
Specify optionality
Specify Import Group View Cardinality
Expected numbers of occurrences for the group view. You set the group view’s minimum cardinality by the value you enter for at least. You set the group view’s maximum cardinality by the value you enter for at most. Finally, you set the group view’s average cardinality by the value you enter for on average
Explicitly or implicitly indexed
Explicitly indexed repeating group views have user-accessible indexes to refer to specific entries in the repeating group
Implicitly indexed repeating group views cause the software to go to the next occurrence in a repeating group view
Specify Import Group View Optionality The optionality of an import group view refers to whether the view is mandatory (always used as input) or optional (sometimes used as input).


Building an action diagram
Add entity actions
Add relationship actions
Add assignment actions
Add conditional actions
Add repeating actions
Add control actions
Add miscellaneous actions
Conditional statements

An IF action statement for a simple condition: IF condition 1 action_statement_list_1
CASE
CASE OF (expression)
CASE value
CASE value
OTHERWISE

Loops
The FOR EACH condition is used to iterate through implicitly indexed repeating group views. Since the view is implicitly indexed, there is no need to specify subscript controls. This will automatically be generated by COOL:Gen software.

For Each
The TARGETING clause allows you to identify the repeating export or local group view to be populated. The following example shows usage of the TARGETING clause: FOR EACH product details TARGETING group export FROM THE BEGINNING UNTIL FULL ASSOCIATE processing warehouse WITH received product WHICH is_held_in IT
WHILE Condition
The WHILE repeat condition repeats the action group as long as a condition is true. When you add the WHILE condition, set up the condition and then state the action(s) to be taken. The test for the condition takes place first. If the condition is not met, there are no iterations.
REPEAT UNTIL Condition
The combination of the REPEAT and UNTIL statements repeats an action or group of actions until a specific condition is satisfied. The test for the condition takes place after the iteration. Therefore, REPEAT–UNTIL always has at least one iteration.
FOR Condition
The FOR condition is used to control iterating through an explicitly indexed repeating group view. The syntax allows you to pick a subscript or other numeric attribute, a starting index, an ending index, and increment value for each iteration.

30) Types of Action Blocks (AB) in coolgen, CA GEN

Common Action Block

Foreign Action Block

External Action Block

Procedure Step Action Block

29) Parts of action diagram in coolgen, ca gen



The first part of an action diagram details the views that the process imports and exports. For more information on views,

The remaining pseudocode consists of action statements such as CREATE, READ, UPDATE, DELETE, and so forth, with levels of nesting enclosed in brackets.

28) What is an action diagram?

28) What is an action diagram?


The Action Diagram tool lets you build the process action diagram, procedure action diagram, and the associated action blocks.
 
These specify the detailed logic of elementary processes, procedure steps, business algorithms, and derivation algorithms.

27) Coolgen Interview Questions - Set 07



How to Generate Host Code using the Installation Tool

The expected output of performing this procedure is a set of load modules and DB2 DBRM modules.  
In order to accomplish this, you must:
·         Generate the trigger and load modules from the implementation model
·         Generate the load modules from the model
·         Ship .rmt files from step 1 and 2 to PID

·         Compile, link , and bind programs  

26) Coolgen Interview Questions - Set 06



How to handle error in the GEN coding : 

1. naming the action diagrams in a  application and
2. using exit states to support error handling

When an error occurs the user and the developer should know

1. what service or action block failed
2. what attribute had a problem

3. the problem it had

25) Coolgen Interview Questions - Set 05


Talk about the Batch model and packaging etc in COOLGEN, CA-GEN

·         Choose model and appropriate batch business system (E.G. modelname).
·         Add Procedure/Procedure step and create as a type = BATCH
·         Packaging as Batch, give the job name
·         Use host encyclopedia load module packaging. Give Load module name as a program that is used in a  batch JCL
·         Build the JCL and make sure you have allocated TIRIOVF dataset.
·         Decide Check pointing logic if required
·         Check pointing logic is required if the job has to be made as restart-able without any manual intervention.
·         Time based check pointing or record based check pointing
·         Time base check pointing means take a commit point ofter predefined interval and save the key of the record processed.

·         Record based check pointing means take a commit point after certain number of records and save the key of the record processed.

24) GEN, CA GEN, CoolGen client procedure related best practice





The control to the client procedure comes from the following ways:
1.   From previous client
2.   From the server
3.   From the same client (for displaying an error)
4.   From the next client (on success or failure)
To know where the control comes is quite tricky.

Best Practice:
The usual way of communicating from client to client OR client to server is through the IEF variable command. But as explained above this alone is not sufficient to signify where the control comes from. Hence the following convention is followed:
·       Two variables curr_command and prev_command are maintained. curr_command is assigned to prev_command, command is assigned to curr_command in the beginning of the client procedure.
·       Command is set to "return" whenever the control transfers from the server
·       The convention is as follows:
Client procedure:
...
...
/* Execute client validations here */
CASE of Command
CASE…
CASE…
Otherwise…
End CASE

/* Execute client code after window has been displayed */
CASE of curr_command
CASE…
CASE…
Otherwise…
End CASE

/* Execute client code after return from server */
CASE of prev_command
CASE return
            /* Code to be added return from server */
            …
CASE…
Otherwise…
End CASE


Note: Client validations can also be executed as events.

23) GEN, CA GEN, CoolGen client procedure related best practice





Exit states cannot be set across server procedures. This becomes a major impediment in the following cases:
·       Server wants to return an error message to client by means of an exit state
Note: COOL:Gen allows exit states to be passed across procedures. But this practice is not valid for earlier versions

Best Practice:
Every client and server procedure does the following:
·       In the beginning USE an init action block
·       Just before exit USE an exit action block

The client procedure looks like:
Import Views:
Export Views:
Local Views:

USE client_init_action_block ...
...
...
USE client_exit_action_block...

The server procedure looks like:
Import Views:
Export Views:
Local Views:

USE server_init_action_block ...
...
...
USE server_exit_action_block...

The client_init_action_block contains code as follows:
CASE of  exit_state_code
CASE 0
            Set exit_state as exit_state_a
CASE 1
            Set exit_state as exit_state_b
...
END CASE

The client_exit_action_block contains code as follows:
Move all import views to export views

The server_init_action_block contains code as follows:
Move all import views to export views

The server_exit_action_block contains code as follows:
CASE of exit_state
CASE exit_state_a
            Set exit_state_code to 0
CASE exit_state_b
            Set exit_state_code to 1
...
END CASE
Exit state is return_to_client

Note: return_to_client is the exit state to transfer control to the client from the server. If a rollback is to be done, then exit state is set to return_to_client_rb which has the rollback attached to it.

22) GEN, CA GEN, CoolGen server procedure related best practice




The Read action block fails to use the index even though the predicates in normal COBOL programs would have made use of the index.

Best Practice:
In spite of having separate Read action blocks for each read, the entity views in the RAB should contain the required attributes. If attributes other than those in index are to be accessed then, it is better to have separate entity views.
For eg: Assume table T1 has index I1, I2, I3 respectively and the attributes in I1, I2 and I3 are A1, A2 and A3 respectively. Then a Read  of the following type will be an Index read instead of an Index Only Read.:

Entity View: Entity T1 A1,
                                 A2,
                                A3
...
...
Read T1 where A1 = local view lcl_a1_value

The better way of coding this:

Entity View: Entity ent1_T1 A1,
                  Entity ent2_T1 A2,
                 Entity ent3_T1 A3.
...
...

Read ent_T1 where A1 = local view lcl_a1_value

21) GEN, CA GEN, CoolGen server procedure related best practice



In the server procedure sometimes the Read generates an extra predicate (which has not been coded as part of the read statement). Hence the index is not used even if one exists.

Best Practice:

Each Read is coded in open action block each. They are often called the Read Action Blocks (RAB). COOL:Gen generates the extra predicate whenever it is not sure whether the read is for an update or just a read only.

20) GEN, CA GEN, CoolGen server procedure related best practice



Use of Read Each for a batch program with restart logic, opens and closes the cursor repeatedly causing performance degradation

Best Practice:
Instead of invoking the program repeatedly, it is replaced by the following logic:
...
Set commit_count to 0
Set commit_freq to 10000
Read Each table (with cursor hold)
...
commit_count = commit_count + 1
If commit_count = commit_freq Then
            USE ext_commit_action_block
...
End Read Each
...

Note: ext_commit_action_block is an external action block, which contains only SQL statement: COMMIT.