|
View previous topic :: View next topic
|
| Author |
Message |
donevin
New User
Joined: 07 Jun 2005 Posts: 70 Location: South Africa
|
|
|
|
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 |
|
 |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
| 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 |
|
 |
donevin
New User
Joined: 07 Jun 2005 Posts: 70 Location: South Africa
|
|
|
|
| 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 |
|
 |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
| 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 |
|
 |
donevin
New User
Joined: 07 Jun 2005 Posts: 70 Location: South Africa
|
|
|
|
| Again, thanks a lot Craq. |
|
| Back to top |
|
 |
|
|