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.

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.

19) GEN, CA GEN, CoolGen testing related best practice




During stress testing, very active tables and its associated children undergo deadlocks and timeouts. (Note: dsg_sequence_no is the primary index which has running sequence numbers as its value. The primary index was on the descending sequence to avoid a sort when getting the maximum dsg_sequence_no)

Best Practice:  

The following three design changes to the application:
1.     Create a primary index with dsg_sequence_no in ascending sequence
2.     Define the subpage parameter as 1 rather than 16
3.     Introduce a dummy column at the end of the table as X(250). Drop the primary index and recreate it with dsg_sequence_no and the dummy column.

The advantage of these suggestions are:
1.     Ascending sequence will avoid unnecessary reordering of the index whenever new records are created.
2.     Redefinition of Subpage to 1 will avoid subpage splitting altogether during creation
3.     Making the key size to be approximately 250 bytes ensures only less number of entries are available in each page. This will lessen the number of deadlocks/timeouts. Further all the 3 changes require no change to the application



18) GEN, CA GEN, Coolgen and design best practice




Use of a running sequence number as the primary key instead of a logical key gives rise to the following issues:
·       For new creations the access is always towards the end of the table
·       Contention in an multi-user environment for accessing the last sequence number

Best Practice:
1.   One solution is to a common table, which contains only two attributes: table name and last sequence number. Being a small table, this should resolve the contention problem to a great extent.
2.   Instead of creating the primary key ASIS, the key is inverted and created. This will resolve the creation of new records towards the end of the table.
For eg:
If the primary key is a 6-digit number, the new records are created as follows:
·       100000
·       200000
·       ...
·       900000
·       010000
·       110000
·       210000
·       ...

Note: One could also use a random number generator to create unique primary key. See a post to create a random number using program..

17) GEN, CA GEN data modelling best practice



Denormalization of tables whenever the access equals or exceeds three levels but can be avoided by having additional attributes.

Eg: To get attrib1 table T1 and attrib3 from table T3 the normal sequence would be:

Read T1 Where A1 = local view lcl_a1
When Successful
            Read T2 Where current view and
                        A2 = local view lcl_a2
            When Successful
                        Read T3 Where current view and
                                    A3 = local view lcl_a3
                        When Successful
                        ...
End Read

Instead by storing the extra attrib1 attribute in Table T3, these three reads can be avoided.


Note: There is of course the need to update this field as when the field is updated in table T1.

16) GEN, CA GEN, CoolGEN batch job related another best practice



The batch jobs of COOL:Gen even though they execute successfully, they return with a return code of 100. For unsuccessful executions, it displays the return code as given by the TP monitor.

Best Practice:
Instead of invoking the batch program as given below:
...
//SYSTSIN        DD       *
            DSN SYSTEM(DB2T)
            RUN PROGRAM(PROGA) PLAN(PROGA)
            END
/*

Execute it as follows:
..
//SYSPROC      DD       DSN=SYS2.COOLGEN.CLIST,DISP=SHR

...
//SYSTSIN        DD       *
            EXECDSN PROGA DB2T
/*

The contents of EXECDSN will look like:
/* Rexx */
Parse Upper Arg programname db2system .
"NEWSTACK"
Queue "RUN PROGRAM("programname") PLAN("programname")"
Queue "END"
"DSN SYSTEM("db2system")"
Coolgenrc = Rc
"DELSTACK"
If Coolgenrc = 100 Then
            Exit 0

Exit Coolgenrc

15) GEN, CA GEN, CoolGEN batch job related best practice


GEN, CA GEN, CoolGEN batch job related best practice

If a batch step due to its logic doesn’t write even a single record to the output file created in the same step, and a subsequent step has a read from this file. The read fails with an abend.

Best Practice:
The abend occurs because the EOF marker is not set if the file is not opened and closed for output. A dummy step is introduced in between these 2 steps, which will write the EOF marker if the file is empty. This is achieved as follows:
//STEP01          PGM=IKJEFT01
//FILE01            DD        DSN=SBBT02.NEW.FILE,DISP=(,CATLG),…
//SYSTSIN        DD        *
            EXECDSN progname db2system
