About EVAL OPCODE

335 pts.
Tags:
AS/400
AS/400 Fields
I have a field which is declared as alphanumeric and the default value for the variable is blank. Now I have declared one more variable which is of zoned decimal type. Now I want to move the value in the alphanumeric variable which is blank into the field, which is declared as zoned decimal. Will you guys let me know whether it is possible or not. If possible, how can we move the data? What are the OPCODES that will help us in this case?

Software/Hardware used:
ISERIES

Answer Wiki

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

Using the Eval with %Dec BIF will work for this. You may want to do a TESTN first. What if you have other alpha characters uin the field? Is it possible to have a negative number in the field?  Is it always right justified or left justified? Depending on the answer to those questions will depetmine what other OP codes or BIFs might be needed.

Discuss This Question: 3  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    Blanks are not numeric. Blanks don't belong in a numeric field. They aren't numeric.   You can use a character field as part of an expression for EVAL in order to place the result into a numeric field; but the character expression must convert to a numeric value, and blanks aren't numeric digits. You can't use EVAL.   It's possible to use MOVE instead, but the value in the numeric field will be zero, not blanks. Blanks aren't numeric.   Why would you want to do this? You should explain the problem and not ask for a specific technical solution that might not be possible. Tell us what your business objective is. What are you trying to accomplish? What business rule needs blanks in a numeric field?   Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Note that %DEC() doesn't work. Blanks can't give a numeric result. Blanks may be embedded within otherwise numeric characters, but there are no numeric characters in a blank field. -- Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    here is a possible way to code it.
    I would probably do something like this ...
    Shown in free format.  But you would have to determine what to do with the On-Error Case .. I've set the value to zero
    and turned on an error flag.
    
    monitor;
    MyDec = %Dec(MyChar)
    on-error;
    MyDec = 0;
    MyError = *on;
    endMon;
    49,570 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following