IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Cobol code- to find a string in a string.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
BHARTI SINDHWANI

New User


Joined: 23 Jul 2021
Posts: 2
Location: INDIA

PostPosted: Fri Jul 23, 2021 10:51 am
Reply with quote

I need to know if there is any COBOL function for below requirement , Need to perform partial match FILE A field with the File B field. Below are the scenarios
FILEA FILEB
FIELDA FIELD B

Code:
Sunny           Industrial Sunny PTE. LTD    - match , found
ABC Bank     ABC Bank Holland              - match, found
Denamrk       Denmark@123                  -  match, found
ABC LTD.      ABC                                  - not match
ABC LTD       ABCLTD                               - not match


I need to find if field A is present in the FIELD B.
Coded
Back to top
View user's profile Send private message
BHARTI SINDHWANI

New User


Joined: 23 Jul 2021
Posts: 2
Location: INDIA

PostPosted: Fri Jul 23, 2021 11:46 am
Reply with quote

Mentioning the fields again for the file A & File B
Code:
FILEA
FIELDA

1)Sunny
2)ABC Bank
3)Denmark
4)ABC LTD.
5)ABC LTD




Code:
FILEB
FIELD B

1)Industrial Sunny PTE. LTD
2)ABC Bank Holland
3)Denmark@123
4)ABC
5)ABCLTD
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2771
Location: NYC,USA

PostPosted: Fri Jul 23, 2021 3:59 pm
Reply with quote

Welcome!
It’s easier to do it in DFSORT why write program? Besides have you heard of INSPECT in COBOL ?
ibmmainframes.com/about47707.html
Next time please use SEARCH function to see if you find similar post to your problem and try yourself first and second use code tags when representing code or data.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8584
Location: Dubuque, Iowa, USA

PostPosted: Fri Jul 23, 2021 8:55 pm
Reply with quote

Depending upon the size of the records and the number of records to be compared, this could be an expensive implementation. It can be achieved by using reference modification since COBOL does not have an INDEX function for string comparisons.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts how to convert and use 1 bit hex-numb... COBOL Programming 0
No new posts how to convert and use 1 bit hex-numb... DFSORT/ICETOOL 10
No new posts Multiple find/replace on the same dat... DFSORT/ICETOOL 4
No new posts VB file copy COBOL program gives erro... COBOL Programming 3
No new posts Cobol program to determine the sequen... COBOL Programming 2
Search our Forums:

Back to Top