View previous topic :: View next topic
|
Author |
Message |
kondru
New User
Joined: 22 Mar 2010 Posts: 11 Location: india
|
|
|
|
Hi,
I have a field declared as $(9).99-
Requirement, when this field contains no zeros or spaces i need to plance TAB other wise i need to display the amount in report.
I am trying to do
Move filed-amt to field-temp-amt.
if field-temp-amt not = zeros or spaces
Display field-temp-amt
else
Display tab.
This logic is displaying $.00 ( When the amount is zero).
Could you please any one help me in this context. It should display only TAB ( X'05'), When the amount is zero.
Tegards,
KDR
[/list][/code] |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
You have a logic error. If field-temp-amt is zeroes, then it is not = spaces. If it is spaces, it is not = zeroes. So by the logic rules used by COBOL, your ELSE statement cannot ever be executed.
Furthermore, even if you fix your logic error the ELSE condition will never be executed. As a numeric edited field, field-temp-amt cannot EVER be = ' ' not can it EVER be = '0000000000000' which is what your IF statement is checking for. Your source field, filed-amt (or field-amt, whatever the true name is), may be zero if it is a numeric field -- but your numeric edited field will not ever take on that value. |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
kondru wrote: |
Hi,
It should display only TAB ( X'05'), When the amount is zero.
|
And what do you expect by displaying a tab character in your output?
All you will get is a single byte of a non-displayable character that probably will show as a punctuation mark when you browse your output.
Line oriented print files do not recognise tab characters, as there are no tabulator positions on a physical line printer. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
kondru,
Even if the report is transferred to a PC, nothing guaranties that the tab char will keep your data aligned.
Open the COBOL Language Reference book and check the "BLANK WHEN ZERO" clause, that would be better. |
|
Back to top |
|
|
|