Create integer from Alpha

5 pts.
Tags:
AS/400
How to create an integer from the last two characters of an alpha description. Can create an alpha field of two digits, but how can I make it an integer to use it in a calculation?
1

Answer Wiki

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

IF you are doing this in RPG, try moving the last two positions to a field and use the TESTN opcode. If it’s numeric then move you data to a numeric variable and run your calculation.

Discuss This Question: 2  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.
  • Splat
    This might work for you:

    Monitor;                                               
     [target] = %dec(%trim(%subst([source]: %len([source] - 1)): 2: 0);
     On-error;                                             
      Clear [target];                                           
    EndMon;                            

    12,835 pointsBadges:
    report
  • Splat
    Whoops.

    Need one modification to the above:

    [target] = %dec(%trim(%subst([source]: %len(%trim([source]) - 1)): 2: 0);
    12,835 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: