View previous topic :: View next topic
|
Author |
Message |
job1919
New User
Joined: 19 Jul 2010 Posts: 21 Location: Chennai
|
|
|
|
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 |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
Code: |
select col1 !! strip(char(col2)) !! col3 from ... |
|
|
Back to top |
|
|
job1919
New User
Joined: 19 Jul 2010 Posts: 21 Location: Chennai
|
|
|
|
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 |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
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 |
|
|
job1919
New User
Joined: 19 Jul 2010 Posts: 21 Location: Chennai
|
|
|
|
ok .. Thanks GUYC I ll have a look at them. |
|
Back to top |
|
|
|