/*
//STEP03          PGM=IKJEFT01
//FILE01            DD        DSN=SBBT02.NEW.FILE,DISP=SHR
//SYSTSIN        DD        *
            EXECDSN progname db2system
/*

Instead add the following step in between the two steps:
//STEP01          PGM=IKJEFT01
//FILE01            DD        DSN=SBBT02.NEW.FILE,DISP=(,CATLG),…
//SYSTSIN        DD        *
            EXECDSN progname db2system
/*
//STEP02          PGM=IKJEFT01
//SYSPROC      DD        DSN=SYS2.COOLGEN.CLIST,DISP=SHR
//FILE01           DD        DSN=SBBT02.NEW.FILE,DISP=SHR
//SYSTSIN        DD        *
            EMPTYFLE
/*
//STEP03          PGM=IKJEFT01
//FILE01            DD        DSN=SBBT02.NEW.FILE,DISP=SHR
//SYSTSIN        DD        *
            EXECDSN progname db2system
/*

The logic in the REXX program would contain logic like this:

/* Rexx */
“NEWSTACK”
“EXECIO * DISKR FILE01 (FINIS”
Queue “”
“EXECIO * DISKW FILE01 (FINIS”
“DELSTACK”

Exit

14) CA GEN, CoolGEN and testing best practice

CA GEN, COOLGEN and testing best practice During testing normally there is a need to run monthly jobs, yearly jobs and jobs tied to some specific dates. This kind of testing is called date simulation. Best Practice: The date simulation can be brought about in two different ways: 1. For the client the system date can be set to the required date in the individual clients 2. For the server, the date exit routine TIRDATC/TIRDATX can be written in assembly to accept the date from a file. The input file can be updated to the required date before executing the job.

13) Gen, CA-GEN, COOLGEN and DB2 related issues

GEN and DB2 Related issues The SQL generated by CA GEN, COOL:Gen is not always the best and in most cases there is an need for the following: • Creation of new index • Rewrite the READ action block to access existing indexes • Change table/index parameters • Need for partitioned tables Best Practice: Once the servers are ready for execution, the bind for the plans are done with EXPLAIN option. Each and every SQL is scanned for the following: • Does it result in a join, if so can it be avoided • Does it use an existing index, if not how to influence the SQL to make use of it • Would creation of an index improve the performance • Change of parameters (for eg: for batch jobs executing without any overlap, the lock can be escalated to table level and combined with appropriate acquire and release parameters in the bind step the performance can be improved).

12) What are the different CA Gen, aka COOLGEN services when in component based environment ?



Below is just an example. Your client side may have different architecture. Using these component services a transaction is built. And the whole development code is isolated from each other and have a specific purpose. Example - D service will have all the reads, create, update, delete statements on entities. So during maintenance it needs to be touched only if affected database is changed.

Types -

H Service  - Test Harness. To test the transaction

I Service - Interface. It is a Public Operation – the interface to the service

M Service - Private Operation Manager – the director or traffic cop

C Service - Contains isolated logic. e.g. editing of  imports or doing calculations, client side

T Service - Translator: Transient view to Persistent view

D Service - Data Access – goes against the database

P Service - Translator: Persistent view to Transient view

X Service - External Wrapper – an EAB that interfaces with an existing program

S Service - Error Processor – translates Exit States to Return Codes

11) Syllabus topic # 3 : Modifying Existing Objects

Detailed study items on syllabus topic # 3 : Modifying existing objects

What information to be provided for entities?
  Name
  Description
  At least one attribute
  Primary identifier
  Occurrences
  TD physical name

What information to be provided for relationships?
  Relationship properties
  Source properties
   Target properties

What information to be provided for attributes?
   Name
   Domain
   Optionality
   Description
   TD name
 
Attributes may have permitted values
Attributes may be derived.

10) Syllabus topic # 2 : Modeling New Objects


Detailed study items on syllabus topic # 2 : Modeling New Objects


Modeling new objects
Creating new model
Model name
Local name
Settings multiple or single add
Consistency check level settings
TD name options
Data model tools
Adding subject areas
Adding Entities
Adding Relationships
Adding Attributes

09) Syllabus topic # 1: Gen modeling overview

Detailed study items on syllabus topic # 1:

Gen modeling overview

What are the different names-
Attribute Names
Business names
TD names
Element name
Entity/table
Identifier/primary key and index
References, online help
Logical model
Physical Model
Why model is important



08) Syllabus - Data Modelling using Cool:Gen , CA Gen



Here is the very high level syllabus if you are interested in learning how to do data modeling. Lets look at them in details in next posts....


1- Gen modeling Overview
2- Modeling new objects
3- Modifying existing objects
4- Other Data analysis and modeling options
5- Consistency check
6- Plotting
7- Reports

06) Cool:Gen Client Server mode Features




Cool:Gen Client Server mode Features



  • Separate client procedures for data capture and validation
  • Separate server procedure for database handling
  • Screen/window based
  • Flows to be maintained between client and server for every Database action
  • Exceptions in database actions to be handled by means of Return Codes
  • Cooperative packaging to be done
  • Client with local installation
  • Server with remote installation
  • Workstation generation for client and server
  • Host installation for Server using Implementation Tool Set
  • Complete debugging possible for client
  • Direct debugging not possible for server (through CICS)
  • Need for Client manager, Communication bridge and Server manager




