CHECK vs SCAN

130 pts.
Tags:
RPG
can anyone explain me when to use CHECK and SCAN and differentiate between them? Please provide examples too...thanks

Answer Wiki

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

Check confirms that every character in the factor two string is in the list in factor 1
Example ‘ABCDEF’ Check TestString
If testString contained ‘BBB’ or ‘BAC’ it would pass– every character are in the factor 1 val.
If testString contained ‘A123′ or ‘Fabcdef’ it would fail and return the position 2 – where the first unacceptable character was found.

Scan looks for an exact match’
Example ‘ABCDEF’ Scan TestString

If testString contained ‘BBB’ or ‘BAC’ it would fail
If testString contained ’123′ or ‘abcdef’ it would fail.
If testString contained ’123ABCDEF456′ it would pass and return the position 4 (where it’s found)

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.

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
  • TRam
    Hi Philip or anybody thanks for your answer. But still i am confused by the example you have given and Factor1 and Factor2 and result. Can you please elaborate and excplain it clearly with a better example... regards Ram
    130 pointsBadges:
    report
  • philpl1jb
    Check might be used to test a text string to determine if it's a valid UPC number - (only digits) ValidSTR = '1234567890' ValidSTR Check UPCSTR BadPos if BadPos > 0 Exsr BadUPCSTR Endif Here the string UPCSTR is tested for any value other than the 10 digits If UPCSTR = '92AB569ZZ999' then BadPos would contain the value 3 - the first position containing the character 'A' because that character wasn't in the ValidSTR ' Newer function that does the same thing BadPos = %CHECK( ValidSTR : UPCSTR) ---------------------------------------------------------------------- Scan would be used in a text search situation like partial name SearchStr = 'BOB' SearchStr SCAN FullNameStr If %found Exsr AddRecSFL Endif Found values would be 'BOB BLAKE', 'JIM ROBOBD', 'SUE BOBBY BOOP' Not Found values would be 'Bob Blake', 'PHIL GORILLA', 'MAX SMITH' Alternative format PosFnd = %SCAN( SearchStr : FullNameStr) If PosFnd > 0 ... or If %SCAN( SearchStr : FullNameStr) > 0
    49,730 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