Revision as of 22:33, 24 May 2007 editCmdrObot (talk | contribs)339,230 editsm sp (3): thru→through← Previous edit | Revision as of 04:06, 1 June 2007 edit undoAlaibot (talk | contribs)434,501 editsm Robot: tagging uncategorised pageNext edit → | ||
Line 39: | Line 39: | ||
=== Footnotes === | === Footnotes === | ||
<references/> | <references/> | ||
{{Uncategorized|date=June 2007}} |
Revision as of 04:06, 1 June 2007
A picture clause is an element in Programming Languages that is used to describe a data item, by using sample characters that indicate the item characteristics and size.
History
The picture clause was first used in the COMTRAN (Commercial Translator) language developed by Bob Bemer of IBM in 1957. In 1959, it was incorporated into the original definition of COBOL. Since then, many other programming languages have copied this feature.
Structure
A picture clause is made up of various characters, each of which represents a certain type of data item. The number of repeated characters indicates the size of the data item. Here are some examples (from COBOL) of picture characters and what they represent:
- A -- an alphabetic character (A-Z or a-z, plus blank)
- B -- the blank character
- X -- any character, alphabetic, numeric, or other symbols
- 9 -- a numeric digit
- Z -- a numeric digit, but zero-suppressed (replaced by a blank when equal to zero)
- S -- a sign for a number
- , -- the comma, used as a separator in displaying numbers
- . -- the period, used as a decimal point in displaying numbers
- + -- the plus sign, used in displaying signed numbers
- - -- the minus sign, used in displaying signed numbers
Some picture characters are used in input data and data storage fields, some only in output fields, and some in both. For example, S is used for a signed number on input and storage fields, but output fields will display a + or - sign.
Examples
picture clause | data type | sample contents |
---|---|---|
PICTURE IS 999 | 3-digit number | 123, 005, 087, any number from 000 through 999 |
PICTURE IS S999 | 3-digit signed number | +123, -005, +087, any number from -999 through +999 |
PICTURE IS ZZ9 | 3-digit number, leading zeros suppressed | 123, 5, 87, any number from 000 through 999 |
PICTURE IS A(8) | up to 8-character alphabetic string | "Fredrick", "Fred ", any string up to 8 letters |
PICTURE IS X(8) | up to 8-character string | "Smithson", "O'Riley ", "Von-Jovi", any string up to 8 characters |
Footnotes
This redirect has not been added to any content categories. Please help out by adding categories to it so that it can be listed with similar redirects. (June 2007) |