**9**is used to indicate numeric data consisting of the digits from 0 to 9**V**tells where the assumed decimal place is located**S**will remember the sign, this is necessary if the data is negative (more about this later in the handout - for now we will just use 9 and V)

PIC 999V99The V in the PICTURE indicates that when processing the computer will assume that there is a decimal point in this position. Therefore, the number stored in the PICTURE above would be processed as three whole numbers followed by two decimal places.

PIC 9(6)V99 | 6 whole numbers and 2 decimal places |

PIC V999 | 3 decimal places |

PIC 9(4)V9(4) | 4 whole numbers and 4 decimal places |

PIC 9(5) | 5 whole numbers |

PIC S9(5) | 5 whole numbers, the sign is remembered |

PIC S9(4)V9 | 4 whole numbers and 1 decimal number, the sign is remembered |

PIC S99V999 | 2 whole numbers and 3 decimal numbers, the sign is remembered |

PIC S999 | 3 whole numbers, the sign is remembered |

Z |
suppresses leading zeros |

. |
inserts an actual decimal point in the number |

, |
inserts a comma in the number |

$ |
inserts a $ in the field - can be fixed or floating |

* |
inserts * instead of spaces to suppress leading zeros |

- As shown in the chart, the Z suppresses leading zeros by turning them to a space. The number 0024 would print as space space 24. The Z only suppresses leading zeros, embedded zeros such as the zero in the number 2005 are not suppressed.
- The decimal point means print an actual decimal point in this space.
- The comma prints an actual comma in the space if a comma is needed - that is if there is one or more digits printing to the left of the comma.
- The single or fixed dollar sign will print in the space shown in the PIC. The floating $ will float over next to the first printing number suppressing leading zeros and unused commas in the output picture. With floating $ there should always be one more than the number of characters so there is a printing $.
- The asterisk will replace leading zeros and unused commas in the output picture.

INPUT: PIC 999V99 data stored as 123 assumed decimal point 45

OUTPUT: PIC ZZ9.99 will print as 123.45

INPUT/WS DATA | INPUT/WS PIC | OUTPUT PIC | OUTPUT DATA |
---|---|---|---|

000123 | 9999V99 | 9999.99 | 0001.23 |

3455 | 99V99 | Z9.99 | 34.55 |

123456 | 9(4)V99 | Z,ZZ9.99 | 1,234.56 |

01278 | 9(3)V99 | ZZ9.99 | ^12.78 |

00012 | 999V99 | ZZ9.99 | ^^0.12 |

34234 | 9(3)V99 | $ZZ9.99 | $342.34 |

12345678 | 9(6)V99 | $ZZZ,ZZZ.99 | $123,456.78 |

00765432 | 9(6)V99 | $ZZZ,ZZZ.99 | $^^7,654.32 |

765 | 9(3) | ZZ9 | 765 |

23645 | 9(3)V99 | $ZZ9.99 | $236.45 |

0002131 | 9(5)V99 | $ZZ,ZZ9.99 | $^^^^21.31 |

8765432 | 9(5)V99 | $ZZ,ZZ9.99 | $87,654.32 |

7654321 | 9(5)V99 | $$$,$$$.99 | $76,543.21 |

0000123 | 9(5)V99 | $$$,$$$.99 | ^^^^^$1.23 |

0001234 | 9(5)V99 | $$$,$$$.99 | ^^^^$12.34 |

0000045 | 9(5)V99 | $$$,$$$.99 | ^^^^^^$.45 |

124212456 | 9(7)V99 | $$,$$$,$$$.99 | $1,242,124.56 |

12345678 | 9(6)V99 | $$$$,$$$.99 | $123,456.78 |

000234 | 9(4)V99 | $*,***.99 | $****2.34 |

065328 | 9(4)V99 | $*,***.99 | $**653.28 |

87654321 | 9(6)V99 | $***,***.99 | $876,543.21 |

0000064 | 9(5)V99 | $**,***.99 | $******.64 |

0000064 | 9(5)V99 | $**,**9.99 | $*****0.64 |

0000000000 | 9(7)V99 | $*,***,***.99 | $*********.00 |

PIC S999V99With this picture, if the result of the calculation is a negative number or if the input was negative data, the sign will be remembered (Note: In computer code, the sign is stored with the units position). On the output picture, there are a variety of ways to indicate negative data:

- | fixed negative sign either to the left or right of the output picture, will print as space if data is not negative |

---- | floating negative sign to the left of the picture |

+ | fixed positive to the left or right of output picture, turns to - if the data is negative |

++++ | floating positive sign to left of picture, also turns to - if data negative |

DB | to right of picture, prints if data is negative, otherwise two spaces |

CR | to right of picture, prints if is data negative, otherwise two spaces |

INPUT/WS DATA | INPUT/WS PIC | OUTPUT PIC | OUTPUT DATA |
---|---|---|---|

-67812 | S999V99 | -ZZ9.99 | -678.12 |

45674 | S999V99 | -ZZ9.99 | ^456.74 |

1234 | S9999 | Z,ZZ9- | 1,234^ |

-1234 | S9999 | Z,ZZ9- | 1,234- |

0023 | S9999 | Z,ZZ9- | ^^^23^ |

-0023 | S9999 | Z,ZZ9- | ^^^23- |

-24253 | S9(5) | +ZZ,ZZ9 | -24,253 |

12345 | S9(5) | +ZZ,ZZ9 | +12,345 |

-645642 | S9(4)V99 | +Z,ZZ9.99 | -6,456.42 |

987654 | S9(4)V99 | +Z,ZZZ.99 | +9,876.54 |

-000567 | S9(4)V99 | --,--9.99 | ^^^^-5.67 |

000987 | S9(4)V99 | --,--9.99 | ^^^^^9.87 |

-765793 | S9(4)V99 | --,---.99 | -7,657.93 |

-067834 | S9(4)V99 | --,---.99 | ^^-678.34 |

-0023256 | S9(5)V99 | +++,+++.99 | ^^^-232.56 |

0023256 | S9(5)V99 | +++,+++.99 | ^^^+232.56 |

-7867 | S9(4) | Z,ZZ9CR | 7,867CR |

000678 | S9(4)V99 | Z,ZZ9.99CR | ^^^^6.78^^ |

-123345 | S9(4)V99 | Z,ZZ9.99DB | 1,233.45DB |

435454 | S9(4)V99 | Z,ZZ9.99DB | 4,354.54^^ |

INPUT/WS DATA | INPUT/WS PIC | OUTPUT PIC | OUTPUT DATA |
---|---|---|---|

123456 | 9(3)V99 | ZZZ.99 | 234.56 OR 123.45 |

01 INPUT-REC. 05 FST-FLD-IN PIC XXXX. 05 AMT-IN PIC 9(3)V99. 05 ANOTHER-IN PIC XXXX.If the data on the record is: ABC123456MMMM then FST-FLD-IN = ABC1, AMT-IN = 23456 and ANOTHER-IN = MMMM. This would result in the output 234.56.

If the data on the record is: ABCD123456MMM then FST-FLD-IN = ABCD, AMT-IN = 12345 and ANOTHER-IN = 6MMM. This would result in the output 123.45.

INPUT/WS DATA | INPUT/WS PIC | OUTPUT PIC | OUTPUT DATA |
---|---|---|---|

12345 | 9(3)V99 | ZZZ.9 | 123.4 |

In this case, the input stores the data as 123 followed by the assumed decimal point and then 45. When the number is moved to the output picture the V lines up with the actual decimal point. Since there is only room to print one decimal place, the 5 is lost.

INPUT/WS DATA | INPUT/WS PIC | OUTPUT PIC | OUTPUT DATA |
---|---|---|---|

1234 | 99V99 | Z,ZZ9 | ^^^12 |

In this example the input stores the data as 12 assumed decimal point 34. The output picture does not have room for decimal data, so when the data is moved in the assumed decimal point lines up with the end of the field. The 1 and 2 print while the decimals 3 and 4 are lost.

INPUT/WS DATA | INPUT/WS PIC | OUTPUT PIC | OUTPUT DATA |
---|---|---|---|

1234 | 9999 | Z,ZZ9.99 | 1,234.00 |

INPUT/WS DATA | INPUT/WS PIC | OUTPUT PIC | OUTPUT DATA |
---|---|---|---|

1234 | 999V9 | ZZZ.99 | 123.40 |

INPUT/WS DATA | INPUT/WS PIC | OUTPUT PIC | OUTPUT DATA |
---|---|---|---|

234567 | 9(5)V9 | Z,ZZZ.99 | 3,456.70 |

-1234 | 9999 | -Z,ZZ9 | ^1,234 |

-7654 | S9999 | Z,ZZ9 | 7,654 |

20034 | 9(4) | $*,***.99 | $2,003.00 OR $***34.00 |

76543 | 999V99 | ZZ,ZZ9 | ^^^765 |

100234 | 9(4)V99 | ZZ9.99 | ^^2.34 |