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

read column into two host variables


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Error to read log with rexx CLIST & REXX 11
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
Search our Forums:

Back to Top