|
View previous topic :: View next topic
|
| Author |
Message |
biswaranjan
New User
Joined: 06 May 2010 Posts: 17 Location: INDIA
|
|
|
|
Hi,
I want to calculate position of a part of a string within a string. How I can do that?
Ex:
These are the two records. I want to search the position of character
"NMN" and "UIIO" in the below records.
110013NMN IBM MAINFRAME0010TEL 99224455660009UIIO12456789
110009NMN MAINFRAME0010TEL 99224455660009UIIO12456789 |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Write a loop and parse across the field using reference modification until you find the value(s) and record the position(s). . . |
|
| Back to top |
|
 |
biswaranjan
New User
Joined: 06 May 2010 Posts: 17 Location: INDIA
|
|
|
|
| can you please give an example? I'm new to COBOL.. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
We will help you implement your code - we will not write the code for you.
Suggest you search in the forum for topics that talk about reference modification.
At the top of the page is a link to "IBM Manuals". The COBOL Language Reference completely explains reference modification. |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| You might want to look for INSPECT also |
|
| Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
| Terminology note: terminology is critical to IT, where similarly named concepts can mean extremely different things. COBOL does not have strings. COBOL has variables. These variables can be numeric, alphanumeric, alphabetic, or even national -- but they are not strings. COBOL has STRING and UNSTRING verbs that work on alphanumeric variables but they are still not strings. |
|
| Back to top |
|
 |
|
|