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

Finding the last occurrance of a character in a string


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Tue May 08, 2007 7:41 pm
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: 1353
Location: Israel

PostPosted: Tue May 08, 2007 8:06 pm
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

Moderator Emeritus


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

PostPosted: Tue May 08, 2007 9:42 pm
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
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

Moderator Emeritus


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

PostPosted: Fri May 11, 2007 7:10 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Finding and researching jobs All Other Mainframe Topics 0
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts VB to FB - Finding LRECL SYNCSORT 4
Search our Forums:

Back to Top