View previous topic :: View next topic
|
Author |
Message |
Mariraj
New User
Joined: 09 Jul 2007 Posts: 59 Location: Chennai
|
|
|
|
A file contains the following data
F.Date T.Date CC Rate Amount Qty
05/25/06 03/18/07 1 -0.50 -4.90 1
04/15/06 03/18/07 1 -0.50 -5.57 1
11/14/05 03/18/07 1 -0.50 -8.08 1
I need to read this file. Actuallly I want to know how to read the Rate & Amount fields. S9(9)V9(2) variables are moved into -(8)9.9(2) variable are then written to this file. So now it is -(8)9.9(2) variable.
Can someone tell me what kind of variable shud i use in my progam to read this rate and amount in my program.
I need to read these values and reverse their sign and write it to another file.
Any pointers on the same would be really appreciated. |
|
Back to top |
|
|
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
|
|
|
|
Hi,
Read your fields in an alphanumeric declared variable and then convert them to numeric using COBOL function NUMVAL.
eg.
Code: |
VARIABLE-A PIC X(5) VALUE '-12.2'.
VARIABLE-B PIC S9(2)V9.
MOVE FUNCTION NUMVAL(VARIABLE-A) TO VARIABLE-B
|
Actually I haven't tested above piece of code.
But you can go ahead and let us know if it works.
--Parag |
|
Back to top |
|
|
|