ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Adding prefix value to Both (input-output field)

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

  • Adding prefix value to Both (input-output field)

    Hi,

    How to display like below on screen...
    Manifest No: NAT123456789

    First 3 (NAT) are prefixed to remaining no. (123456789) but when I used to define output only field for first three letters and for rest 9 digit Both attribute field then doing EXFMT is not showing 123456789 because first 3 field overlaps.
    So my requirement is to take input of 9 digit from screen but prefix NAT before that value without having space in between.

    How to do this???

    Thanks,
    NIL
    Cheers...
    Nil

  • #2
    Sorry, it can't be done on a 5250 display. The attribute byte takes up a space (which tells the display to underline in your example). You'll have to leave a space between 'NAT' and the number or you could combine the two into one input field and edit check to make sure the first 3 characters were not changed.

    Comment


    • Nil
      Nil commented
      Editing a comment
      Thanks for your inputs, How do I add edit check... any example...!!!

  • #3
    Something like this in your RPG code:
    Code:
    If %subst(field:1:3) <> 'NAT'
      // send error message
    Endif
    or if you don't want to bother the user with the error message you could just force it to NAT:
    Code:
    If %subst(field:1:3) <> 'NAT'
      %subst(field:1:3) = 'NAT'
    Endif

    Comment


    • Nil
      Nil commented
      Editing a comment
      Thank you.
      I come to know about DFT keyword in DSPF that does the same like below...

      A SMNO 13A I 7 15DFT('NAT')

      so it retain the NAT value in that field automatically.

      Thanks for your code.

      Cheers,
      NIL
Working...
X