HP OpenVMS Systems Documentation |
HP COBOL
|
| Previous | Contents | Index |
| ITEMA Value |
ITEMB Description |
ITEMB Contents |
|
|---|---|---|---|
| a. | ABCD | PIC X(4) | ABCD |
| b. | ABCD | PIC X(6) | ABCDss |
| c. | ABCD | PIC X(6) JUST | ssABCD |
| d. | ABCs | PIC X(6) JUST | ssABCs |
| e. | ABCD | PIC XXX | ABC |
| f. | ABCD | PIC XX JUST | CD |
| ITEMA Value |
ITEMB Description |
ITEMB Contents |
|
|---|---|---|---|
| a. | 063080s | XX/99/XX | 06/30/80 |
| b. | 30JUN80 | 99BAAAB99 | 30sJUNs80 |
| c. | 6374823 | XXXBXXX/XX/X | 637s482/3s/s |
| d. | 123456s | 0XB0XB0XB0XB | 01s02s03s04s |
| ITEMA PICTURE |
ITEMA Value |
ITEMB PICTURE |
ITEMB Value |
|
|---|---|---|---|---|
| a. | Z,ZZZ.99- | 1,234.56- | 999.999- | 234.560- |
| b. | ZZZ,ZZZ.99- | ss1,234.56- | $$$,$$$.99- | s$1,234.56- |
| c. | $$$,$$$.99CR | s$1,234.56CR | $$$,$$$.99- | s$1,234.56- |
| d. | $$$,$$$.99DB | s$1,234.56DB | ZZZ,ZZZ.99CR | ss1,234.56CR |
| e. | +++++.99 | +1234.56 | ZZZZZ.99+ | s1234.56+ |
| f. | ++++++.99 | s-1234.56 | ZZZZZZ.99- | ss1234.56- |
| g. | ----- .99 | -1234.56 | ZZZZZ.99DB | s1234.56DB |
| h. | ------ .99 | ss1234.56 | $$,$$$.99 | $1,234.56 |
| i. | $$$$.99- | $123.45- | /XXBXXBXXBXX/ | /$1s23s.4s5-/ |
| j. | $$$$.99- | $123.45- | /99B99B99B99/ | /00s00s01s23/ |
The MULTIPLY statement multiplies two numeric operands and stores the product in one or more data items.
num
is a numeric literal or the identifier of an elementary numeric item.rsult
is the identifier of an elementary numeric item. However, in Format 2, rsult can be an elementary numeric edited item. It is the resultant identifier.stment
is an imperative statement executed when an on size error condition has occurred.stment2
is an imperative statement executed when no on size error condition has occurred.
Each of the examples assume these data descriptions and beginning values:
INITIAL VALUES
03 ITEMA PIC S99 VALUE 4. 4
03 ITEMB PIC S99 VALUE -35. -35
03 ITEMC PIC S99 VALUE 10. 10
03 ITEMD PIC S99 VALUE 5. 5
|
MULTIPLY 2 BY ITEMB. ITEMB = -70 |
MULTIPLY 3 BY ITEMB
ON SIZE ERROR ITEMB = -35
MOVE 0 TO ITEMC. ITEMC = 0
|
MULTIPLY 2 BY ITEMB
ON SIZE ERROR ITEMB = -70
MOVE 0 TO ITEMC
NOT ON SIZE ERROR
MOVE 1 TO ITEMC. ITEMC = 1
|
MULTIPLY 4 BY ITEMA ITEMB ITEMC
ON SIZE ERROR
MOVE 1 TO ITEMD
END-MULTIPLY
MULTIPLY 2 BY ITEMA ITEMB ITEMC
ON SIZE ERROR
ADD 1 TO ITEMD
END-MULTIPLY.
|
| After First MULTIPLY |
After Second MULTIPLY |
|---|---|
| ITEMA = 16 | ITEMA = 32 |
| ITEMB = -35 | ITEMB = -70 |
| ITEMC = 40 | ITEMC = 80 |
| ITEMD = 1 | ITEMD = 1 |
If the initial value of ITEMB had been -20, a SIZE ERROR condition
would not have occurred during the first MULTIPLY. However, the second
MULTIPLY would have caused the condition:
| After First MULTIPLY |
After Second MULTIPLY |
|---|---|
| ITEMA = 16 | ITEMA = 32 |
| ITEMB = -80 | ITEMB = -80 |
| ITEMC = 40 | ITEMC = 80 |
| ITEMD = 5 | ITEMD = 6 |
| Previous | Next | Contents | Index |