Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
string comparison

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
amar.mce

New User


Joined: 01 Dec 2007
Posts: 2
Location: india

PostPosted: Fri Dec 07, 2007 5:15 pm    Post subject: string comparison
Reply with quote

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
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Fri Dec 07, 2007 5:24 pm    Post subject:
Reply with quote

Hello Amar,
Welcome to this forum.

Code:
IF WS-VAR(1:3) = 'AAA' THEN
    .
    .
    .


Correct me if I am wrong.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri Dec 07, 2007 5:28 pm    Post subject: Reply to: string comparison
Reply with quote

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
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Fri Dec 07, 2007 5:53 pm    Post subject:
Reply with quote

Addition to above suggestions -

using 'redefine'.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Fri Dec 07, 2007 5:56 pm    Post subject:
Reply with quote

Murali,

Quote:
using 'redefine'.


Could you explain in detail?
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Fri Dec 07, 2007 6:31 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Fri Dec 07, 2007 7:17 pm    Post subject:
Reply with quote

Fine. Thanks Murali.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am
No new posts Find a string in PS file opened in br... mukkas CLIST & REXX 3 Sat Feb 24, 2018 2:15 pm
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us