Friday, 12 December 2008

EDITING:

The data to be printed in a report requires some editing before it can be printed. For example, it is desirable to print a numeric data item by suppressing the leading zeros. If necessary, the sign and decimal point can also be inserted in a numeric data. Editing is normally performed by moving a numeric data item to a field containing special editing characters in its PICTURE clause.

Edit characters for numeric data

The following characters can be used in the PICTURE clause to indicate editing

Z * $ - + CR DB . , B 0 /

The use of these edit characters are explained below.

Z (Zero Suppression):

The edit character Z has the same meaning as that of a 9 in the picture except that the leading zeros in the source data, if any, in the digit positions indicated by Z will be suppressed (replaced by space characters).

Example:

The character is used to indicate a space character and character ^ is used to indicate the position of the decimal point.

Picture of the Field

Numeric value moved to the Field

Edited value

ZZ999

ZZ999

ZZ999

ZZZV99

04678

00052

1^68

38^4

4678

052

001

3840

* (Asterisk):

The edit character * (asterisk) is identical to z except, that the leading zeros are replaced by asterisks instead of space characters.

Examples:

Picture of the Field

Numeric value moved to the Field

Edited value

**999

**999

**999

04678

00052

1^68

*4678

**052

**001

$ (Currency Sign):

A single currency sign can appear at the leftmost position of a picture. In that case the $ character is inserted.

Examples:

Picture of the Field

Numeric value moved to the Field

Edited value

$99999

$99999

$zz999

$zz999

$**999

985

32264

985

32264

985

$00985

$32264

$985

$32264

$**985

- (Minus sign)

A minus sign can appear either at the leftmost or rightmost position of a picture. If the value of an item is negative, a minus sign will be inserted in the said position. On the other hand, if the item is positive, a space character will be inserted.

Examples:

Picture of the Field

Numeric value moved to the Field

Edited value

-9999

-9999

9999-

9999-

-ZZZV99

-ZZZV99

-382

382

-382

382

-46^52

46^52

-0382

0382

0382-

0382

-4652

4652

+ (Plus Sign)

The plus sign has the same meaning as that of a minus sign except that when the item is positive a plus sign will be inserted instead of the space character. If the item happens to be negative, a minus sign will be inserted although there is a plus sign in the picture.

Examples:

Picture of the Field

Numeric value moved to the Field

Edited value

+9999

+9999

9999+

9999+

-382

382

-382

382

-0382

+0382

0382-

0382+

CR and DB (Credit and Debit sign)

The two characters CR or DB symbol may appear only at the rightmost position of the picture. They are identical to the minus sign edit character. In other words, the symbols CR or DB will appear in the rightmost position only if the item is negative, otherwise they will be replaced by two space characters.

Examples:

Picture of the Field

Numeric value moved to the Field

Edited value

9999CR

9999CR

ZZZCR

-4562

4562

-42

4562CR

4562

42CR

ZZZ9V99DB

-152^25

15225DB

ZZZ9V99DB

152^25

15225

. (period or Decimal point)

A period may be used to insert a decimal point and may not appear more than once.

Picture of the Field

Numeric value moved to the Field

Edited value

9999.99

ZZ99.99

ZZ99.99

ZZZZ.ZZ

ZZZZ.ZZ

****.**

$ZZZ9.99

324^52

45^25

245

0^05

0

0

0285

0324.52

45.25

245.00

.05

****.**

$285.00

, (Comma)

A comma, when used in a picture, is treated as an insertion character and inserted wherever it appears.

Example:

Picture of the Field

Numeric value moved to the Field

Edited value

99,999

99,999

ZZ,Z99

2456

37

2456

02,456

00,037

2,456






B (Blank Insertion)

The appearance of B anywhere in the picture will insert a space character in the edited data.

Example:

Picture of the Field

Numeric value moved to the Field

Edited value

99B99B99

99B99B99

150182

46

150182

000046





0 (Zero Insertion)

A zero appearing in a picture will be treated in the same way as a B except that o will be inserted instead of a space character.

Examples:

Picture of the Field

Numeric value moved to the Field

Edited value

9900

09990

12

456

1200

04560



/ (Slash Insertion)

The edit character slash (/) may appear anywhere in the picture. If used, it will be inserted.

Examples:

Picture of the Field

Numeric value moved to the Field

Edited value

99/99/99

999/999/99

150681

3245

15/06/81

000/032/45




BLANK WHEN ZERO

BLANK WHEN ZERO is an editing clause which may be used along with a picture. This will set the entire data item to blanks if its value is equal to zero.

Examples:

Picture of the Field

Numeric value moved to the Field

Edited value

ZZZ.99 BLANK WHEN ZERO

ZZZ.99 BLANK WHEN ZERO

999.99 BLANK WHEN ZERO

2^5

0

0

2.50

Floating Insertion:

The currency symbol ($) can appear in multiples on the left-hand side of a picture. In this case the character will be treated in the same way as the Z character and only one currency symbol will be inserted immediately to the left of the first non-zero digit of the data.

Examples:

Picture of the Field

Numeric value moved to the Field

Edited value

$$$$9.99

$$$$9.99

235^25

342

$235.25

$342.00




Editing of Alphabetic and Alphanumeric Data:

Editing is also possible for alphabetic and alphanumeric data. An alphabetic data item may contain only the B edit character. An alphanumeric data item may contain only 0, B and / edit characters.

No comments:

Post a Comment