View previous topic :: View next topic
|
Author |
Message |
SharathG
New User
Joined: 23 Jan 2007 Posts: 12 Location: India
|
|
|
|
Hi all,
I am writing an Easytrieve program to read a sequential file modify some values and then write into a different sequential file.
I have defined a numeric field for the output file as follows:
O-GROSS-LN-AMT * 11 N 2
I am moving the value of the corresponding input field I-GROSS-LN-AMT to O-GROSS-LN-AMT. When I display the value of O-GROSS-LN-AMT it displays the correct value with decimal point but when I write this field into the output file then the decimal point is missing.
For e.g.:-
Suppose I-GROSS-LN-AMT has the value 10000.00. When I display O-GROSS-LN-AMT it display the value 10000.00 but the corresponding value for the field in the output file is 00001000000.
Could some one help me out with this? |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Sharath,
'.' is a print mask (assumed decimal point. i.e., equivalent of V in cobol). It will not be stored in the OP file. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi There
Declare O-GROSS-LN-AMT using mask
Code: |
O-GROSS-LN-AMT * 11 N 2 MASK '--------9.99'. |
|
|
Back to top |
|
|
SharathG
New User
Joined: 23 Jan 2007 Posts: 12 Location: India
|
|
|
|
Murali,
Is there a way by which we can display the decimal point in output file?
Ekta,
I tried out your solution. It is not working. Any other solution? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What will be the use of this output file? Is it a report or is it a data file to be read in some other program?
What does "is not working" tell us? Please show what error you received or what was put into the ouptut file. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Sharath,
As dick highlighted, if your OP file is being used as report only, you could use the following -
Code: |
***** Temp vairable
OP-TEMP W 11 N
OP-TEMP-NON-DECIMAL OP-TEMP 9 N
OP-TEMP-DECIMAL OP-TEMP +9 2 N
**** Your variable decalred in A for writing '.' to op file
O-GROSS-LN-AMT W 12 A
O-GROSS-LN-AMT-NON-DECIMAL O-GROSS-LN-AMT 09 N
O-GROSS-LN-AMT-POINT O-GROSS-LN-AMT +09 01 A VALUE '.'
O-GROSS-LN-AMT-DECIMAL O-GROSS-LN-AMT +10 02 N
*** Move IP value to temp variable
OP-TEMP = I-GROSS-LN-AMT
*** Assign temp variable non-decimal & decimal to your op variable respectively
O-GROSS-LN-AMT-NON-DECIMAL = OP-TEMP-NON-DECIMAL
O-GROSS-LN-AMT-DECIMAL = OP-TEMP-DECIMAL
|
|
|
Back to top |
|
|
SharathG
New User
Joined: 23 Jan 2007 Posts: 12 Location: India
|
|
|
|
Hi,
Sorry for not giving enough information. The output file is used as a data file.
This is our requirement: -
We have to convert a 'FOCUS' job to an Easytreive job. This FOCUS job reads some input file for processing and creates the data file without leading zeros and with decimal points, for numeric fields.
We then wrote an Easytreive job to perform the same function as the FOCUS job but the output data file from Easytreive did not match the output data file from FOCUS.
The FOCUS job created the data file with numeric fields having decimal points and non-leading zeros, whereas the Easytreive job created the data file without decimal point and had leading zeros for the numeric fields.
Finally, when I run a Compare job on both data files, the files should match. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Do you have this working?
To get the decimal-point into the output, look up MASK in your manual.
We're here if there are questions. |
|
Back to top |
|
|
SharathG
New User
Joined: 23 Jan 2007 Posts: 12 Location: India
|
|
|
|
Hi,
MASK is working only with display statements.
But when i write the field into the output file, still the decimal point is not getting displayed.
Is there any other method by which i can get the decimal point to be displayed in the output file? I also want the leading zeros to be suppressed. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Sharath,
Did you try the code which I had provided earlier? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
SharathG wrote: |
But when i write the field into the output file, still the decimal point is not getting displayed.
Is there any other method by which i can get the decimal point to be displayed in the output file? I also want the leading zeros to be suppressed. |
You have found your problem, the MASK only applies to display and print files.
Either live with the leading zeros or output from the print routines or use something other than EZT. |
|
Back to top |
|
|
|