Handling Nonnumeric Data
3.2 Data Organization
In Compaq COBOL, all records, and elementary items with level 01 or 77, begin
at an address that is a multiple of 8 bytes (a quadword boundary). By default,
the Compaq COBOL compiler will locate a subordinate data item at the next
unassigned byte location.
See Chapter 16, Chapter 15, and the SYNCHRONIZED clause in the
Compaq COBOL Reference Manual for a complete discussion of alignment.
3.3 Special Characters
Compaq COBOL allows you to handle any of the 128 characters of the ASCII
character set as alphanumeric data, even though many of the characters
are control characters, which usually direct input/output devices. Generally,
alphanumeric data manipulations attach no meaning to the 8th bit of an 8-bit
byte. Thus, you can move and compare these control characters in the same
manner as alphabetic and numeric characters.
Note
Some control characters have 0 in the high-order bit and are part of the
ASCII character set, while others have 1 in the high order bit and are not
part of the ASCII character set.
Although the object program can manipulate all ASCII characters, certain control
characters cannot appear in nonnumeric literals since the compiler uses them to
delimit the source text.
You can place special characters into items of the object program by defining
symbolic characters in the SPECIAL-NAMES paragraph or by using the
EXTERNAL clause. See the Compaq COBOL Reference Manual for information
on these two topics.
The ASCII character set listed in the Compaq COBOL Reference Manual
indicates the decimal value for any ASCII character.
3.4 Testing Nonnumeric Items
The following sections describe the relation and class tests as they apply to
nonnumeric items.
3.4.1 Relation Tests of Nonnumeric Items
An IF statement with a relation condition can compare the value in a nonnumeric
data item with another value and use the result to alter the flow of control in the
program.
An IF statement with a relation condition compares two operands. Either of
these operands can be an identifier or a literal, but they cannot both be literals.
If the stated relation exists between the two operands, the relation condition is
true.
When coding a relational operator, leave a space before and after each reserved
word. When the reserved word NOT is present, the compiler considers it and the
next key word or relational character to be a single relational operator defining
the comparison. Table 3–1 shows the meanings of the relational operators.
Handling Nonnumeric Data 3–3
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......