Appendix A
<< Click to Display Table of Contents >> Appendix A |
|
Picture Codes |
|
Format pictures give you the capability to format the way data is printed. The format picture consists of two distinct parts, a function string and template string, either or both of which may be present.
Function Strings
The function string specifies formatting that applies to the entire piece of information, rather than to particular character positions within it. The function string consists of the @ character, followed by one or more additional characters, each of which has a particular meaning (see table below). The function string must be the first element of a format picture and cannot contain spaces. A function string may be specified alone or with a template string. If both are present, the function string must precede the template string, and the two must be separated by a single space.
Function |
Type |
Action |
B |
N |
Displays numbers left-justified |
R |
C |
Non-template characters are inserted in the display but not saved in the field. |
Z |
N |
Displays zero as blank. |
! |
C |
Converts alphabetic character to uppercase |
Template String
A template string specifies formatting on a character by character basis. The template string consists of a series of characters, some of which have special meanings (see table below). Each position in the template string corresponds to a position in the displayed value. Characters in the template string which do not have assigned meanings are copied verbatim into the displayed value. If you use the @R picture function, these characters are inserted between characters of the displayed value; otherwise they overwrite the corresponding characters of the displayed value.
Template |
Action |
N |
Displays only alphabetic and numeric characters |
9 |
Displays only digits (and sign character for numeric fields) |
L |
Displays logicals as T or F |
Y |
Displays logicals as Y or N |
! |
Converts an alphabetic character to upper case. |
$ |
Displays a dollar sign in place of a leading space in a numeric. |
. |
Displays a decimal point. |
, |
Displays a comma. |
Examples
The following are examples of values and the affect that format pictures have on the way they are displayed.
Value: 123654987
Format Picture: 999,999,999
Displayed: 123,654,987
Value: John Smith
Format Picture: @!
Displayed: JOHN SMITH
Value: 009564311
Format Picture: @R 999-99-9999
Displayed: 009-56-4311