View previous topic :: View next topic
|
Author |
Message |
kothai
New User
Joined: 01 Sep 2008 Posts: 32 Location: chennaii
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
???
try UNSTRING x delimited by '.' |
|
Back to top |
|
|
kothai
New User
Joined: 01 Sep 2008 Posts: 32 Location: chennaii
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
kothai
New User
Joined: 01 Sep 2008 Posts: 32 Location: chennaii
|
|
|
|
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 |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
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 |
|
|
kothai
New User
Joined: 01 Sep 2008 Posts: 32 Location: chennaii
|
|
|
|
the some of the bytes in the particular alphanumeric field is numeric. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
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... |
|
Back to top |
|
|
kothai
New User
Joined: 01 Sep 2008 Posts: 32 Location: chennaii
|
|
|
|
hi Binop & Dick
Thanks a lot....
Regards,
Kothai. E |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
And the requested information remained unposted. . . . |
|
Back to top |
|
|
kothai
New User
Joined: 01 Sep 2008 Posts: 32 Location: chennaii
|
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Kothai,
what does the emoticon suggest...
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. |
|
Back to top |
|
|
|