The ISO COBOL specification FAQ / DCD "Pictures"

Rohit Khare (rohit@uci.edu)
Tue, 06 Oct 1998 00:02:44 -0700


[The Document Content Description effort swipes enough of XML-Data to
confuse everything by mixing in yet newer constructs. Or older ones: they
added "picture" constraints to strings. From COBOL.

Yes, you too can now attempt to restrict XML text to string matching like
NNN.NNN for fixed and so on.]

http://wwwold.dkuug.dk/jtc1/sc22/wg4/open/faq.htm

[the entire FAQ follows]

Q: What is COBOL?
A: COBOL is a programming language. The ISO standard number is ISO 1989.

[Now, it's funny, but it's understandable. SC22 isn't too experienced at
this sharing information thing, much less over the Web. Check out the
template for the PROTO language: http://wwwold.dkuug.dk/JTC1/SC22/WG99/ ]

[herewith, the DCD usage: http://www.w3.org/TR/NOTE-dcd#picTypes ]

"Pictures", similar to those in [COBOL] picture clauses, can be used to
constrain the format of strings and in some cases control their conversion
to numbers. A picture is an alphanumeric string consisting of character
symbols. Each symbol, which is usually one character but may be two
characters, is a placeholder that stands for a set of characters. For
example, the picture "A" stands for a single alphabetic character.
The following is a list of picture symbols and their meanings. A
A single alphabetic character.
B
A single blank character.
E
The character E, used to indicate floating point numbers.
S
The leftmost character of a picture indicating a signed number. The
characters "+" or "-" may appear in the S position.
V
An implied decimal sign. The input 1234 validated by a picture 99V99 is
converted into 12.34.
X
Any character.
Z
The leftmost leading numeric character that can be replaced by a space
character when the content of that content position is a zero.
9
Any numeric character.
1
Any boolean character (0 or 1).
0,/,-,., and ,
represent themselves.
cs
The currency symbol.

Here are some examples of picture constraints
=A0=A0$123,45.90=A0satisfies=A0picture=A0$999,99.99=A0
=A0=A0$123,45.90=A0satisfies=A0picture=A0XXXX,XX.XX
=A0=A0123-45-5678=A0satisfies=A0picture=A0999-99-9999=A0(Social=A0Security=A0Number)
=A0=A024E80=A0satisfies=A0picture=A099E99=A0(floating=A0point)
=A0=A023.45=A0satisfies=A0picture=A099.99
=A0=A02345=A0satisfies=A0picture=A099V99=A0(translates=A0to=A023.45)=A0=A0