bdfd1m1vDatabase Administration

Specifying a Display Order for LRECs

The following scenario addresses specifying a display order for LRECs.

Problem

You want to display LRECs from a TPFDF subfile. However, you want to display the LRECs in a different order from their order in the subfile. The DBDSP macro and dfdsp function can only display LRECs in the order in which they have been organized in the subfile.

Solution

Create a work file with a DSECT describing the order that you want. To do this, read the TPFDF file and add the data fields into LRECs in a W-type work file. The LRECs of the work file then represent the required display layout.

The final DBDSP macro or dfdsp function will display the file and release the work blocks.

If you need to display the data several times, use an R-type file as the intermediate file for storing the data between displays. An R-type file can use short-term or long-term pool blocks.

DSECT Set Symbols

Not applicable.

DBDEF Statements

Not applicable.

Application Coding

      DBOPN REF=zzzzzz,REG=reg
      DBOPN REF=zzzzzz,REG=reg,HOLD
      #DO INF
         DBRED REF=zzzzzz
 
set up new LREC by rearranging the fields from zzzzzz
 
         DBADD REF=zzzzzz,NEWLREC=location
      #EDO
      DBCLS REF=zzzzzz,RELEASE
      DBDSP REF=zzzzzz,STRIP=...