Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts CICS VSAM RLS READ akodakka CICS 3 Tue Oct 04, 2016 3:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us