View previous topic :: View next topic |
Author |
Message |
suresh_d Beginner

Joined: 20 Sep 2006 Posts: 33 Topics: 9
|
Posted: Tue Apr 20, 2010 2:06 am Post subject: Select * in easytrive |
|
|
Hi,
I have primary keys of several records and wan to extract the whole records into a file. Since the table is too big creating a layout is tedious. So i am thinking of using Sleect * for the entire record. Is this possible ? I tried but it is giving error.
If not possible is there any simple wau to extract records from table with available primary kleys ?
my code and error :
Code: | FILE FILEA SQL
SQL INCLUDE LOCATION * FROM TDB2.TPY002FORS
FILE UTFIL1 FB (475 4750)
U1-RECOD1 1 475 A
*********************************************************************
* DECLARE CURSOR CSR1 *
*********************************************************************
SQL DECLARE CSR1 CURSOR FOR +
SELECT * +
FROM TDB2.TPY002FORS +
WHERE BOLAGKOD = 'AF' AND +
FNR = 1459929 AND +
GRPNR = '001' AND +
OBJEKTNR = 1 AND +
REGTILLF = '2003-06-26-10.31.47.210471' +
WITH UR
*********************************************************************
JOB
SQL OPEN CSR1
*******B014 UNABLE TO RECOGNIZE STATEMENT - SQL
SQL FETCH CSR1 INTO :U1-RECOD1
IF SQLCODE NE 0
DISPLAY '******** DEL ERROR TPY002 *******'
DISPLAY 'SQLCODE ' SQLCODE
DISPLAY '*********************************'
STOP
END-IF
*
*********************************************************************
SLUT1. PROC
DISPLAY ' '
END-PROC |
|
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Apr 20, 2010 11:46 am Post subject: |
|
|
suresh_d,
I don't see a INTO statement. You just can't have JOB statement all alone by itself unless you are using SQL AS INPUT. your JOB statement should be
Btw last but NOT LEAST you need a very good lesson of naming your paragraphs names appropriately .
Kolusu |
|
Back to top |
|
 |
suresh_d Beginner

Joined: 20 Sep 2006 Posts: 33 Topics: 9
|
Posted: Wed Apr 21, 2010 12:49 am Post subject: |
|
|
Hi Kolusu,
Thanks for the suggestions, my errors are resolved, but the query resulted in only one(first) column. Any reasons ?
And regd my naming conventio, I work for a Swedish client and in Swedish SLUT means END
Thanks,
Suresh |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Apr 21, 2010 10:25 am Post subject: |
|
|
suresh_d wrote: | Hi Kolusu,
Thanks for the suggestions, my errors are resolved, but the query resulted in only one(first) column. Any reasons ?
|
Suresh,
Even though you are trying to avoid coding the column names , your INTO clause should have all the working storage variables names defined or else you would only get the first column.
IMHO I think a plain unload of the DB2 table and then an easytrieve pgm for matching 2 files is much efficient and simple to use. Remember that you are running dynamic SQL which in this case is very inefficient.
Kolusu |
|
Back to top |
|
 |
|
|