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

Removing spaces from alphanumeric field


IBM Mainframe Forums -> Java & MQSeries
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Fri Jan 09, 2009 4:51 pm
Reply with quote

I am having an Alphanumric field (A50).I need to remove the spaces from the present in that.

I used compress leaving no spaces but it is not working.

Code:

DEFINE DATA                           
LOCAL                                 
1 #I   (A25)                         
END-DEFINE                           
INPUT #I                             
COMPRESS #I INTO #I LEAVING NO SPACE 
DISPLAY #I                           
END                                   


  RESULT
                         
 #I abcd efg hij klmnio pqr
                           
            #I             
 ------------------------- 
                           
 ABCD EFG HIJ KLMNIO PQR   
                         


Am i missing something,any other workaround to achieve the same ??
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Jan 09, 2009 8:30 pm
Reply with quote

Can you display #I in a hex format to insure that the apparent 'spaces' are really x'40's?
Back to top
View user's profile Send private message
monasu1998

Active User


Joined: 23 Dec 2005
Posts: 176
Location: India

PostPosted: Sun Jan 11, 2009 5:50 pm
Reply with quote

Hi beruoist,

If you want to remove the trailing spaces from the string then try the EXAMINE FULL with delete option.
e.g. EXAMINE FULL #string ' ' DELETE

beruoist wrote:
I am having an Alphanumric field (A50).I need to remove the spaces from the present in that.

I used compress leaving no spaces but it is not working.

Code:

DEFINE DATA                           
LOCAL                                 
1 #I   (A25)                         
END-DEFINE                           
INPUT #I                             
COMPRESS #I INTO #I LEAVING NO SPACE 
DISPLAY #I                           
END                                   


  RESULT
                         
 #I abcd efg hij klmnio pqr
                           
            #I             
 ------------------------- 
                           
 ABCD EFG HIJ KLMNIO PQR   
                         


Am i missing something,any other workaround to achieve the same ??
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> Java & MQSeries

 


Similar Topics
Topic Forum Replies
No new posts To Unstring spaces in a field COBOL Programming 3
No new posts Help required to reset decimal points... DFSORT/ICETOOL 10
No new posts how to complete the end of a record w... DFSORT/ICETOOL 2
No new posts BPXBATCH SFTP to remote path having s... All Other Mainframe Topics 6
No new posts Sorting Date Field DFSORT/ICETOOL 4
Search our Forums:


Back to Top