Archive for July 26, 2012

2E and Commitment Control

What is Commitment Control?

Commitment control is a function that ensures data integrity. It defines and processes a group of changes to resources, such as database files or tables, as a transaction.

Commitment control ensures that either the entire group of individual changes occur on all systems that participate or that none of the changes occur. IBM® DB2 Universal Database™ for iSeries™ uses the commitment control function to commit and rollback database transactions that are running with an isolation level other than *NONE (No Commit).

You can use commitment control to design an application so that the system can restart the application if a job, an activation group within a job, or the system ends abnormally. With commitment control, you can have assurance that when the application starts again, no partial updates are in the database due to incomplete transactions from a prior failure.

A program that implements the function runs under i OS Commitment Control and, if so, whether it contains the main commit points. i OS commitment control provides a means of automatically grouping a number of database updates into a single transaction for the purposes of recovery: either all or none of the updates take place.

Commitment control ensures that either the entire group of individual changes occurs on all systems that participate or that none of the changes occur.

The *COMMIT built-in function enables you to add your own commit points to a program that is executing under IBMi commitment control. Commitment control is a method of grouping database file operations that allow the processing of a database change to be either fully processed (COMMIT) or fully removed (ROLLBACK).

Implementing Commitment Control in 2E

CA 2E implements the *COMMIT built-in function as an RPG COMMIT statement, and as a COBOL COMMIT statement.

There are two types of functions used in Commitment Control.

The Master function. This function is an external function defined with the function Option:Commit control = M.  The master function is a parent function of a transaction.  It is used to define the beginning and ending of the transaction.

The Slave function. This function is an external function that is contained within the transaction.  It is defined by the function Option: Commit control = S.  The Slave is part of a transaction controlled the the parent Master function.

Using Commitment Control in CA 2E

  1. Setup files with jounaling to use Commitment Control.
  2. Start with a Master.
  3. Enter a *commit at beginning of transaction.
  4. Enter a *commit at end of transaction.
  5. Enter *rollback if transaction fails.
  6. Master can contain multiple slave functions.
  7. Slaves cannot exist in a transaction without a master.

CA2E/Synon Interview Series: Question 4

What are the available contexts that you will find in an edit record and what are different contexts used for in the edit record? 

Need more? CM First offers technical training on CA 2E / Synon in a variety of delivery channels – onsite, at one of our offices, or via distance learning.

2E Service Program

What is a Service Program?

An ILE Service Program in CA 2E / Synon is similar to a regular program.  Before we look at what a Service Program is like in CA 2E / Synon we must learn what a Service Program is on the IBMi.   It is an executable object on the IBMi.  The Service program contains procedures that you can run, with some exceptions.

  1. A Service Program has many points of entry, that is one entry point for each subproceedure.
  2. You cannot call a Service Program from the command line, it must be called from code in another program.
  3. A Service Program cannot be called with a Call command.  It must be called the same way you call another sub procedure.
  4. Service Program calls are much faster then calling external programs using a “call” statement.
  5. Can be considered a container for one or more modules.

CA 2E Service Program Design

A Service program is the function type “*SRVPGM”. You can work with a Service Program in 2E in the same way you work with other function types.  However, a Service Program has no parameters and no action diagram.   Instead, it has a source member associated with it, just like a user function.

Once the Service Program is created, the developer is able to attached modules to the services program.  CA 2E / Synon has a series of screens that are used to attach modules.

Finally, a developer can generate the Service Program like any other function.  When this occurs, the source member is created with includes both the export list as well as the necessary preprocessor directives needed for proper implementation of the Service Program.

CA 2E Service Program Overview

  1. An external function can be given the attribute of MOD instead of PGM.
  2. MOD functions are automatically added to the 2E model binding directory.
  3. The default compile command for ILE uses the default 2E binding directory.
  4. Call to the MOD function are generated as call bound instead of call commands.

Service Program Compile

When you compile a Service program in 2E the program is generated in QSRVSRC of the generation library.  This source member contains both the export list associated with the *SRVPGM object, as well as several compile preprocessor directives which will be used by the CA 2E / Synon Toolkit to actually create the *SRVPGM object.

  1. The actual CRTSRVPGM command, specifying the bound modules and also specifying the same source member as the export list definition member.
  2. the ADDBNDDIRE command, can be used to add the*SRVPGM object to the YBNDDIR binding directory.
  3. Multiple RMVBNDDIRE commands (one for each 2E module bound into the Service P), to remove that module from the YBNDDIR binding directory.
  4. When you compile a Service Program function using the YSBMMDLCRT command, the 2E model generation/compile processing executes the YEXCOVR command against the source member. This command invokes the Toolkit compile preprocessor, which processes the compile directives in the source member.

(This information is taken from the 2E manual: “Building Applications”)

 
 
© 2013 CM First Group - All rights reserved