Solved

how to display 0.00 on the screen?

Posted on 2002-04-26
9
575 Views
Last Modified: 2008-02-01
I have this field defined as 7,2 and it needed to show on the sceen as 99,999.99. But if the field is *ZERO, then it needed to be showed as 0.00. Have tried all possible edit code and edit word but no luck.
0
Comment
Question by:Ellen Chen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 2

Expert Comment

by:macbone2
ID: 6979019
Hi chinghwachen
Is it an output only field or both? If it's output only you could make it an alphanumeric field instead of numeric then convert the 7.2 number from the file into a 10 character field on screen,(to allow for commas, dec. point and sign)then format the 0.00 yourself, also put in - signs if required. You'd need to move the numeric field into a numeric array which has 7 elements 1 digit long, then check each element and move to an alpha array 10 x 1 long
i.e say the numeric array is AN and the alpha array is AA
First check to see if the value is ZERO, then Z-ADD the number to AN  Then move AN,7 to AA,10, AN,6 to AA,9 then move '.' to AA,8, and AN,5 TO AA,7. after that, if the number is zero you can stop. If positive or negative, you will also need to range check so that if the number is in the range say > 0 < 10 you stop after filling 4 rightmost elements eg range from 0.01 to 9.99, then next range >= 10 up to < 100 (e.g. from 10.00 to 99.99) and so on. You also need to decide in advance whether the sign is leading or trailing. If it's a trailing sign, you'd need to adjust the array positions above, because the sign would go in AA,10.
macbone2
0
 
LVL 2

Expert Comment

by:macbone2
ID: 6982211
I didn't ask the question in the earlier comment, but I presume your using SDA for screen creation and RPG for the programming. (I also tried a number of edit codes & edit words, but couldn't make it happen. In theory it should be possible. I've just realised, whilst typing,one edit word I didn't try, but will in the morning try this yourself
               123456789
edit word     '  ,  0.00'     OR
edit word     '  ,  0.00-'  

Actually, if this doesn't work, there's no reason why even if the field was to be used for input and output, you could still make it an alphanumeric field. There'd be a lot of validation to do, for example, you would need to check that each character was numeric or dec. point or minus sign; but you could do much of the validation using SCAN or LOKUP on array of valid chars. after excluding blanks, then you'd only need to check position of dec. point and sign e.g 3.45- would be valid but .345- or 3-4.5 wouldn't be.
Hope this helps, and I'll try that edit word tomorrow.

Regards
Geoff McKeown (macbone2)
0
 
LVL 2

Expert Comment

by:macbone2
ID: 6982216
The edit word doesn't show correctly because it's been shifted by the formatting on this page. The '#' below represent spaces in the edit word

  edit word   '##,##0.00'   or '##,##0.00-'

Good Luck

0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 2

Expert Comment

by:macbone2
ID: 6986593
Ignore the comments about edit words. I can't make any combination work.
0
 

Author Comment

by:Ellen Chen
ID: 6986668
Geoff,

I know. We have tried every possible edit words and edit code. Please let me know if you have better solution other than the first one.

Thanks.
0
 
LVL 1

Expert Comment

by:MN_Dave
ID: 6987028
It may be possible to create a user defined edit code that will handle this.  IBM allows up to 5 user defined edit codes (5,6,7,8, & 9).  IBM ships with their own definitions for these, but they can be deleted and recreated using the CRTEDTD command.  This command allows you to define both an integer mask and a decimal mask to handle editing on both sides of the decimal point.  I think you could use the integer mask portion of this to accomplish what you are trying to do.  Unfortunately I cannot try this first because our systems people will not grant us authority to change objects in the qsys library.  Give it a shot and see if you can make it work!
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 6996593
Hi chinghwachen,

I ws sure about the use of editcodes, but I just checked it again (and tested it)

Use Editcode '1' for fields with no-sign,
    editcode 'J' for signed fields.

If it does not work, be sure of the folowing:
RPG: put a 'D' on position 21 of your Control-Specification (H-form)

or

ILERPG: put the DECEDIT('0.') in the Control-Specification

Goodluck
0
 
LVL 3

Accepted Solution

by:
P_S_Price earned 250 total points
ID: 7143192
I may not be understanding the question correctly, but
Have you tried an edit word of '##,#0#.##'  Where '#' is
used here to represent a Space this will definitely output zeros as 0.00 (Copy and paste this - EDTWRD('  , 0 .  ').

But it will however output the number .01 as 0.01.

Is your question that you require the field Zero filled if the value is not zero, and zero suppressed as shown when the value is 0.

0
 

Author Comment

by:Ellen Chen
ID: 7143927
It works! Thanks.
I did not try and put a SPACE before the decimal point.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Getting to know the threat landscape in which DDoS has evolved, and making the right choice to get ourselves geared up to defend against  DDoS attacks effectively. Get the necessary preparation works done and focus on Doing the First Things Right.
A look at what happened in the Verizon cloud breach.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question