Handling Nonnumeric Data
3.4 Testing Nonnumeric Items
If the item being tested is described as a numeric data item, it can only be tested
as NUMERIC or NOT NUMERIC. The NUMERIC test cannot examine either of
the following:
•
An item described as alphabetic
•
A group item containing elementary items whose data descriptions indicate
the presence of operational signs
For further information on using class conditions with numeric items, refer to the
Compaq COBOL Reference Manual.
3.5 Data Movement
Three Compaq COBOL statements (MOVE, STRING, and UNSTRING) perform
most of the data movement operations required by business-oriented programs.
The MOVE statement simply moves data from one item to another. The STRING
statement concatenates a series of sending items into a single receiving item. The
UNSTRING statement disperses a single sending item into multiple receiving
items. Section 3.6 describes the MOVE statement. Chapter 5 describes STRING
and UNSTRING.
The MOVE statement handles most data movement operations on character
strings. However, it is limited in its ability to handle multiple items. For
example, it cannot, by itself, concatenate a series of sending items into a single
receiving item or disperse a single sending item into several receiving items.
Two MOVE statements will, however, bring the contents of two items together
into a third (receiving) item if the receiving item has been subdivided with
subordinate elementary items that match the two sending items in size. If other
items are to be concatenated into the third item, and they differ in size from the
first two items, then the receiving item requires additional subdivisions (through
redefinition).
Example 3–1 demonstrates item concatenation using two MOVE statements.
Example 3–1 Item Concatenation Using Two MOVE Statements
01
SEND-1
PIC X(5) VALUE "FIRST".
01
SEND-2
PIC X(6) VALUE "SECOND".
01
RECEIVE-GROUP.
05
REC-1
PIC X(5).
05
REC-2
PIC X(6).
PROCEDURE DIVISION.
A00-BEGIN.
MOVE SEND-1 TO REC-1.
MOVE SEND-2 TO REC-2.
DISPLAY RECEIVE-GROUP.
STOP RUN.
The result of the concatenation follows:
FIRSTSECOND
Two MOVE statements can also disperse the contents of one sending item to
several receiving items. The first MOVE statement moves the leftmost end of
the sending item to a receiving item; then the second MOVE statement moves
the rightmost end of the sending item to another receiving item. (The second
3–6 Handling Nonnumeric Data
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......