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

Split one field into many rows


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

New User


Joined: 23 Mar 2008
Posts: 13
Location: china

PostPosted: Thu Nov 13, 2008 2:58 pm
Reply with quote

has any way split one column(datatype is longvar) into many rows by SQL only?

My requirement is to get proc or query statement from QMF table(Q.OBJECT_DATA) line by line, just like we read proc in QMF proc panel.

if I use query like this:

SELECT APPLDATA
FROM Q.OBJECT_DATA
WHERE
NAME='procname'

result:
-----------------------------
run query q.abc save data as q.data1 run query q.def save data as q.data2
-----------------------------

then I just get proc statement in one row or 2 rows.


How can I get proc statement line by line such as each line only have 79 chars by SQL?
I want result like this:
----------------------
run query q.abc
save data as q.data1
run query q.def
save data as q.data2
----------------------


the table structure is below

Column Name Col No Col Type Length
* * * *
------------------ ------ -------- ------
OWNER 1 VARCHAR 128
NAME 2 VARCHAR 128
TYPE 3 CHAR 8
SEQ 4 SMALLINT 2
APPLDATA 5 LONGVAR 3774
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Thu Nov 13, 2008 3:32 pm
Reply with quote

You can use SUBSTR function on the column you want. This can get you 79 characters, but does not satisfy your requirement. It can be coded as Dynamic embedded SQL inside a program to get what you need.
Back to top
View user's profile Send private message
liangl

New User


Joined: 23 Mar 2008
Posts: 13
Location: china

PostPosted: Thu Nov 13, 2008 5:01 pm
Reply with quote

yes, I know I can use SUBSTR, but the question is I have to use SUBSTR for 47 times, because APPLDATA have 3774 length. Another thing is I don't want to use Dynamic embedded SQL inside a program, so only static SQL statement in QMF. is it still possible to do that?
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts JCL/SORT to Split Records SYNCSORT 28
Search our Forums:

Back to Top