bdfd1m1uDatabase Administration

Getting the Right Amount of Working Storage

The following scenario addresses getting the right amount of working storage.

Problem

An application using the TPFDF product requires working storage. This can be for TPFDF macros or functions, such as building LRECs, or for functions unrelated to the TPFDF product, such as saving application data.

Solution

Use TPFDF T-type files for working storage. The application can then use assembler or C language instructions to manipulate whatever working storage it needs without considering the amount of space available.

Each T-type DSECT describes one particular LREC. TPFDF macros and functions handle T-type DSECTs as if they were TPFDF LRECs.

You can add multiple T-type DSECTs, describing different LRECs, to a common file. This common file must be a W-type file using short-term pool records. The T-type LREC DSECT contains a reference to the underlying W-type file by using the &SW00REF symbol.

There are several advantages of using T-type and underlying W-type files for applications:

If a DBOPN macro is coded for the underlying W-type file in the TPFDF UF0B program, the application can directly add, read, and delete T-type LRECs without opening the file. If the DBOPN macro is not coded in UF0B, the application must open the W-type file. For better performance, use the DETAC parameter when opening the W-type file.

Note:
If there are storage constraints, do not use the DETAC parameter when opening the W-type file.

When the application performs a DBADD macro or dfadd function, the TPFDF product adds 11 bytes (containing the reference name of the T-type file plus the LREC size and primary key) to the beginning of the LREC. This LREC is then inserted into the W-type file.

Note:
The TPFDF product is shipped with one predefined W-type file (GW01SR) that is automatically opened in UF0B.

DSECT Set Symbols

      &SW00REF    SETC   'GW01SR'
      .
      .
      .
      .
      zzzzzFL1    DS     CL104          label1 (example)
      zzzzzFL2    DS     CL104          label2 (example)
      .
      .
      zzzzzEC0    EQU    *              (example)

GW01SR is a default W-type file included in the TPFDF product. Customers can use it or define multiple W-type files to be used with T-type files based on applications or packages.

DBDEF Statements

Not applicable.

Application Coding

      zzzzzz REG=reg
      DBADD REF=zzzzzz,NULLREC==AL2(#zzzzLC0),REG=reg
                     The #zzzzLC0 identifies the defined
                     length of a particular LREC defined in
                     the T-type DSECT.
 
      MVC  zzzzFL1(104),EBW000
                     save the EBW000-104 work area in the T-type LREC
      MVC  zzzzFL2(104),EBX000
                     save the EBX000-104 work area in the T-type LREC