Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 5 Using TIBCO Object Service Broker to Process Adabas Data : Taking Advantage of Adabas Features

Taking Advantage of Adabas Features
Two considerations take place when accessing data from Adabas:
You can tune several aspects of your application rules and tables to make accessing Adabas data more efficient. This section provides some suggested techniques for building efficient applications.
Understanding Descriptor Indexes
A descriptor index is built within the Adabas database to aid efficient access to data in Adabas. It enables access to the data in an order determined by a particular field, sub-component of a field, or a combination of multiple fields (descriptor, subdescriptor and superdescriptor).
Using the Adabas direct call interface, you can choose the access path that Adabas uses. In Natural, for example, you can tell Adabas to access by descriptor. You can also do this with this SDK; unfortunately this breaks the consistent interface to data that TIBCO Object Service Broker tries to provide across all data sources. An application written using these techniques can lose some of its portability across different data sources without code changes. That is, you can lose the ability to move your data from Adabas into TDS or another DBMS without affecting the application. Therefore, use this feature carefully.
If the data is moved to an RDMS from Adabas, it is unlikely that the logical or physical design of the database mirrors that of the Adabas file structure.
Data Reading
To access by descriptor index, the descriptor field in the table definition must be marked as a descriptor by setting the Des field to Y. The access statement in the TIBCO Object Service Broker rules should be in the form:
access_statement tablename WHERE descriptor_field >= ‘value
where:
This statement uses the greater than or equal to (>=) operator instead of just equal to (=). Although using equal to (=) is correct, greater than or equal to (>=) is more efficient since access to the Adabas table is with a direct Adabas L3 or L6 command, which reads data via the descriptor index that makes up the descriptor_field in the table definition. This requires the reading of only part of the index instead of the entire index. For this to occur, set the Des column for the descriptor field to a value of Y.
If you require more than one record, ensure that your rule has a means of ending the loop as soon as all required records have been returned. This can be done by calling a subsequent rule to do a check that issues a SIGNAL signal when all qualifying records have been received.
Drawbacks
There are two drawbacks to using descriptor indexes to read data:
The data is returned to the rule in the same order that it is retrieved from Adabas, which is different from the TIBCO Object Service Broker TDS, which retrieves the data in primary key sequence.
This is an open-ended request which implies that the processing should start at the point indicated by the WHERE statement, and end only at the end of the file. If this is the desired found set, this is not a problem. However, it is more likely that only part of this potential found set is actually required and processing should really end when a particular value is reached.
The higher-level rule containing the FORALL should either have an ON signal... exception or the access statement should take the form FORALL.....UNTIL signal. The examples below show a combination of rules for narrowing access by descriptor.
When the value of FIELD1 changes, the loop terminates and processing continues at the next rules statement.

 
RULE EDITOR ===>
ADATEST
_
_ ---------------------------------------------------------
_ ---------------------------------------------------------
_ FORALL TABLEA WHERE FIELD1 >= ABCD UNTIL END_OF_DATA:
_ CALL TEST_FOR_END;
_ CALL PROCESS_TABLEA;
_ END;
_ ---------------------------------------------------------

 
 
