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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Java & MQSeries

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts Cobol program with sequence number ra... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top