Generally the user does not operate directly at the physical data base level but rather on an External View of the data. A particular user’s external view consists of a collection of Logical databases where each logical data base is a subset of corresponding physical database. Each logical database is defined, together with its mapping to the corresponding physical database, by means of Program Communication Block (PCB).
The set of all PCBs for one user, corresponding to the external schema plus the associated mapping definition, is called a Program Specification Block (PSB).
Although each application program can have its own PSB, it is not uncommon for application programs that have similar database processing requirements to share a PSB.
The data base administrator codes a job stream to assemble and link the macro instructions that specify an application program’s view of one or more data base. The resulting load module is stored in a partitioned data set. (IMS.PSBLIB)
PRINT NOGEN PCB TYPE=DB,DBDNAME=CUSTDBD,KEYLEN=30,PROCOPT=L SENSEG NAME=CUSTOMER SENSEG NAME=SHIPTO,PARENT=CUSTOMER SENSEG NAME=RECVABLE,PARENT=SHIPTO SENSEG NAME=PAYMENT,PARENT=RECVABLE PSBGEN PSBNAME=CUSTPSB,LANG=COBOL END |
The first statement in PSBGEN is PCB statement. It begins the coding for one program communication block. It specifies the type of PCB defined, in this case a data base PCB. The PCB statement also gives the name of the DBD that defines the segments named in the PCB. A PSB can only identify segments that have already been defined in the DBD.
The PROCOPT operand is optional. A PROCOPT parameter specifies Processing Options that define the type of processing that can be performed on a segment. In the above example L indicates that the program can perform only load operations. Other possible values are retrieve (G), insert (I), replace (R), and delete (D); any or all of G, I, R, D may be specified in any order.
If PROCOPT is specified in both the PCB statement and in SENSEG statement, the SENSEG entry overrides the PCB entry. However, there is only one entry, L which may be specified only in the PCB statement and which cannot be overridden. Also, there is one entry, K (Key Sensitivity), which may be specified only in the SENSEG statement. Key sensitivity is used when the designer of the PCB is forced by the hierarchical structure of the underlying physical database to include a segment that the user of the PCB does not really require (or perhaps is not allowed to access).
Following the PCB statement is a series of SENSEG statements. SENSEG statements identify the segments in the CUSTOMER database that this application is sensitive to. The first operand in each SENSEG statement is the NAME operand. The name coded here must be the same as the name coded in the NAME operand in SEGM statement in a DBD that defines the database.
In the above PSB example, the program is sensitive to all the fields defined in each of the segments named in SENSEG statements. The data retrieved will appear in the application program I/O area just as it is stored in the data base.
Within the sensitive segments, some specific fields can be identified as sensitive fields. When the program accesses that segment, only the sensitive fields are retrieved. This is called the Field level sensitivity. Example shown below shows a PCB that specifies field-level sensitivity for three fields in RECVABLE segment.
PRINT NOGEN PCB TYPE=DB,DBDNAME=CUSTDBD SENSEG NAME=CUSTOMER,PARENT=0,PROCOPT=K SENSEG NAME=SHIPTO,PARENT=CUSTOMER,PROCOPT=K SENSEG NAME=RECVABLE,PARENT=SHIPTO,PROCOPT=K SENFLD NAME=RSINVNUM,START=1 SENFLD NAME=RSPONUM,START=7 SENFLD NAME=RFREIGHT,START=32 SENFLD NAME=RSINDATE,START=36 SENSEG NAME=PAYMENT,PARENT=RECVABLE PSBGEN PSBNAME=CUSTPSB,LANG=COBOL END |
The SENFLD statements following the SENSEG statement, names the specific fields from the RECVABLE segment that should be passed to the application program. The START parameters in each SENFLD statement specify where in the I/O are each field should be placed.
SENFLD statements can be used to create a view of a particular segment that is quite different from the way the segment’s data is actually stored in the database. This is often useful where a segment’s physical format must be changed and where existing application programs must continue to be used.
The field-level sensitivity feature provides an example of how IMS allows programs to be independent of the physical format of the data it accesses. One restriction with field-level sensitivity is that the fields specified in SENFLD statements are limited to those fields that are identified in DBD FIELD statements.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!