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 |
Difference between next and continue clause
What is the Purpose of POINTER Phrase in STRING command in COBOL?
Difference between lrecl, blksize among PS, PDS issues? i.e in jcl at dcb
waht is inspect verb? where it can be in real time?
How do you submit JCL via a Cobol program?
How to use the same COBOL program in Batch and CICS on lines? explain with an example
Can we dynamically increase the size of occurs clause? i.e In case I an not sure of the size of array and want to increase the size at run time.If yes , how?
2 input fles: 2 flat files, with different number of records. both are having unique key for each record and already sorted in ascending order . match these files using unique key and in output only matching key value has to be written. please procide cobol logic
I have a table with 3 dimensions like this : 01 ws-table 04 ws-page occurs 3 08 ws-column occurs 2. 12 ws-record occurs 20 pic x(40). How to code with PERFORM varying with 3 dimension...I forgot..
How do define dynamic array in cobol. how do you define single dimensional array and multidimensional array in your cobol?
What is difference between static and dynamic call in cobol?
i friends greetings to the day...!!! I face a quation like"while runnig the programe every day i have to access the previous day updates only...!! Ex:- Let last day 100 customers took bank account i have to select those customers only.."