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
 

 

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 How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


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