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 |
how to transfer the file from pc to mainframe??
What is rmode(any) ?
Write a program to enter and display the names of students in a class using the occurs clause.
What compiler option would you use for dynamic linking?
How to traceback if I am getting SOC7 or SOC4 abend? List down the steps
Why do we use COMP-3 variables for computation, when we know that they are non displayable fields and require additional MOVE to numeric field before we populate it in output Reports?
COBOL program to read the string ' BOMBAY' in reverse order as 'YABMOB'
i have two file one is ksds another one is esds i want store matching records in flat file how to you matching.
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
The hierarchy of the execution of logical operators is (a) NOT AND OR (b) AND OR NOT (c) OR AND NOT (d) OR NOT AND
10 Answers Huawei, IBM, TCS,
how to run sub programs using static and dynamic call ...
In EBCDIC, how would the number 1234 be stored?