There is a variable with value 19446. Requirement is to
convert it to 194.46. I tried it by doing divide by 100 and
my receiving field data type is 9(03)v99. But the output is
194. I am not getting the decimal value. Could anyone pls
let me know how to get this done?
Answers were Sorted based on User's Feedback
Answer / kiro
When COBOL does a divide it uses the format of the item
which in this case is integer only that is why the
fractional part is missing. You need to move the value
19446 to a 9(5)v99 item first and then do the divide using
the 9(5)v99 item.
| Is This Answer Correct ? | 7 Yes | 0 No |
To make this we require to use redefines.
01 ws-value-change
05 WS-ALPHANUMERIC PIC X(5).
05 WS-NUMERIC REDEFINES WS-ALPHANUMERIC PIC 9(3)
V99.
011 WS-EDITED-NUMERIC PIC 9(3).99.
PROCEDURE DIVISION
MOVE '19446' TO WS-ALPHANUMERIC
MOVE WS-NUMERIC TO WS-EDITED-NUMERIC
DISPLAY WS-EDITED-NUMERIC
STOP RUN
You will get the value as 194.46
| Is This Answer Correct ? | 7 Yes | 0 No |
88 level entry is used for (a) data items in WORKING-STORAGE SECTION (b) items with RENAMES clause (c) condition-names (d) None of the above
Did anybody attend the walkin of TCS on 31st July in Gurgaon for any technology,If u have completed 3 round i.e till the HR round,have u received the Offer letter yet? Please let me know.Thanks.
what happens when a copybook variables are declared using include statement ?
what is the result of the following? DIVIDE A INTO B GIVING C. a.C=A/B b.the reminder of B/A is stored in C c.C=B/A d.the reminder of A/B is stored in C
what are the utilities for load and unload the DB2 tables
Difference between file status codes 02 and 22.... since both are for duplicate key detection.
What is the Importance of GLOBAL clause According to new standards of COBOL?
how do you reference the ksds vsam file formats from cobol programs
When would you use in-line perform?
What is the reference modification.
how do you reference the variable unblock file formats from cobol programs
When search all is used in cobol program without sorted input data?
6 Answers CGI, Principal Finance,