Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 7931
Location: Bellevue, IA

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
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm
No new posts Which function does the Ampersand (&a... Andi1982 PL/I & Assembler 3 Wed Aug 24, 2016 2:05 pm
No new posts Need a help how to replace a string i... gurunath82 CLIST & REXX 12 Tue Jul 26, 2016 11:43 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us