View previous topic :: View next topic
|
Author |
Message |
krk_kumar1
New User
Joined: 14 Mar 2006 Posts: 39
|
|
|
|
Hi,
Is there any function other than using INSPECT in cobol to format all spaces into single space as we have space() in rexx. thanks in advance. |
|
Back to top |
|
|
chiranjeevi_mca
New User
Joined: 19 Feb 2006 Posts: 27
|
|
|
|
No other functions are there in Cobol except inspect. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Why don't you show us a before and after as an example of what you're looking for. |
|
Back to top |
|
|
krk_kumar1
New User
Joined: 14 Mar 2006 Posts: 39
|
|
|
|
Hi,
sorry ,for my late reply.
This is how the input will be "Jhon f franklin jr" and the output should be "jhon f franklin jr" |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
Puzzled as to what you are asking!
Is it to compress multiple spaces to one space(re first post) or to convert upper case to lower case ,(2nd post)?
Solution to second post is using INSPECT ie
INSPECT Item-1
CONVERTING
?ABCDEFGHIJKLMNOPQRSTUVWXYZ ?
TO
?abcdefghijklmnopqrstuvwxyz ? |
|
Back to top |
|
|
krk_kumar1
New User
Joined: 14 Mar 2006 Posts: 39
|
|
|
|
sorry it was a typing error. there are no uupercase letters.actually the input will be "jhon f franklin jr" and the output should be ""jhon f franklin jr" . For conversion from lower case to upper case we are already using UPPER-CASE cobol function. |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
OK , now could you please describe the difference between your input and output example, just so I understand what you are trying to achieve.
I can see one extra " at the beginning of the output , is that it? |
|
Back to top |
|
|
krk_kumar1
New User
Joined: 14 Mar 2006 Posts: 39
|
|
|
|
Sorry for a small mistake again actullay i'am tring to give "jhon####f###franklin### jr" as input and i'am expecting output as "jhon#f#franklin#jr" where # is space.
Note: in my previous post i gave the input ("jhon f franklin jr") with many spaces in between but the website is converting the multiple spaces into single space. |
|
Back to top |
|
|
khannay2k
New User
Joined: 24 Feb 2005 Posts: 28 Location: Bangalore
|
|
|
|
Kumar,
I dont know why you wanna go with out INSPECT, as this one looks best option for your kind of tasks.
I am not sure this might work for you, but i think you can try with STRING and UNSTRING.
STRING you can remove all the spaces in the identifier but to UNSTRING to with single space you need to catch the alphabet, think on this.
Correct me if am wrong.
waiting for ANS
Khanna |
|
Back to top |
|
|
krk_kumar1
New User
Joined: 14 Mar 2006 Posts: 39
|
|
|
|
Khanna,
Actually I've already written a logic to convert all spaces into single space.Just wanted to know whether there is any explicit function in COBOL to convert multiple spaces into single space. Like we have Space() in REXX to convert multiple spaces into single space or UPPER-CASE funtion in cobol to convert all lower case letters to upper case.
Thanks for your response. |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
The answer then is no, there is no equivalent Cobol function. |
|
Back to top |
|
|
krk_kumar1
New User
Joined: 14 Mar 2006 Posts: 39
|
|
|
|
Thank you all for your response. |
|
Back to top |
|
|
|