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
 
how to check A string contains string B

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

New User


Joined: 21 Dec 2005
Posts: 20
Location: US

PostPosted: Wed Apr 05, 2006 10:25 pm    Post subject: how to check A string contains string B
Reply with quote

I have a file which has the first name let's say FNAME pic x(12)
which needs to be match with the name in file FullName pic x(25).
This fullName is a combination of first name and last name logically but its not physically divided in 2 parts of first name and last name.

Problem:-
FNAME contains a string/name say Bharat
and FullName contains Bharat Juneja.

I need to check that :
1) FullName contains Fname
OR
2) The part of FullName from beginning of the string till the first space encounters i.e. before the last name starts should match with the FNAME in the first file.

I hope its clear. Please ask if you need any clarifications.
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Apr 05, 2006 10:43 pm    Post subject: Re: how to check A string contains string B
Reply with quote

bharat_juneja,

A question.

if fullname contains

' Bharat Juneja' (space preceeds Bharat)
'Bharati Juneja' (additional letter added to Bharat)
'Juneja Bharat' (first name follows last name seperated by space)
'Juneja,Bharat' (first name follows last name seperated by comma)

Do you want these found or not

Thans,

Dave
Back to top
View user's profile Send private message
bharat_juneja

New User


Joined: 21 Dec 2005
Posts: 20
Location: US

PostPosted: Wed Apr 05, 2006 11:10 pm    Post subject:
Reply with quote

Well, the requirement is not pretty clear as of now.
But I assume all the above stated should also be found along with
"Bharat Juneja".

It will be great if you could also suggest -> If I don't want above 4 cases to be processed but only "Bharat Juneja" to get processed.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Apr 06, 2006 12:42 am    Post subject: Re: how to check A string contains string B
Reply with quote

bharat_juneja,

This code is one of several ways your query can be accomplished.

Code:

01  FNAME                       PIC X(12)   VALUE           
    'BHARAT'.                                               
01  FULLNAME                    PIC X(25)   VALUE           
    'BHARAT JUNEJA'.                                       
01  FNAME-LEN                   PIC 9(5)    COMP-3.         
                                                           
LINKAGE SECTION.                                           
                                                           
PROCEDURE DIVISION.                                         
                                                           
    INSPECT FNAME                                           
      TALLYING FNAME-LEN FOR CHARACTERS BEFORE INITIAL ' '.
                                                           
    IF FULLNAME(1:FNAME-LEN + 1) = FNAME                   
    THEN                                                   
        DISPLAY 'FOUND'                                     
    ELSE                                                   
        DISPLAY 'NOT FOUND'                                 
    END-IF.                                                 


Don't forget that you will have to sort both input files so you can do a two file match.

Dave
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
This topic is locked: you cannot edit posts or make replies. GDG gen check using REXX raghuraman123 CLIST & REXX 6 Wed Apr 18, 2018 9:18 pm
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am
No new posts How syntax check at Bind time is diff... Poha Eater DB2 5 Wed Mar 21, 2018 9:16 pm
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

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