View previous topic :: View next topic
|
Author |
Message |
amar.mce
New User
Joined: 01 Dec 2007 Posts: 2 Location: india
|
|
|
|
i wanted to compare the 1st three characters of a string.
Ex.
length of variable is 10. of which 1st three characters must be AAA.
THANKS IN ADVANCE |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Hello Amar,
Welcome to this forum.
Code: |
IF WS-VAR(1:3) = 'AAA' THEN
.
.
. |
Correct me if I am wrong. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
amar,
Hi and welcome to the forums.
Quote: |
i wanted to compare the 1st three characters of a string. |
You can use reference modification technique.
Code: |
IF B(1:3) = 'AAA' THEN
|
|
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Addition to above suggestions -
using 'redefine'. |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Murali,
Could you explain in detail? |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Gnanas,
Code: |
01 A PIC X(10).
01 B REDEFINES A.
02 FIRST-A-3 PIC X(3).
02 REM-A-OPTIONAL PIC X(n).
====> where n=1 to 7 <==== comment
|
Now use FIRST-A-3 var for comparision. |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Fine. Thanks Murali. |
|
Back to top |
|
|
|