View previous topic :: View next topic
|
Author |
Message |
barobaybay
New User
Joined: 22 Jul 2005 Posts: 12 Location: Philippines
|
|
|
|
i need to get all columns in a table by using easytrieve I have part of the ezytriev code below, but sadly, it only writes back my id_number into the output file.
What am i missing? any samples?
Thanks in advance!
Code: |
SQL DECLARE CSR1 CURSOR FOR +
SELECT * +
FROM DB2SYS.SOMETABLE +
WHERE ID_NUMBER = :WS-ID-NUMBER +
WITH UR
JOB INPUT NULL
GET INF1
DO WHILE NOT EOF INF1
WS-ID-NUMBER = ID-NUM
SQL OPEN CSR1
SQL FETCH CSR1 +
INTO :WS-ID-QUERY
IF SQLCODE NE 0 AND SQLCODE NE 100
DISPLAY 'FETCH FAILED: ' SQLCODE
ELSE
IF SQLCODE = 0
OUTREC1 = WS-ID-QUERY
PUT OUTRJCT
ELSE
DISPLAY 'ID NUMBER NOT FOUND:' WS-ID-NUMBER
END-IF
END-IF
SQL CLOSE CSR1
GET INF1
END-DO
STOP |
|
|
Back to top |
|
|
barobaybay
New User
Joined: 22 Jul 2005 Posts: 12 Location: Philippines
|
|
|
|
mods, sorry, can we move my topic to the CA Products forum? thanks |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
You have to write your sql in
EXEC sql
ENd EXEC' |
|
Back to top |
|
|
barobaybay
New User
Joined: 22 Jul 2005 Posts: 12 Location: Philippines
|
|
|
|
sorry, I can exec the SQL statement, but what i want to happen is to put the results of my query onto the output file... |
|
Back to top |
|
|
barobaybay
New User
Joined: 22 Jul 2005 Posts: 12 Location: Philippines
|
|
|
|
good news guys! thanks for this post: ibmmainframes.com/viewtopic.php?t=12436&sid=bb869b04d72055436fcdd8cbd331d269
last post(or one of the last) ont the above topic basically reminds us to include each of the fields and put it into the host variable. just remember which data type of the field is the equivalent data type in the ezytriev program... great! problem solved! now it's possible to have several (100+) records as input and look them up directly from the table...
you guys rock! i love this forum! |
|
Back to top |
|
|
chiranjeevi_mca
New User
Joined: 19 Feb 2006 Posts: 27
|
|
|
|
i don't know the easytrive
but for that the query is
select name from sysibm.syscolumns where table='tablename' |
|
Back to top |
|
|
chiranjeevi_mca
New User
Joined: 19 Feb 2006 Posts: 27
|
|
|
|
Hi,
i understand what you written.
but i want to know you need the column names of the table
or
you need to retrieve all the data from that table.
if you need columns, the above posted topic is the write query
if you need the data, you are not getting even a single row from your table.
that's why it's displaying your id. |
|
Back to top |
|
|
|