AS/400: Usage of %Check and %Checkr opcode

450 pts.
Tags:
AS 400
What is the actual usage of %Check and %Checkr opcode? As far my understanding it should check for non occurrence of the given sting. Consider below case:
DName             S             10A    INZ('VIVEKAM')
DPos              S              5  0  INZ(0)        

0004.00 C                   Eval      Pos = %Check('A7': name)
0005.00 C     Pos           Dsply

C                   Seton                                          LR
Here I'm getting the position as 1 but I should get 7 right because 'A' is found in 6th position but 7 is not found so I should get 7 right?
 
1

Answer Wiki

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

%Check will return the position of the first character i Name that is not included in ‘A7’, So 1 is the correct answer

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.
  • TheRealRaven
    The first position of 'VIVEKAM' that doesn't match either 'A' or '7' is position( 1 ). 
    36,145 pointsBadges:
    report
  • ToddN2000
    Sounds like you may be getting the %CHECK and %SCAN built in functions mixed up. You can always go back and check the ILE reference manual for a description and examples.
    134,970 pointsBadges:
    report
  • Splat
    Per the manual:

    %CHECK returns the first position of the string base that contains a character that does not appear in string comparator. If all of the characters in base also appear in comparator, the function returns 0.

    [Emphasis added]
    12,915 pointsBadges:
    report
  • vivekntt21
    Thank you I got it :)
    450 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: