Mapping ADABAS Structures in the Master File

For the ADABAS Interface to access ADABAS files, you must describe each ADABAS file you use in a Master and Access File. The logical description of an ADABAS file is stored in a Master File, which describes the field layout.

Standard Master File attributes are generally used to describe ADABAS files, but there are concepts in ADABAS file processing that require special terminology at the field and segment level.

An Access File describes the physical attributes of the ADABAS file, such as the database number, file number, descriptors, and security. See Describing ADABAS Files to FOCUS, for more information about Master and Access Files.

The preferred way to create Master and Access Files is to use the AUTOADBS facility described in The AUTOADBS Facility. For additional information about describing external files to FOCUS, refer to the FOCUS for IBM Mainframe User's Manual.


Top of page

ADABAS Concepts in FOCUS Terminology

FOCUS uses a non-procedural language to create reports, graphs, and extract files. It also enables you to access data files without knowing the details of the file structure or access method.

FOCUS treats any data file as either a single-path or multi-path hierarchy. Graphically, information is laid out using an inverted tree structure, as in the following sample STAFF file. In the example, the letter I to the right of a field indicates an indexed field.

The most general information appears at the top, and the more specific information appears under it. Each box in the structure is referred to as a segment. A database can consist of one or more logically related segments from a FOCUS point of view.

When logically related information is retrieved using this database structure, multiple occurrences of each segment are created. Each occurrence of a segment is called a segment instance. Each ADABAS database is equivalent to a collection of logically related segment instances.

The retrieval sequence of the segments is determined by the view of the structure, that is, the order of the segments from top to bottom, left to right. The segment at the top is the parent, or root, segment. The segments under the parent are the child, or descendant, segments.

Generally, parent and child segments have a one-to-many relationship; that is, a single parent has multiple occurrences of one child segment. However, FOCUS also handles one parent-one instance only of a child segment.

ADABAS uses specific concepts and techniques for organizing data. It holds data in logically distinct files that are interrelated using fields that share common formats and values called descriptors.

Within a single ADABAS file, records that contain multiple occurrences of a field can vary in length and format. The following example illustrates an ADABAS structure containing four separate files that are linked by common fields:

Many ADABAS structures are more complex than the preceding example. The following sections illustrate the mapping of typical ADABAS structures to FOCUS.


Top of page

ADABAS Descriptors

Descriptors are fields, partial fields, or groups of complete and partial fields used by ADABAS to select records in a file. ADABAS descriptors correspond to indexed fields in FOCUS.

There are three types of descriptors supported by the ADABAS Interface:

All three types of descriptors are collectively referred to as "descriptors."

Consider the ADABAS FDT for the STAFF file:

                          STAFF FILE FDT
        FIELD DESCRIPTION (from FDT)           FIELD NAME (from DDM)
           01, ES, 08, P, NU, DE               SOC_SEC_NUM
           01, EI, 06, A, NU, DE               EMPLOYEE_ID
           01, EJ, 03, A, DE                   CURRENT_JOB
           01, EN, 24, A                       NAME

Notice that SOC_SEC_NUM, EMPLOYEE_ID, and CURRENT_JOB are labeled as descriptors. Any one of these three fields can be used to search the STAFF file.

ADABAS descriptors, superdescriptors, and subdescriptors must be declared in FOCUS Master and Access Files in certain ways:

See Describing ADABAS Files to FOCUS, for more information about declaring a descriptor, superdescriptor, and subdescriptor to FOCUS.


Top of page

ADABAS Record Lengths

ADABAS uses files with both fixed-length and variable-length records. FOCUS, in turn, treats the different types of files in different ways. The following sections describe the differences between the two types of files.


Top of page

ADABAS Files With Fixed-length Records

Unless an ADABAS file has multi-value fields or periodic groups, each field occurs once in each record. When describing an ADABAS file, you do not need to describe all the fields in your FOCUS Master File, just the fields you use. Note that if you choose a periodic group, all fields in the periodic group must be defined. A single simple ADABAS file maps to a single FOCUS segment, and each field you use in the ADABAS file becomes a field in the FOCUS segment.

ADABAS RECORD

FOCUS SEGMENT

DB

Name ( in DDM)

Fieldname

Alias

ES
EI
EJ
EN
SOC_SEC_NUM
EMPLOYEE_ID
CURRENT_JOB
NAME
SOC_SEC_NUM
EMPLOYEE_ID
CURRENT_JOB
NAME
ES
EI
EJ
EN


Top of page

ADABAS Files With Variable-length Records and Repeating Fields

There are two types of ADABAS repeating fields:

An MU field is a single field that occurs a variable number of times in a record. It appears as type MU in an ADABAS record description. ADABAS supports up to 191 occurrences of this type of field per record.

A PE group is a group of contiguous fields that occur a variable number of times in a single record. It appears as type PE in an ADABAS record description. Up to 191 occurrences per record are supported by ADABAS. These component fields are regular fields or MU fields. Describing MU fields within PE groups is discussed in detail in Describing ADABAS Files to FOCUS.

Note: The ADABAS Interface supports the maximum number of occurrences of MU fields and PE groups allowed by Software AG.

When an ADABAS file contains MU fields or PE groups, the repeating information occurs a variable number of times. The physical record length varies depending on how many times the repeating information actually appears.

In FOCUS, more than one segment is needed to accurately describe an ADABAS file with repeating data. The number of times the fields repeat is expressed in a counter field. Counter fields are discussed in The AUTOADBS Facility.

The OCCURS segment attribute is used by FOCUS to describe MU and PE field types in a FOCUS Master File. Declaring a repeating field in a FOCUS Master File using the OCCURS attribute is discussed in detail in Describing ADABAS Files to FOCUS.

Consider the sample ADABAS file VEHICLES. The FDT for the VEHICLES file is shown below.

*********************************
* FILE 2 (VEHICLES ) *
*********************************
FIELD DESCRIPTION TABLE
      I      I        I        I              I                         I
LEVEL I NAME I LENGTH I FORMAT I OPTIONS I PARENT OF I
I I I I I I
------I------I--------I--------I--------------I-------------------------I
I I I I I I
1 I AA I 15 I A I DE,UQ,NU I I
1 I AB I 4 I F I FI I I
1 I AC I 8 I A I DE I I
1 I CD I I I I I
2 I AD I 20 I A I DE,NU I SUPERDE I
2 I AE I 20 I A I NU I I
2 I AF I 10 I A I DE,NU I I
1 I AG I 2 I U I NU I SUPERDE I
  1   I  AH  I    1   I    A   I DE,FI        I                         I
1 I AI I 1 I A I FI I I
1 I AJ I 6 I U I NU I SUPERDE I
1 I AK I I I I I
2 I AL I 3 I A I NU I I
2 I AM I 4 I P I MU,NU I I
I I I I I I
-------------------------------------------------------------------------
SPECIAL DESCRIPTOR TABLE
I I I I I I
TYPE I NAME I LENGTH I FORMAT I OPTIONS I STRUCTURE I
I I I I I I
-------I------I--------I--------I----------------I----------------I
I I I I I
SUPER I AN I 4 I B I DE,NU I AJ ( 5 - 6) I
I I I I I AJ ( 3 - 4) I
SUPER I AO I 22 I A I DE,NU I AG ( 1 - 2) I
I I I I I AD ( 1 - 20) I
I I I I I I
-------------------------------------------------------------------

The MU field, MAINT_COST, is a field in VEHICLES. It is allocated to a new segment, AM0101, required by the Interface, as shown in the Master File for a partial view of the VEHICLES file, illustrating the use of OCCURS=occursname:

$$$ CREATED BY AUTOADBS ON 12/10/97 AT 10.17.27 BY PMSMJB
FILENAME=ADACAR,SUFFIX=ADBSINX,$
$ ADABAS FILE = VEHICLES-FILE DICTIONARY = 6
SEGNAME=S01 ,SEGTYPE=S,$
FIELD= REG_NUM ,ALIAS= AA ,A15 ,A15 , INDEX=I,$
FIELD= CHASSIS_NUM ,ALIAS= AB ,I9 ,I4 ,$
FIELD= PERSONNEL_ID ,ALIAS= AC ,A8 ,A8 , INDEX=I,$
FIELD= CLASS ,ALIAS= AH ,A1 ,A1 , INDEX=I,$
FIELD= LEASE_PUR ,ALIAS= AI ,A1 ,A1 ,$
FIELD= DATE_ACQ ,ALIAS= AJ ,P6 ,Z6 ,$
$GRMU = CAR_MAINTENANCE ,ALIAS= AK ,A11 ,A7 ,$
FIELD= CURR_CODE ,ALIAS= AL ,A3 ,A3 ,$
FIELD= MAINT_COST_CNT ,ALIAS= AMC ,I4 ,I2 ,$
FIELD= DAT_ACQ_DESC ,ALIAS= AN ,A4 ,A4 , INDEX=I,$
GROUP= MODEL_YEAR_MAKE ,ALIAS= AO ,A28 ,A22 , INDEX=I,$
FIELD=YEAR_S02 ,ALIAS= AG ,P2 ,Z2 ,$
FIELD=MAKE_S02 ,ALIAS= AD ,A20 ,A20 , INDEX=I,$
SEGNAME=AM0101 ,SEGTYPE=S,PARENT=S01 ,OCCURS=AMC,$ MAX= 60
FIELD= MAINT_COST ,ALIAS= AM ,P7 ,P4 ,$
FIELD= AM0101_OCC ,ALIAS= ORDER ,I4 ,I2 ,$

In the original segment, the MAINT_COST_CNT (ALIAS=AMC) field contains the total number of occurrences of the MAINT_COST field. The new segment, AM0101, contains the MAINT_COST data field and the newly created AM0101_OCC field. The AM0101_OCC field contains the position of each occurrence.

This example includes the group field called CAR_MAINTENANCE, which contains the MU field, MAINT_COST. AUTOADBS comments out the group field with $GRMU because its length is variable (depending on the number of occurrences of the MU field). FOCUS cannot report on a group with an unknown length. However, the component fields can be referenced for reporting purposes.

Note: The AUTOADBS facility would automatically create the new segment, AM0101, for you. Otherwise, you must create the new segment using the OCCURS segment attribute. See Describing ADABAS Files to FOCUS, for more information about describing multi-value fields with the OCCURS attribute.

The following is the Access File for the VEHICLES file:

 $$$ CREATED BY AUTOADBS ON 12/10/97 AT 10.17.27 BY PMSMJB
$$$ FILENAME=ADACAR,SUFFIX=ADBSINX,$
RELEASE=6,OPEN=YES,$
$ ADABAS FILE = VEHICLES-FILE                     DICTIONARY = 6
SEGNAM=S01 ,ACCESS=ADBS,FILENO=002,
CALLTYPE=RL,SEQFIELD=PERSONNEL_ID,$
FIELD= DAT_ACQ_DESC ,TYPE=NOP,$
FIELD= MODEL_YEAR_MAKE ,TYPE=SPR,$
FIELD=YEAR_S02 ,TYPE= ,NU=YES,$
FIELD=MAKE_S02 ,TYPE=DSC,NU=YES,$
SEGNAM=AM0101,ACCESS=MU ,FILENO=002,$ MAINT_COST

A new segment is created for the MU field. Note that for this new segment, ACCESS=MU.

Here is an example of the counter fields. The AMC field contains the total count of occurrences, the AM field contains the actual data, and the ORDER field contains the position of each occurrence.

     (AMC)          (AM)        (ORDER)
MAINT_COST_CNT MAINT_COST AM0101_OCC
-------------- ---------- ----------
1 520 1
----------------------------------------
1 210 1
----------------------------------------
4 44 1
4 322 2
4 66 3
4 188 4
----------------------------------------
6 324 1
6 1103 2
6 566 3
6 755 4
6 988 5
6 1899 6
----------------------------------------
2 344 1
2 500 2

In some cases, the ORDER field may describe the months of the year (1-12). If all occurrences for the month of June are needed, for example, you would print data in which the ORDER field is equal to 6 (for June).

Using the preceding sample data, here is an example of how to use the ORDER field; this request always selects the sixth occurrence of maintenance costs:

TABLE FILE VEHICLES
PRINT MAINT_COST
WHERE AM0101_OCC EQ 6
END
MAINT_COST
----------
1899

Using the same data, this request always selects the second occurrence of maintenance costs:

TABLE FILE VEHICLES
PRINT MAINT_COST
WHERE AM0101_OCC EQ 2
END
MAINT_COST
----------
322
1103
500


Information Builders