Simple Insertion Editing
Simple Insertion Editing
Insertion editing is a way to format numeric variables for display, particularly in human-readable formats. One of the editing techniques is "simple insertion editing".
Simple insertion editing is inserting a character(s) in the PICTURE string. Its length is counted as the number of characters displayed or printed, which includes editing characters.
Notes -
- It doesn't affect the PICTURE clause value and only changes how the data is displayed.
- The insertion characters are inserted at the specified position in the PICTURE when a value is moved into the edited item.
The syntax for simple insertion editing involves the use of editing symbols -
- , - Inserts comma.
- B - Inserts one or more blank characters.
- / - Inserts one or more '/' characters.
- 0 - Inserts a leading zero if necessary. It is used to ensure that a particular position will always show a numeric value by inserting a leading zero if necessary.
Note! The length of the edited PIC clause may or may not be same as source PIC clause.
Examples -
PICTURE | Input | Output |
---|---|---|
9(7) | 1234 | 0001234 |
9,999,999 | 1234 | 0,001,234 |
9,9(3),9(3) | 1234 | 0,001,234 |
Z,ZZZ,ZZZ | 1234 | 1,234 |
*,***,*** | 1234 | ****1,234 |
9900990099 | 123456 | 1200340056 |
99B99B9999 | 10172023 | 10 17 2023 |
99/99/9999 | 10172023 | 10/17/2023 |
Note! B represents space in the above table.