IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Amt sould display x'05' whent he amount is zero for $(9).00-


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kondru

New User


Joined: 22 Mar 2010
Posts: 11
Location: india

PostPosted: Wed May 12, 2010 12:47 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 12, 2010 4:56 pm
Reply with quote

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
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Thu May 13, 2010 2:28 am
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu May 13, 2010 3:16 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Amount of days between two dates PL/I & Assembler 8
No new posts Adding a trailer with record count an... JCL & VSAM 4
No new posts How to display the leading zeros of a... DB2 7
No new posts SDSF display Max-RC in different colors TSO/ISPF 4
No new posts Converting a file from PD to display ... SYNCSORT 4
Search our Forums:

Back to Top