Design requirements :

1. Separate Client and Server Procedure steps.
2. Each Server Procedure Step has to be packaged (Cooperative Packaging) as a separate load module.
Resource Requirements :
1. Every client workstation has a IEF Client Manager.
2. IEF COMMUNICATIONS BRIDGE is needed for each workstation or on a communications server on the network.
3. IEF SERVER MANAGER installed on the host server machine


    05) Cool:Gen Batch mode Features





    3) Cool:Gen Batch mode Features



    • No separate client and server procedures
    • No screen/window
    • For Mainframe applications
    • No flows/links allowed other than involute transfer
    • Procedures to be defined as NO DISPLAY
    • Embedded database action statements
    • May involve file handling using External Action Blocks
    • May need special Commit/Restart handling
    • Batch Packaging needs to be done
    • Host construction
    • Complete debugging facility during execution
    • Use of JCL for non-trace execution

    04) Cool:Gen Block mode Features




    Cool:Gen Block mode Features


    • No separate client and server components
    • Screen based (no events)
    • For mainframe applications
    • Embedded database action statements
    • Online packaging , TP monitor - IEFAE
    • Separate generation of screens
    • Facility for Host construction
    • Complete debugging facility during execution

    03) CoolGen with .Net




     What about .Net with Cool:Gen 

    .NET-based Web Services model describes the .NET standards for implementing Web Service applications that require access to distributed business logic and distributed or host data.

    It has four layers Presentation Layer, Workflow Layer, Business Logic / Rule Layer and (Core) Data Layer.


    The Presentation Layer is used for the user interface of the application. It receives data from the Workflow Layer and formats the information for display to the client device. This layer is also used for formatting the data submitted as input by a user to the Workflow Layer.


    The Workflow Layer is like a traffic police that routes/manages specific requests made by the Presentation Layer by invoking specific components provided by the Business and Data Layers.


    Business Logic / Rule Layer is where business type rules and data derivation is performed. Components in this layer are invoked from the Workflow Layer and optionally use data received from Data Layer components or from other Business Layer service components.


    The Data Layer handles all (core) data activities, including creating, reading, updating, and deleting records. It is the only layer that knows the physical properties/location of the data.

    Cool Gen Frequently Asked Interview Questions





    1) What happens when the subscript of a repeating group view set to zero?

    runtime error will occur.

    2) How to make the code(process) more efficient (performance wise)?
    1.  View matching should be perfect
    2.  Use small group views
    3.  View matching: same structure on both sides
    4.  Do not use EXPORT views in action blocks when not needed
    5.  Avoid if possible nested READ EACH
    6.  Use WHERE clause with READ and READ EACH actions otherwise
    DB2 will have to scan the entire table for returning the rows
    Avoid SORTED BY whenever possible

    3) How will you debug the online/batch IEF system?
    --Trace mode

    4) What are persistent views and what are their significance?.
    A view that supports entity actions and represents an entity occurrence.
     A persistent view may be an import, export, or entity action view.
    Once read, a persistent view may be passed to subordinate action blocks.
    This means that a procedure step can perform a READ and pass the persistent
    view to an action block that performs an UPDATE action.  The lock on the record
     is released at the end of the action block where it was READ.

    5) what is a Transient view?
    A view that represents a piece of data and can be modified by MOVE and
    SET actions.  A transient view may be an import, export, or local view.
      Contrasts with persistent view


    6) What are the types of views?

     Work view - To define an attribute like counters, subscript, which do not come From entity. To define an information which is needed by a process or a Procedure but which is not contained in any of the entities defined for the model.

    Group view - A collection of entity views, other group views, or both.
    Only group views can be identified as repeating.

    Local view - Information about an entity that is used completely within
    one execution of a process or procedure step. A local view is not exported
    or imported.

    Entity view - A selection of attributes from a single occurrence of an entity
    type or an entity subtype.

    Import view - A view through which a process, procedure step, or action block may receive information when it begins execution.  An import view can be a group view or an entity view.

    Export view - A view through which a process or procedure step may provide
    information when it ends execution.  An export view can be a group view, an
    entity view, or a work view.

    . Entity action view
    A specific type of information view that defines stored information created,
    used, updated, or deleted by a process or procedure.  It is an object of an
    entity action.  An entity action view is always an entity view; it cannot be a
    group view or a work view.

    7) Entity Action view can be a group view or  work view. (T/F)
    False

    8) What is a data model?
    Data model is a conceptual model of a business from a data perspective.
    Collection of subject areas, entity types, and relationships.
    Its an entity relationship diagram

    9) What is a Subject area?
    Its a collection of related entities which are used by at least one common
    function.

    10) Subset is a part of a model that a user wants to change on the workstation 
    toolset (T/F)
    True

    11) What is Checkin process?
    The process of transferring new and changed objects from the toolset back to
    the encyclopedia from which the model was checked out.  The Checkin process
     Updates the model on the encyclopedia with the changes made to the
    Model/subset while checked out. Checkin is performed from the toolset.
    If performed with the Update and Check In Model option, the model status
    is read only and no further updates can be made to the model.  If performed
    with the Update But Do not Checkin then message file needs to be downloaded


    12) What is Checkout process?
    The process of transferring a specified model or model subset from an
    Encyclopedia to the toolset.  Before a user can check out a model, that
    User must be granted access to the requested model by an administrator.

    13) What is Action Block
    Stand-alone action diagram.  It defines the logic of an algorithm or
    specifies logic that is common to many action diagrams.

    14) What is Action Diagram
    An ordered collection of actions. It defines the logic of an elementary
    process, procedure step, or action block

    15) What is Common Action Block (CAB)
    A common action block is used for common logic shared by elementary
    processes in Analysis or by procedures in Design.


    16) What is the use of External action blocks.
    External action blocks are necessary to access logic or databases created outside of Composer

    17) What is a use of consistency Check?
    A tool that applies a set of rules to a model, subset, or object to
    evaluate their Consistency and completeness.

    18 ) What is Dialog Flow?
    The transfer of control, and possibly data, between procedure steps
    in the same generated business system (internal flows) or
    between procedure steps in different business systems (external flows).

    19) What is Procedure Action Diagram  (PrAD)?
    The representation of the logic of a procedure in terms of the actions and
    the conditions constraining the actions
    Process logic analysis identifies actions to be performed on entities by an elementary  process. The actions produce output information based on input information.

    20) What is a difference between Link & Transfer?
    A transfer is a type of flow in which control and,
    optionally, data pass from one procedure step to another.
    In case of transfer the control does not come back. But in Link
    Control comes back to the source.

    21) What is Event Processing?
    Events are activities that occur during the execution of a GUI application,
    such as windows opening and closing, controls being clicked, and so forth.

    22) Describe event types:
    Each event action must be associated with one or more event types.
    The event type classifies an event as one that opens or closes dialog boxes,
    validates changed data, repopulates a scrollable list, or responds when
    an application user clicks or double clicks on an item.
    Additional event types can be added using the Window Design tool.
    Explain IEF-Supplied Event Types
    All event types supplied by Composer can be triggered when an application
    User directly affects a window or a control.  These event types include:

    • Open
    • Close
    • Changed
    • Clicked
    • double-click
    • ScrollTop
    • ScrollBottom

    23) What is Exit State
    A description of the outcome of a procedure step or process execution.
    A dialog flow takes place at the completion of a procedure step based on
     the setting(s) of one or more of a set of exit states.  Exit states can be
    associated with commands and, optionally, function keys.

    24) Explain  Data structure list / data store list?
    The Data Structure List (DSL) contains the physical model where logical objects are implemented. During Transformation, the COOL:Gen software builds a DSL and
    Data Store List (DOL) for the entire model. Transformation converts the logical
    data model (ERD containing entity types, attributes, identifiers, and
     relationships) into a physical model (DSL containing tables, columns, indexes,
     and constraints) for each business system. Transformation converts the DSL into
    a DBMS-specific DOL.

    25) What are View matching and view mapping?
    The means by which a Composer user maps views of the source
    (action diagrams) to the views of the destination (action block diagram).
      View matching ensures that the destination process or procedure has the
    data necessary to execute.  It maps the views of the action block to views
    in the source action diagram to communicate the results of the action block
    execution back to the source action diagram.
    Mapping is done in window.

    26) What is Work set.
    Data representations that do not create permanent storage.
    IEF supplied are like count, flag, total real but usually added by user.

    27) Explain Packaging?
    is the process of specifying the combination of procedure steps that compose the executable
    application. The procedure steps are included in files called load modules. Each load module becomes
    an executable file as a result of installation.
    Load Module Packaging:The process of defining how procedure steps should be grouped for maximum system efficiency during program execution.  The packaging definition identifies the procedure steps contained in each load module.  Packaging is performed in the Construction toolset.

    28) Difference betn batch and online?
    Batch Procedure:
    The implementation of one or more elementary processes used in a business system in a
    Batch environment.A batch environment doesnot have a screen.

    Online Procedure:
    A procedure that is executed through one or more screen interactions with the user.