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

Function to find position of particular character n string?


IBM Mainframe Forums -> COBOL Programming
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
kothai

New User


Joined: 01 Sep 2008
Posts: 32
Location: chennaii

PostPosted: Mon Aug 10, 2009 1:09 pm
Reply with quote

Hi,

I just want to know whether there is any predefined function in COBOL to find a position of particular character in a string.

Eg MAINFRAM.ES

In this string, i want to find the position of dot character. Then i have to remove the '.ES' from the string...

INSPECT can not be used as it will give the count of '.' dot.. or it can replace dot with any other character.....but i want to remove all teh characters after that.

if no function available, this can be done with IF condtion & PERFORM


Thanks,
Kothai. E
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 10, 2009 1:34 pm
Reply with quote

???
try UNSTRING x delimited by '.'
Back to top
View user's profile Send private message
kothai

New User


Joined: 01 Sep 2008
Posts: 32
Location: chennaii

PostPosted: Mon Aug 10, 2009 2:10 pm
Reply with quote

dbzTHEdinosauer wrote:
???
try UNSTRING x delimited by '.'


In UNSTRING...Each literal must be nonnumeric. In my requirement, it can be numeric also.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 10, 2009 2:33 pm
Reply with quote

kothai,

you are wasting my time.

what does this mean?
Quote:
In UNSTRING...Each literal must be nonnumeric. In my requirement, it can be numeric also.


you asked
Quote:
i want to find the position of dot character
in a string.

the unstring will provide this for you. what do you really want?

show data layout (include picture clauses)
show input and requested output.
Back to top
View user's profile Send private message
kothai

New User


Joined: 01 Sep 2008
Posts: 32
Location: chennaii

PostPosted: Mon Aug 10, 2009 2:58 pm
Reply with quote

I found this in one training manual......

Rules for using the UNSTRING verb
1. The sending field must be nonnumeric. The receiving fields numeric or nonnumeric.
2. Each literal must be nonnumeric.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Mon Aug 10, 2009 3:12 pm
Reply with quote

Hi Kothai,

Elaborating on what Dick has already asked,

You said,
Quote:
In my requirement, it can be numeric also

Do you mean the variable itself is of numeric type or the some of the bytes in the particular alphanumeric field is numeric.
Back to top
View user's profile Send private message
kothai

New User


Joined: 01 Sep 2008
Posts: 32
Location: chennaii

PostPosted: Mon Aug 10, 2009 3:14 pm
Reply with quote

the some of the bytes in the particular alphanumeric field is numeric.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Aug 10, 2009 3:20 pm
Reply with quote

Why... instead of quoting useless manuals, and fuzzy requirements
You do not simply post what Dick has requested ??

Quote:
show data layout (include picture clauses)
show input and requested output.


when asking for help You should NOT post what You think,
but what the people spending their time to help You ask for
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Mon Aug 10, 2009 3:25 pm
Reply with quote

Hi Kothai,

in that case then, you need to understand the difference between literal and value.

Quote:
Each literal must be nonnumeric

As mentioned in your training manual, UNSTRING expects all parameters passed to it to be non-numeric which is the field definition as such.

Quote:
In my requirement, it can be numeric also
the some of the bytes in the particular alphanumeric field is numeric

Here as u said, some bytes will be numeric... this should not create any problem for your UNSTRING statement.

Hope there are no other hidden requirements which you forgot to mention... icon_biggrin.gif
Back to top
View user's profile Send private message
kothai

New User


Joined: 01 Sep 2008
Posts: 32
Location: chennaii

PostPosted: Mon Aug 10, 2009 3:29 pm
Reply with quote

hi Binop & Dick

Thanks a lot....


Regards,
Kothai. E
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: Mon Aug 10, 2009 7:25 pm
Reply with quote

And the requested information remained unposted. . . . icon_confused.gif
Back to top
View user's profile Send private message
kothai

New User


Joined: 01 Sep 2008
Posts: 32
Location: chennaii

PostPosted: Tue Aug 11, 2009 8:04 am
Reply with quote

icon_biggrin.gif
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Aug 11, 2009 10:12 am
Reply with quote

Hi Kothai,

what does the emoticon suggest... icon_exclaim.gif

I guess Dick was pretty serious when he asked/pointed out that the information requested was not posted at all... and you closed the forum with a thanks...
It would be nice from your part if you could atleast mention whether your issue has been corrected and if corrected, what you did to solve the issue. icon_rolleyes.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top