Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
INSPECT in cobol to format all spaces into single space

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: INSPECT in cobol to format all spaces into single space
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    Post subject:
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    Post subject:
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    Post subject: Re: INSPECT in cobol to format all spaces into single space
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    Post subject: Re: INSPECT in cobol to format all spaces into single space
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    Post subject: Re: INSPECT in cobol to format all spaces into single space
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    Post subject: Re: INSPECT in cobol to format all spaces into single space
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Re: INSPECT in cobol to format all spaces into single space
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    Post subject:
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    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 Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts More than 1 Include criteria for sing... Roy Ware SYNCSORT 6 Wed Sep 13, 2017 11:45 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us