MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Split the SQL result it to multple rows

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Jamylady
Beginner


Joined: 04 Nov 2004
Posts: 68
Topics: 22

PostPosted: Mon Oct 08, 2007 8:17 am    Post subject: Split the SQL result it to multple rows Reply with quote

Hi,
Just wondering..would it be possible to split the query result in to multiple rows?
For example
I have the follwoing Query.
Code:

Select Emp_no, Emp_name, Emp_addr1, Emp_add2, Emp_add3 from EMPLOYEE ;
=============================================

0001 Jimmy  #01, New Lane    Letterkenny     DONEGAL
0002 Kevin  #05, Old Lane     Letterkenny      DOENGAL

and I want this result to be displayed as below
Code:

0001 Jimmy  #01,
                New Lane
                Letterkenny
                DONEGAL
0002 Kevin   #05, 
                Old Lane   
                Letterkenny
                DOENGAL

This is what the user want with a query!!!
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Tue Oct 09, 2007 1:11 am    Post subject: Reply with quote

Jamylady,

Do u have QMF installed in your shop? I guess this is possible thru QMF.
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Tue Oct 09, 2007 1:19 am    Post subject: Reply with quote

Jamylady,

I could not think of a normal SQL solution. Yet I would suggest that this can be done by executing the query via REXX and perform the formatting in REXX itself.
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
mickeygoo
Beginner


Joined: 15 Nov 2007
Posts: 26
Topics: 7

PostPosted: Thu Nov 15, 2007 3:11 pm    Post subject: Reply with quote

You can use DFSORT to reformat the query output:

OUTFIL REMOVECC,
OUTREC=(1,17,/,
17X,18,10,/,
.
.
.

Position and length values in the above are guestimates Very Happy

Basically, print each field (or field combination) in one line, add a carriage return (the "/") in between each field, and padded spaces (the 17x) to indent the 2nd line onward.
_________________
Not an expert, but I did stay at a Holiday Inn... though it has been a while...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group