Holding Data Using Across Command

The HOLD command lets you retrieve and process data, then hold the results for further processing.  The resulting data file contains the original fieldnames and values requested per verb (PRINT, SUM, COUNT, LIST) and sort (BY) commands, or generated using the ACROSS command.

 

For example, compare the report requests below.  Both reports are summing gross pay for individual employees by pay period, but one is using the sort BY and the other is using the sort ACROSS.  

 

Note:  The tables below are best viewed with the navigation pane hidden.

 

 Using BY

Data Generated

Hold File MFD

ex ph

table file ph

sum ph:grosspay

by ph:ssa

BY ph:payperiod

on table hold AS PERMRPT

end

 

pH:ssa       PH:payperiod  ph:grosspay

------       ------------   -----------

001-11-1111  2004/09          $2356.00

001-11-1111  2004/10          $2356.00

001-11-1111  2004/11          $2356.00

001-11-1111  2004/12          $2356.00

fieldname     alias  format

 

ph:ssa        e01    a11

ph:payperiod  e02    YYm

ph:grosspay   e03    p12.2

 

Using ACROSS

Data Generated

Hold File MFD

ex ph

table file ph

sum ph:grosspay

by pH:ssa

across ph:payperiod

on table hold as permrpt

end

 

ph:ssa       2004/09  2004/10  2004/11  2004/12

------       -------  -------  -------  -------

001-11-1111 $2356.00 $2356.00 $2356.00 $2356.00

fieldname    alias  format

 

ph:ssa       e01    a11

ph:200409    E02    p12.2

ph:200410    E03    p12.2

ph:200411    E04    p12.2

ph:200412    E05    p12.2

 

As you can see, the Master File Descriptions (MFD) generated for the hold files are very different.  In the second request, the resulting values for the field PH:PAYPERIOD have become individual data columns.  This technique is especially useful when you need to condense multiple rows of data for an individual into a single row of data.  

 

When generating reports from the hold file data, either the fieldname or the alias can be used in the request.  For example:to identify employee's who received pay for both the September and December pay periods:

 

table file permrpt

print ph:ssa

Where (ph:200409 gt 0) and (ph:200412 gt 0)

end

 

Refer to your FOCUS documentation or the CIRS User Manual for more information on creating and using hold files.

 

See also:  Holding And Reusing Data