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
 

 

Function to find position of particular character n string?

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Function to find position of particular character n string?
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Aug 10, 2009 3:20 pm    Post subject: Reply to: Function to find position of particular character
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    Post subject:
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    Post subject:
Reply with quote

hi Binop & Dick

Thanks a lot....


Regards,
Kothai. E
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: Mon Aug 10, 2009 7:25 pm    Post subject: Reply to: Function to find position of particular character
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    Post subject:
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    Post subject:
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.    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 How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Find out a active PGM jpsager JCL & VSAM 10 Fri Oct 07, 2016 4:32 pm
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


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