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

Zero Suppression


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
job1919

New User


Joined: 19 Jul 2010
Posts: 21
Location: Chennai

PostPosted: Fri May 06, 2011 10:30 am
Reply with quote

Hi ,

Here is the requirement. I have to fetch 3 columns from table
Table
Col1 x(2) -- AB
col2 9(5) -- 05678
Col3 x(2) -- CD
Iam fetching these 3 cols and writing to one variable as one Key. AB05678CD. Is there any way to suppress the Zero in the middle.

I tried INSPECT which only gets me to spaces i.e 'AB 5678CD'.
I am curious to know if there is any other way. not to mention I also tried reference modification. wondering if there is any other way.

------------------------------------------------------------------------------------
P.s: I did a search for this in the forum but I couldnt. If there is any link please do let me know . I ll take over from there.


Thanks a bunch in advance!!
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Fri May 06, 2011 12:11 pm
Reply with quote

Code:
select col1 !! strip(char(col2)) !! col3 from ...
Back to top
View user's profile Send private message
job1919

New User


Joined: 19 Jul 2010
Posts: 21
Location: Chennai

PostPosted: Tue May 10, 2011 12:29 pm
Reply with quote

HI ,
Sorry about the late response. I got disconnected and could nt come back.

So can i do the above requirement in COBOL ?

To GUYC , the code pasted by you .. could you please explain. its little unclear to me .

Thanks a bunch in advance!!

-RJ ( job1919)
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Tue May 10, 2011 1:01 pm
Reply with quote

Nothing to explain.
This is the DB2 part of the forum so i did it in SQL.
Lookup the DB2 functions :
Char()
strip()
and the operator concat
Back to top
View user's profile Send private message
job1919

New User


Joined: 19 Jul 2010
Posts: 21
Location: Chennai

PostPosted: Tue May 10, 2011 2:51 pm
Reply with quote

ok .. Thanks GUYC I ll have a look at them.
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Zero Suppression with DB2 SQL DB2 4
No new posts space suppression COBOL Programming 13
No new posts Leading spaces suppression COBOL Programming 3
No new posts VB File handling with suppression of ... COBOL Programming 4
No new posts Suppression of trailing spaces in giv... COBOL Programming 6
Search our Forums:

Back to Top