I expected either all cases below to return the same value for the variable C.
Could some one give me a hint on why C is not 1 in all three cases please. Thanks.
It does not work because om the first case you ask the INSPECT to check for exactly two characters, in the second and third case you ask it to check for 256 characters (it therefore will stop after finding the first one to not match).
You possibly want to use FUNCTION TRIM (LS-IN-NEEDLE TRAILING) ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Simon - could you expand on why the first case returned a 2 ?.
I also would have expected it to return a 1.
Surely there was 'only' 1 occurrence of the string "EF" in the other string.
I understand why the second and third cases returned a 0.
Actually - I just knocked up a simple test & got a 001 for case 1 - why would Anon get a 2 ?.
Last edit: David Wall 2021-07-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2021-07-29
Appologies for "2" - I am not sure how did this happen. I re-tested this and it returns 1 only as expected not 2. i must have had a lot of displays in the code and I was confused. Thanks.
mod edit, removed a few initial spaces to avoid a code block mode
Last edit: Brian Tiffin 2021-07-29
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2021-07-29
Thank you simon. In the above example, the first case returns 1. I was wrong. Sorry.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I expected either all cases below to return the same value for the variable C.
Could some one give me a hint on why C is not 1 in all three cases please. Thanks.
It does not work because om the first case you ask the
INSPECTto check for exactly two characters, in the second and third case you ask it to check for 256 characters (it therefore will stop after finding the first one to not match).You possibly want to use
FUNCTION TRIM (LS-IN-NEEDLE TRAILING)...Simon - could you expand on why the first case returned a 2 ?.
I also would have expected it to return a 1.
Surely there was 'only' 1 occurrence of the string "EF" in the other string.
I understand why the second and third cases returned a 0.
Actually - I just knocked up a simple test & got a 001 for case 1 - why would Anon get a 2 ?.
Last edit: David Wall 2021-07-28
Appologies for "2" - I am not sure how did this happen. I re-tested this and it returns 1 only as expected not 2. i must have had a lot of displays in the code and I was confused. Thanks.
mod edit, removed a few initial spaces to avoid a code block mode
Last edit: Brian Tiffin 2021-07-29
Thank you simon. In the above example, the first case returns 1. I was wrong. Sorry.