Edit Word Usage

Estimated reading time: 11 minutes

Using an EditWord allows you to directly specify:

  • Blanks
  • Output of the negative sign
  • Suppression of unwanted zeroes
  • Commas and decimal points
  • Named Constants

At design-time, the edit word is not to be surrounded by an apostrophe.

For example:

Use EditWord: 0 *bbb-bbb-bbbb* 
Not EditWord: "0 *bbb-bbb-bbbb"* 

The Edit Word is basically divided into three parts:

  1. The ** Body ** is the area for the digits transferred from the source data field to the output record. The body begins at the left most position of the edit word. The number of blanks, plus one zero or an asterisk in the edit word body must be equal to or greater than the number of digits of the source data field to be edited. The body ends with the rightmost character that can be replaced by a digit.
  2. The ** Status ** follows the last blank in the edit word, if used. It defines a space for a negative indicator, either a minus sign, or the two letters CR . The negative indicator will display only if the source data is negative. If the source data is positive, the status positions are replaced by blanks. Edit words without the CR or - indicators have no status positions. If more than one CR follows the last blank, the first CR is treated as a status, and the remaining CR’s are treated as constants. The minus sign must be the last character in the edit word.
  3. The ** Expansion ** is entered after the Status and consists of a series of ampersands and constant characters. Ampersands are replaced by blank spaces in the output. Constants are output as is and follows the body, if status is not specified.

The Body

Blank: Blank is replaced with the character from the corresponding position of the Source Data field.

Decimals and Commas: Decimals and commas are in the same relative position in the edited output field as they are in the edit word unless they appear to the left of the first significant digit in the edit word. In that case, they are blanked out or replaced by an asterisk.

In the following examples, all the leading zeros will be suppressed (default) and the decimal point will not print unless there is a significant digit to its left.

Edit Word Source Data Appears as:
bbbbbbb 0000052 bbbbb52
bbbbbbb.bb 000000099 bbbbbbbb99
bbbbbbb.bb 000000542 bbbbbb5.42

Zeros: The first zero in the body of the edit word is interpreted as an end-zero-suppression character. This zero is placed where zero suppression is to end. Subsequent zeros put into the edit word are treated as constants (see “Constants” below). Any leading zeros in the Source Data are suppressed up to and including the position of the end-zero-suppression character. Significant digits that would appear in the end-zero-suppression character position, or to the left of it, are output.

Edit Word Source Data Appears as:
bbb0bbbbbb 00000009 bbbb000009
bbb0bbbbbb 098745 bbbb098745
bbb0bbbbbb 098765432 bb98765432

If the leading zeros include, or extend to the right of, the end-zero-suppression character position, that position is replaced with a blank. This means that if you wish the same number of leading zeros to appear in the output as exist in the Source Data, the edit word body must be wider than the Source Data.

Edit Word Source Data Appears as:
0bbb 0541 b541
0bbbb 0541 b0541

Constants (including commas and decimal point) that are placed to the right of the end-zero-suppression character are output, even if there is no Source Data. Constants to the left of the end-zero-suppression character are only output if the Source Data has significant digits that would be placed to the left of these constants.

Edit Word Source Data Appears as:
bbbbbb0.bb 000000008 bbbbbbb.08
bbbbbb0.bb 000000000 bbbbbbb.bb
bbb,b0b.bb 00000045 bbbbbb0.45
bbb,b0b.bb 00000854 bbbbbb8.54
b0b,bbb.bb 00000854 bb0,008.54
b,b0b,bbb.bb 000008545 bbb0,008.54

Asterisk: The first asterisk in the body of an edit word also ends zero suppression. Subsequent asterisks put into the edit word are treated as constants (see “Constants” below). Any zeros in the edit word following this asterisk are also treated as constants. There can be only one end-zero-suppression character in an edit word, and that character is the first asterisk or the first zero in the edit word. If an asterisk is used as an end-zero-suppression character, all leading zeros that are suppressed are replaced with asterisks in the output. Otherwise, the asterisk suppresses leading zeros in the same way as described above for “Zeros”.

Edit Word Source Data Appears as:
*bbbbbb.bb 000000854 *bbbbb8.54
bbbbb*b.bb 000000125 ******1.25
bbbbb*b.bb** 000074524 ****745.24**

Note that leading zeros appearing after the asterisk position are output as leading zeros. Only the suppressed leading zeros, including the one in the asterisk position, are replaced by asterisks.

Currency Symbol: A currency symbol followed directly by a first zero in the edit word (end-zero-suppression character) is said to float. All leading zeros are suppressed in the output and the currency symbol appears in the output immediately to the left of the most significant digit.

Edit Word Source Data Appears as:
bb,bbb,b$0.bb 000000125 bbbbbbbbb$1.25
bb,bbb,b$0.bb 000841458 bbbb$8,414.58

If the currency symbol is put into the first position of the edit word, then it will always appear in that position in the output. This is called a fixed currency symbol.

Edit Word Source Data Appears as:
$b,bbb,bb0.bb 000854174 $bbbb8,541.74
$bb,bbb,0b0.bb 000000000 $bbbbbb00.00
$b,bbb,*bb.bb 000745478 $****7,454.78

A currency symbol anywhere else in the edit word and not immediately followed by a zero end-suppression-character is treated as a constant (see “Constants” below).

Ampersand: Creates a blank in the edited field. The examples below might be used to edit a telephone number. Note that the zero in the first position is required to print the constant AREA.

Edit Word Source Data Appears as:
0Area&bbb&No.&bbb-bbbb 9413784307 Area 941 No. 378-4307
0Area&[bbb]&No.&bbb-bbbb 9413784307 Area [941] No. 378-4307

Constants: All other characters entered into the body of the edit word re treated as constants. If the Source Data is such that the output places significant digits or leading zeros to the left of any constant, then that constant appears in the output. Otherwise, the constant is suppressed in the output. Commas and the decimal point follow the same rules as for constants. Notice in the examples below, that the presence of the end-zero-suppression character as well as the number of significant digits in the Source Data, influence the output of constants.

The following edit words could be used to print checks. Note that the second asterisk is treated as a constant, and that, in the third example, the constants preceding the first significant digit are not output.

Edit Word Source Data Appears as:
$bbbbbb**Dollars&bb&Cts 000085474 $****854*Dollars 74 Cts
$bbbbbb**Dollars&bb&Cts 000000010 $********Dollars 10 Cts
$bbbbbbb&Dollars&bb&Cts 000000010 $ 10 Cts

A date could be printed by using either edit word:

Edit Word Source Data Appears as:
bb/bb/bb 072396 7/23/96
0bb/bb/bb 072396 07/23/96

Note that any zeros or asterisks following the first occurrence of an edit word are treated as constants. The same is true for - and CR.

Edit Word Source Data Appears as:
bb0.bb000 08541 85.41000
bb*.bb000 08541 *85.41000

The Status

The following characters have special meanings within the status:

Ampersand - Causes a blank in the edited output field. An ampersand can not be placed in the edited output field.

CR or - symbol - If the sign in the edited output is a plus (+), these positions are blanked out. If the sign in the edited output field is a minus (-), these positions remain undisturbed. The minus sign will only print when the field value is negative.

The Expansion

The characters in this position are always displayed. This area can not contain blanks. If a blank is required in the edited output field, specify an ampersand in the body of the edit word.

See Also

Edit Code Table