Previous Topic

Next Topic

Book Contents

Book Index

Dynamic Print Formatting Facility Examples

This example scans a payroll file and prints a formatted table listing management personnel and their salaries.

In the salary field, each group of three digits is separated by a comma (if the SYSDECCHAR parameter is set to period) or by a period (if the SYSDECCHAR parameter is set to comma). A "thousands" separator is not used in the insurance, union dues and social security fields.

Negative values for salary or insurance are preceded by a minus sign. Negative union dues are followed by a minus sign.

Figure 213 Dynamic Print Formatting Facility – Example

    LIBRARY : CTB.WORK.SOLVRULE                             RULE : RULE4 

COMMAND ===>                                                    SCROLL===> CRSR

+-----------------------------------------------------------------------------+

  EXECUTE PROCESS  UPON                                                   C 

  ON FILE       FILENAME CTB.WORK.SOLVREP(CTBREP3)                          

 MODE DS    LINECT 0000    DATASTAMP                                    

  WHEN LINE 001     - 999     COL 036     - 037              STOP    AND/OR 

   STRING = .GT.40                                                      

DO EXTRACT  = SOCIAL_SECURITY                                           

              LEVEL 0 LINE +000 COL 0045 - 0055 PROCESS          TYP    

DO EXTRACT  = SALARY                                                    

              LEVEL 0 LINE +000 COL 0036 - 0041 PROCESS BFNUM    TYP    

DO EXTRACT  = INSURANCE                                                 

              LEVEL 0 LINE +000 COL 0092 - 0097 PROCESS          TYP    

DO EXTRACT  = UNION_DUES                                                

              LEVEL 0 LINE +000 COL 0081 - 0086 PROCESS          TYP    

DO EXTRACT  = VACATION                                                  

              LEVEL 0 LINE +000 COL 0107 - 0108 PROCESS          TYP    

DO PRINT    = %%SOCIAL_SECURITY    %%SALARY    %%INSURANCE        F Y C Y

          %%UNION_DUES    %%VACATION                                    

   OUTDD                                                                

   FORMAT VAR SALARY                                                  C Y

          LEN 010 PREC 002 DELIMITER Y SIGN

   FORMAT VAR INSURANCE                                               C Y

          LEN 010 PREC 002 DELIMITER N SIGN

   FORMAT VAR UNION_DUES                                              C Y

          LEN 010 PREC 002 DELIMITER N SIGN R

   FORMAT VAR SOCIAL_SECURITY                                         C

          LEN 006 PREC 000 DELIMITER N SIGN

DO

  WHEN LINE         -         COL         -                  STOP    AND/OR

   STRING =

DO

============================================================================

Table 242 Dynamic Print Formatting Facility – Examples

Input Value

LEN

PREC

DELIMITER

SIGN

SYSDECCHAR

Output Value

123.45

10

2

Y

 

.

123.45

4123.45

10

2

Y

 

.

4,123.45

–4123.45

10

2

Y

 

.

–4,123.45

123.45

10

2

Y

 

,

123,45

4123.45

10

2

Y

 

,

4.123,45

–4123.45

10

2

N

 

,

–4123,45

123.45

10

2

Y

R

.

123.45

4123.45

10

2

Y

R

.

4,123.45

–4123.45

10

2

Y

R

.

4,123.45–

12.464

10

2

Y

 

.

12.46

123.45

10

3

Y

 

.

123.450

0

10

3

Y

 

.

0.000

1232

10

3

N

 

.

1232.000

The size of the fractional portion of the output value is adjusted to the value of the PREC parameter. If the number of decimal digits after the point in the input variable is less than the value of PREC, zeroes are added to it. If the number of decimal digits after the point in the input variable is greater than the value of PREC, the last (least significant) digits are rounded.

The formatting facility allows for up to 16 digits to be displayed for a printed value, including the fractional portion of that value. Values larger than 16 digits are rounded. For example, if the total length of the value is 18 digits, then the last (least significant) two digits are rounded.

Parent Topic

Dynamic Print Formatting Facility