View previous topic :: View next topic
|
Author |
Message |
Tirumaladevi
New User
Joined: 30 Nov 2004 Posts: 1 Location: Chennai
|
|
|
|
Could you please help me out on how to compare the strings in COBOL? If there is no such function availabe then can any one of you please advise how to proceed. Thanks in advance.
Regards
Tirumala |
|
Back to top |
|
|
shobam
New User
Joined: 18 Jul 2005 Posts: 34 Location: CN
|
|
|
|
Is the "IF" condition not working for you?
Option 2:
If there is a problem because of the trailing spaces in the string
INSPECT IP-STR1 TALLYING TRAILING-SPACES-COUNT FOR TRAILING SPACES
LEN-OF-STR1 = LENGTH(IP-STR1) - TRAILING-SPACES-COUNT
INSPECT IP-STR2 TALLYING TRAILING-SPACES-COUNT FOR TRAILING SPACES
LEN-OF-STR2 = LENGTH(IP-STR2) - TRAILING-SPACES-COUNT
IF IP-STR1(1:LEN-OF-STR1) = IP-STR2(1:LEN-OF-STR2)
DISPLAY "MATCH FOUND"
ELSE
DISPLAY "NO MATCH"
END-IF
Please correct me if I am wrong. |
|
Back to top |
|
|
|