AS/400: How to throw error to user when inserting blank in numeric field

Tags:
AS/400
In Numeric field if user enter blank then system interprets it as zero. Say 1xxx1 is interpreted as 1001 where "X" is blank. I used Valnum keyword along with Check(RZ) to handle the same but getting "Invalid Character sequence in numeric only field" error. I want to show user specific error in place of that. Please suggest how to handle these kind of error.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

In your example you want 3 x’s replaced with 2 0’s ? It’s not a good idea to allow the blanks because of inconsistency. If this field is not allowed to have blank values, why not make it a numeric field? I have found that when you are allowing users that kind of flexibility in a field there is always a data integrity issue. 

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • WoodEngineer
    Could you use a MONITOR / EndMon around the EXFMT which generates the error? If so, you could then trap the error and send the user the message you wish.
    8,225 pointsBadges:
    report
  • azohawk
    My experience only leading and trailing blanks get interpreted as zeros, leaving a blank between two valid digits in a numeric will throw an error by the system.
    4,055 pointsBadges:
    report
  • Splat
    No string with blanks embedded between digits will be seen by the iSeries as a numeric field.

    If, for some reason, you want the users to be able to enter invalid data so as to allow you to return a specific message you'll have to define the input field as character.  You would then need to validate the contents of the field within the program.  

    12,915 pointsBadges:
    report
  • ToddN2000
    There may be a better solution. What is actually keyed into this field and how is it being used / stored for starters. Is this field strictly numeric or alphanumeric? What error message do you want and on what conditions?
    135,525 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: