Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
read column into two host variables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Tue Jun 26, 2007 5:13 pm    Post subject: read column into two host variables
Reply with quote

Is it possible to read a column value into more than one host variable, like so :
Code:
SELECT EMPNO INTO :EMP-NO :WS-EMPNO (1) FROM EMP-TAB

If not as shown, is there a way to do this?
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jun 26, 2007 5:42 pm    Post subject: Re: read column into two host variables
Reply with quote

donevin wrote:
Is it possible to read a column value into more than one host variable, like so :
Code:
SELECT EMPNO INTO :EMP-NO :WS-EMPNO (1) FROM EMP-TAB

If not as shown, is there a way to do this?


You can do it with
Code:
SELECT EMPNO, EMPNO INTO :EMP-NO, :WS-EMPNO FROM EMP-TAB

but you can not select into a subscripted host variable.
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Tue Jun 26, 2007 6:24 pm    Post subject:
Reply with quote

Thank you very much Craq. Do you perhaps know why the discrepancy where the subscript is concerned? If the variable is defined as being a table element in Working Storage, surely it could be defined exactly as a non-subscripted host variable?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jun 26, 2007 7:44 pm    Post subject:
Reply with quote

donevin wrote:
Thank you very much Craq. Do you perhaps know why the discrepancy where the subscript is concerned? If the variable is defined as being a table element in Working Storage, surely it could be defined exactly as a non-subscripted host variable?


The DB2 preprocessor does not handle subscripts or indexes. It has to have a fixed address for the host variable, that is why it can't handle items in an FD entry or Link-section items.
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Wed Jun 27, 2007 11:35 am    Post subject:
Reply with quote

Again, thanks a lot Craq.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Need help how to pass the ESP variabl... Venkichaitu JCL & VSAM 12 Thu Nov 02, 2017 3:53 am
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us