RULE EDITOR ===>
TEST_FOR_END;
_
_ ---------------------------------------------------------
_ TABLEA.FIELD1 > 'ABCD'; | Y N
_ ----------------------------------------------------+----
_ SIGNAL END_OF_DATA; | 1

 
Compensation for Performance Degradation
Using descriptor indexes can slow the performance since TIBCO Object Service Broker tries to balance two factors when getting the external data. TIBCO Object Service Broker compensates by reducing either of the following:
This reduction is achieved by sending a request for data with the response being a block of data from the external database. The maximum size of the data in this block is approximately 3.9 KB. As a result, one message in response to the TIBCO Object Service Broker rules code can contain many rows of data.
In the previous example, more rows could have been read from Adabas than required. To be efficient as possible, you are provided with the option of predefining the number of rows that are returned in response to TIBCO Object Service Broker rules code.
Using the SERVER=>EE Block field to limit the number of occurrences accessed in one case can have a detrimental effect on other accesses to that ADA table by increasing the overhead of the message traffic. Refer to Specifying ADA Table Header Fields for the description of the SERVER=>EE Block field.
Defining Effective ADA Tables
Follow these recommendations to create well designed ADA tables:
If you select all the fields in a periodic group and none of them are descriptors, set the MU/Special Field in Grp field to N. This optimizes the processing of the Adabas commands issued.
For all Adabas fields of format A (Alphanumeric) that contain only uppercase data and no significant trailing blanks, set the Syn field for both external field syntax (default X) and the TIBCO Object Service Broker (Metadata Definition) syntax (default V) for the field to C (character).
This simplifies data access in coding the rules and is also useful for descriptors, superdescriptors, or subdescriptors.
Use TIBCO Object Service Broker syntax P rather than B for Adabas fields defined externally as syntax P. Also ensure that the lengths are the same.
Although TIBCO Object Service Broker can store an Adabas P5 data value to a TIBCO Object Service Broker B4 field, you can avoid the unnecessary conversion overhead on each record retrieved by using identical syntax on both sides of the field definition.
Set the Occurs/Read (occurrences per read) field (default 5) to the most appropriate value for your data.
This field determines how many occurrences of a repeating data structure are asked of Adabas for in a single access. If you know that there are always 12 occurrences, set the value to 12, if always 3, set it to 3. If you are uncertain whether there are more often 12 or 10, set it to 12. It is better to overestimate, in order to minimize the number of accesses to the file.
Coding Efficient Adabas Accesses
In general, an efficient data-access design via Natural is also efficient in TIBCO Object Service Broker, since both generate direct calls and send them to Adabas for resolution. Although both can optionally do some additional evaluation of the found set returned from Adabas, it is more efficient in both cases for Adabas to do the work wherever possible. This is especially true for sorting returned items and is true of virtually all databases.
Except for accesses using the equality (=) operator, a search (for example greater than or equal to (>=)) can trigger a long running request. To avoid this, you should always consider including an UNTIL clause in the FORALL statement to end the search and stop issuing requests to Adabas.
Preserving Data Sequence in FORALL Statements
When data sequence is important, code FORALL statements appropriately. It is possible that the same FORALL statement, retrieving the same number of similarly structured rows from either Adabas or TDS using the same table definition, returns the data in a different sequence from each database. This occurs because Adabas returns data in descriptor index sequence, if the search expression uses one, whereas the same search on TDS returns data in primary-key sequence, which is the ISN in the case of Adabas.
This usually does not matter, as long as the same set of records is returned; normally the same operations are carried out on all records retrieved. However, if the record sequence is important, there are two possible solutions:
Insert a condition at the top of the rule to determine (based on the value of the LOCATION parameter for the table) whether for each execution of the rule the access should be to local TDS or remote Adabas data. Replicate the FORALL loop and add an ORDERED clause to the one to be used to access TDS.
Define the field to be used for access as a secondary index on the TDS table, so that the behavior matches that found in the Adabas access.
Using LIKE and NOT EQUAL with Other Operators
Use the TIBCO Object Service Broker Partial Match LIKE operator and the NOT EQUAL (¬= or NOT =) operator only in combination with other operators. There is no direct command equivalent to these operators in Adabas, so using them alone forces a full sweep of all records in the file to satisfy the request. Using them with additional arguments enables Adabas to return a much smaller found set to TIBCO Object Service Broker.
For example:
FORALL CLIENTS WHERE LNAME NOT EQUAL 'Smith' AND AreaCode='905'
or
FORALL CLIENTS WHERE LNAME LIKE 'Mac*' AND AreaCode='905'
The equality (=) operator is applied first to retrieve each occurrence with AreaCode equal to 905 and then the NOT operator is applied before the data is passed on to the Execution Environment.
Reducing CPU Consumption
The only area in which consumption of CPU can be affected is in the table definition. Use the following techniques in your TIBCO Object Service Broker tables to optimize system performance:
Avoid defining a single table consisting of a large number of fields. It is better to define a number of small tables rather than one larger one. This can help avoid unnecessary processing overhead and additional fields can easily be added at any time as required.
Define only the fields that are required in the ADA table definition. This reduces the work to be done to access, process, and convert the required fields and increase the number of occurrences contained in a given message, reducing the communications overhead.
Ensure that the external field definitions and the TIBCO Object Service Broker field definitions specify identical syntax. It is better to have Adabas perform data conversion, since it must convert from its internal storage format to the predefined external format anyway.
Understanding Adabas Direct Calls Generated from TIBCO Object Service Broker
 
FORALL TABLE WHERE FIELD >= value AND FIELD <= value

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved