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

INSPECT in cobol to format all spaces into single space


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
krk_kumar1

New User


Joined: 14 Mar 2006
Posts: 39

PostPosted: Mon Jul 03, 2006 11:49 am
Reply with quote

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
View user's profile Send private message
chiranjeevi_mca

New User


Joined: 19 Feb 2006
Posts: 27

PostPosted: Thu Jul 27, 2006 11:48 am
Reply with quote

No other functions are there in Cobol except inspect.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Jul 28, 2006 7:11 am
Reply with quote

Why don't you show us a before and after as an example of what you're looking for.
Back to top
View user's profile Send private message
krk_kumar1

New User


Joined: 14 Mar 2006
Posts: 39

PostPosted: Mon Aug 07, 2006 12:55 pm
Reply with quote

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
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Mon Aug 07, 2006 2:59 pm
Reply with quote

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
View user's profile Send private message
krk_kumar1

New User


Joined: 14 Mar 2006
Posts: 39

PostPosted: Mon Aug 07, 2006 3:09 pm
Reply with quote

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
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Mon Aug 07, 2006 3:37 pm
Reply with quote

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
View user's profile Send private message
krk_kumar1

New User


Joined: 14 Mar 2006
Posts: 39

PostPosted: Mon Aug 07, 2006 3:53 pm
Reply with quote

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
View user's profile Send private message
khannay2k

New User


Joined: 24 Feb 2005
Posts: 28
Location: Bangalore

PostPosted: Mon Aug 07, 2006 5:01 pm
Reply with quote

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
View user's profile Send private message
krk_kumar1

New User


Joined: 14 Mar 2006
Posts: 39

PostPosted: Mon Aug 07, 2006 5:34 pm
Reply with quote

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
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Mon Aug 07, 2006 7:25 pm
Reply with quote

The answer then is no, there is no equivalent Cobol function.
Back to top
View user's profile Send private message
krk_kumar1

New User


Joined: 14 Mar 2006
Posts: 39

PostPosted: Mon Aug 07, 2006 7:37 pm
Reply with quote

Thank you all for your response.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top