ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Fill to decimal place on DSPF

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fill to decimal place on DSPF

    Good morning, I have a 13, 8 field that I need to display in a subfile.

    I did the EDTWRD(' . ') on the field and it looks fine when there are enough digits to get to the decimal: 825.93010013 for example.

    When the number is smaller, like .47264759 or .04006198, they do not have the decimal in the display:

    MXN EGP 47756917 11/12/2015
    MXN EUR 5665880 11/12/2015
    MXN GBP 4006198 11/12/2015
    MXN HKD 47264759 11/12/2015
    MXN IDR 825.93010013 11/12/2015

    I have been reviewing the documentation for EDTCDE, but don't see something that would handle this. How would I fill with zeros and show the decimal every time?

    Any help would be appreciated.

    Thank you.

  • #2
    Re: Fill to decimal place on DSPF

    64waves,

    Have you tried EDTWRD(' 0. ')

    Regards

    Neil.
    Bloke

    Comment


    • #3
      Re: Fill to decimal place on DSPF

      Originally posted by NeilD View Post
      64waves,

      Have you tried EDTWRD(' 0. ')

      Regards

      Neil.
      Good morning Neil,

      I had tried that with a zero before and after the decimal, and the compile failed. This is exactly what I needed, I appreciate your help and have a good day.

      Comment


      • #4
        Re: Fill to decimal place on DSPF

        everything to the right of the '0' in the EDTWRD should be filled with zeroes. So if you have an 11,8 field (what yours looks like from the values provided) this would do zero suppression in only the first digit (the spot where the 0 is in the edtwrd is still suppressed, but everthing to the right of it is not)
        Code:
        EDTWRD('0  .        ')

        Comment


        • #5
          Re: Fill to decimal place on DSPF

          Ok, thanks for that explanation Scott.

          A new thing I am stuck on now, I added 2 search fields to the footer record on my subfile (RATEBOT). They input and work fine, I check that the date in one of the fields is valid, and if not I activate my error message. I wanted to place the cursor on the field, so I did a DSPATR(PC) with an indicator on the footer record field. The indicator does turn on and it's still on when it gets to the top of the loop. These are the commands to activate the SFL:

          // * Display Screen
          Write RateBot;
          Exfmt RateCtl;
          Read RateBot;

          What do I need to have the DSPATR(PC) work?

          Thanks in advance.

          Comment


          • #6
            Re: Fill to decimal place on DSPF

            I wonder if it's because you're writing the subfile after the footer, and they are in separate record formats? Maybe it's positioning to your footer when you do the WRITE RATEBOT but then the EXFMT RATECTL is replacing that with a separate position-to?

            You could try doing it like this instead:
            Code:
            Write RateCtl;
            Exfmt RateBot;
            Read RateCtl;
            You'd have to also move the OVERLAY keyword from your RateCtl record to your RateBot record when you change these around.

            Would that solve the DSPATR(PC) issue? It's just a guess at this point .. but something you can try.

            Comment


            • #7
              Re: Fill to decimal place on DSPF

              I gave that a try, I saw that the RATECTL and RATEBOT both had an OVERLAY keyword. I commented out the one on the CTL and tried it again, no worky. Then I changed the order of the commands like you suggested, with OVERLAY just on the RATEBOT panel. Still no worky. The RTNCSRLOC fields are only on the subfile correct? I didn't try to use those yet.

              When I tried to add these search fields to the CTL record, I got a compile error 'Control record is overlapping the subfile'.

              Thanks for all the input.

              Comment


              • #8
                Re: Fill to decimal place on DSPF

                UPDATE - I restructured the Control to be at the bottom of the screen, made my column headings a regular record, added the RTNCSRLOC with hidden row and column fields to the control, and instead of turning on an indicator, set the cursor location on error = ALL GOOD.

                Geez just imagine if I did these things all the time lol. There was a time I had no clue about subfiles, guess I'm getting better.

                Thanks again for all the input! Have a good day.

                Comment

                Working...
                X