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
 

 

Finding the last occurrance of a character in a string

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
saraswathis

New User


Joined: 06 Sep 2006
Posts: 8

PostPosted: Tue May 08, 2007 4:57 pm    Post subject: Finding the last occurrance of a character in a string
Reply with quote

I wish to find the last occurence of space(' ') in a string. Does anyone know? Also is there any function to find the number of occurences of a char in a string?
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: Tue May 08, 2007 7:41 pm    Post subject:
Reply with quote

Hello,

When posting a new question, please start a new topic.

I've split this question from the previous topic.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1228
Location: Israel

PostPosted: Tue May 08, 2007 8:06 pm    Post subject:
Reply with quote

Why is this in the DB2 forum?
Do you need to answer this question from within a SELECT, like:
SELECT * FROM TABLE WHERE "last occurence of space" > 5 ?

Or do you want to do this in 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: Tue May 08, 2007 9:42 pm    Post subject:
Reply with quote

Hello,

From what i saw, it is for a DB2 SELECT rather than COBOL.

I believe the desired result is twofold:
1. how many spaces are in the string
2. the postition of the last space
Back to top
View user's profile Send private message
saraswathis

New User


Joined: 06 Sep 2006
Posts: 8

PostPosted: Fri May 11, 2007 10:22 am    Post subject: Re: Finding the last occurrance of a character in a string
Reply with quote

Exactly !!!. I need the number of occurences of the spaces in a string. And i want to find out the last occurence of the space. This needs to be run on MainFrame - DB2.

Thnks in adv
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: Fri May 11, 2007 7:10 pm    Post subject:
Reply with quote

Hello,

Will this "select" be done inside a cobol program?

If so, my recommendation is that you select the needed rows(s) from DB2 and then parse them in the cobol code for the space count/last position.

Gives you the advantage of simply modifying the code if the requirement ever grows/changes as well as it could be running yet today. Given that no one has posted a select yet (since the 8th), and this is the DB2 forum, it may be a bit before a suggestion is posted. . .
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts finding delayed job/s in OPC jzhardy IBM Tools 0 Mon May 29, 2017 9:04 am
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts the use of 'B3'x character in a panel Pedro TSO/ISPF 1 Thu Feb 16, 2017 3:09 am
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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