How to specify use of field-level sensitivity in the DBD and PSB

An application program's view of data is defined through the PSBGEN utility using SENFLD statements following the SENSEG statement.

In the SENFLD statement, the NAME= parameter identifies a field that was defined in the segment through the DBDGEN utility. The SENFLD statement is not supported by Fast Path secondary indexing.

The START= parameter defines the starting location of the field in the application program's I/O area. In the I/O area, fields do not need to be located in any particular order, nor must they be contiguous. The end of the segment in the I/O area is defined by the end of the right most field. All segments using field-level sensitivity appear fixed in length in the I/O area. The length is determined by the sum of the lengths of fields on SENFLD statements associated with a SENSEG statement.

The following figure shows an example of field-level sensitivity. After the figure is information about coding field-level sensitivity.

Field-level sensitivity is used below to reposition three fields from a physical segment in the application program's I/O area.

Figure 1. DBD and PSB coding for field-level sensitivity
Physical segment has fields EMPNO, EMPNAME, BIRTHD, SAL, and ADDRESS. In I/O area, fields are EMPNAME, EMPNO, and ADDRESS.

The following code shows the DBD example for field-level sensitivity shown in the figure above.

SEGM  NAME=EMPREC,BYTES=100
 FIELD NAME=(EMPNO,SEQ),BYTES=5,START=1,TYPE=C
 FIELD NAME=EMPNAME,BYTES=20,START=6,TYPE=C
 FIELD NAME=BIRTHD,BYTES=6,START=26,TYPE=C
 FIELD NAME=SAL,BYTES=3,START=32,TYPE=P
 FIELD NAME=ADDRESS,BYTES=60,START=41,TYPE=C

The following code shows the PSB for the preceding figure.

SENSEG NAME=EMPREC,PROCOPT=A
 SENFLD NAME=EMPNAME,START=1,REPL=N
 SENFLD NAME=EMPNO,START=25
 SENFLD NAME=ADDRESS,START=35,REPL=Y

A SENFLD statement is coded for each field that can appear in the I/O area. A maximum of 255 SENFLD statements can be coded for each SENSEG statement, with a limit of 10000 SENFLD statements for a single PSB.

The optional REPL= parameter on the SENFLD statement indicates whether replace operations are allowed on the field. In the figure, replace is not allowed for EMPNAME but is allowed for EMPNO and ADDRESS. If REPL= is not coded on a SENFLD statement, the default is REPL=Y.

The TYPE= parameter on FIELD statements in the DBD is used to determine fill values on insert operations.