Segmented data templates

Z Data Tools offers template support for segmented records. A segmented record is a record that contains one or more logical segments, each of which is defined and identified by a copybook layout. When you apply a "segmented data template" to these records, each segment is treated as a logical record within the supported functions.

Figure 1 shows a simple example of segmented records, seen without using a template:

Figure 1. Segmented records with no template
----+----1----+----2----+----3----+----4----+----5----+
****  Top of data  ****
01FINAccountant          020654John      Browning  1875
01FINPurchasing Officer  021759Frederick Smith     1893
01FINAccounts Receivable 024163Annette   Fielding  1856
01MKTSales Representative026584Jessica   Simpson   1862
01MKTPromotions Manager  023579Catherine Jones     1812
01MKTMarket Research     021239Alan      Johnson   1814
01ADMChief Executive     020124David     Arrowsmith1801
01ADMSecretary/PA        024781Maryanne  Davies    1802
01ADMReceptionist        026329Lizette   Wilson    1800
01ADMClerical Officer    023571Stephen   Hughes    1806
****  End of data  ****

Figure 2 shows the copybook definitions needed to define each record segment:

Figure 2. Copybook definition for segmented records
----+----1----+----2----+----3----+----4----+----5
****  Top of data  ****
       01 DEPT.
          03 Rec-Type     PIC XX.
          03 Dept-ID      PIC XXX.
          03 Job-Desc     PIC X(20).
       01 EMPLOYEE.
          03 Rec-Type     PIC XX.
          03 Emp-ID       PIC 9999.
          03 Given-Name   PIC X(10).
          03 Family-Name  PIC X(10).
          03 Extension    PIC 9999.
****  End of data  ****

Figure 3 shows the DEPT. records in TABL format, after a segmented data template (generated from the copybook) has been applied.

Figure 3. TABL view of segmented data with the DEPT Record Type selected.
REC-TYPE DEPT-ID JOB-DESC
#2       #3      #4
AN 1:2   AN 3:3  AN 6:20
<>       <->     <---+----1----+---->
01       FIN     Accountant
- - - - - - EMPLOYEE  - - - - - - - - - - - 1 Line(s) suppressed
01       FIN     Purchasing Officer
- - - - - - EMPLOYEE  - - - - - - - - - - - 1 Line(s) suppressed
01       FIN     Accounts Receivable
- - - - - - EMPLOYEE  - - - - - - - - - - - 1 Line(s) suppressed
01       MKT     Sales Representative
- - - - - - EMPLOYEE  - - - - - - - - - - - 1 Line(s) suppressed
01       MKT     Promotions Manager
- - - - - - EMPLOYEE  - - - - - - - - - - - 1 Line(s) suppressed
01       MKT     Market Research
- - - - - - EMPLOYEE  - - - - - - - - - - - 1 Line(s) suppressed
01       ADM     Chief Executive
- - - - - - EMPLOYEE  - - - - - - - - - - - 1 Line(s) suppressed
01       ADM     Secretary/PA
- - - - - - EMPLOYEE  - - - - - - - - - - - 1 Line(s) suppressed
01       ADM     Receptionist
- - - - - - EMPLOYEE  - - - - - - - - - - - 1 Line(s) suppressed
01       ADM     Clerical Officer
- - - - - - EMPLOYEE  - - - - - - - - - - - 1 Line(s) suppressed
****  End of data  ****

The following utilities/functions can support the use of a segmented record template:

View and Edit, DSU and DSEB functions
When a segmented data template is in use, Z Data Tools uses In-place Editing. Segments cannot be inserted, deleted, copied or moved. The contents of segments can be edited but the length cannot be changed.

The BOUNDS primary command and BND prefix command cannot be used. If you really want to do a change across some common portion of all segments (or across certain columns of a certain segment), you can use the column range parameters on the FIND or CHANGE commands.

The Audit Report identifies changed segments.

Copy utility and DSC function
When copying a data set, you can only apply a segmented data template to the input data set. The output data set will contain a separate record for each segment in the input data set.
Compare utility and DSM function
Segmented data templates can be used for either the “Old” or “New” data sets or both. This allows you to compare segmented and non-segmented data. For example, after copying segmented data to separate records in a new data set, you might want to compare the data sets to ensure that no errors occurred in the copying process.
Print utility and DSP function
Segmented data templates are supported in the Print Utility and DSP function.
Note: Segmented data templates cannot be used for ISPF Packed data sets.

Related topics