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
 
Calculating position of a string within a string

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

New User


Joined: 06 May 2010
Posts: 17
Location: INDIA

PostPosted: Wed May 26, 2010 8:51 am    Post subject: Calculating position of a string within a string
Reply with quote

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

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 26, 2010 9:45 am    Post subject:
Reply with quote

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

New User


Joined: 06 May 2010
Posts: 17
Location: INDIA

PostPosted: Wed May 26, 2010 9:47 am    Post subject:
Reply with quote

can you please give an example? I'm new to COBOL..
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 26, 2010 9:53 am    Post subject:
Reply with quote

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

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed May 26, 2010 10:32 am    Post subject:
Reply with quote

You might want to look for INSPECT also
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed May 26, 2010 4:20 pm    Post subject:
Reply with quote

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
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 can we hardcode a value in db2 load c... ram_vizag DB2 2 Wed Feb 28, 2018 11:04 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
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am

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