Getting All Parent Segment Instances

When you write a report request using a file that has missing segment instances, the missing instances affect how data is retrieved.  That is because FOCUS will omit a parent instance without a child instance if the report request specifies fields in both the parent and child segments. It makes no difference whether the specified fields are display fields or sort fields.

 

For example, in the Payment History (PH) file, the payment segment is the parent of the deduction segment.  Since not all payments have associated deductions, the PH file has missing child (deduction) instances.  So, if you write a report request that sums gross pay (located in the parent segment) and deduction amounts (located in the child segment), then payments without deductions are omitted from the report. To include all parent instances, use the following options:  

SET ALL = PASS
(Recommended for reports without screening statements.)

You can include parent instances with missing decedents, by entering the SET ALL = PASS command before the TABLE FILE command.  When the SET ALL = PASS command is active, and the report request screens on a field that resides in a child segment, then all parent instances are included whether or not it has a child instance that meets the criteria. For this reason, we recommend using this command only if there are no screening statements in the report request. For example, the request below will include all gross pay amounts, including amounts from payments without any associated deductions.  

 

set all = pass

ex ph

table file ph

sum ph:grosspay

    ph:dedamt

by ph:ssa

end

 

MATCH SEGMENTS
(Recommended for reports with screening statements.)

You can use the MATCH command to include all parent instances and match that data to the child instances.  A match request can be used to gather data from each segment, independent of the other, and then combine the gathered data.  The MATCH command can be used with or without screening statements. For example, the request below would include all gross pay amounts from all payments with or without child instances, but would only sum deduction amounts for tax sheltered annuities.

 

EX PH

MATCH FILE PH

SUM PH:GROSSPAY

by ph:ssa

RUN

-*

FILE PH

SUM PH:DEDAMT

by ph:ssa

IF PH:DEDTYPE EQ TC

AFTER MATCH HOLD AS PERMSML

OLD-OR-NEW

END