View previous topic :: View next topic
|
Author |
Message |
bharat_juneja
New User
Joined: 21 Dec 2005 Posts: 20 Location: US
|
|
|
|
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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
bharat_juneja
New User
Joined: 21 Dec 2005 Posts: 20 Location: US
|
|
|
|
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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
|