MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Select * in easytrive

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
suresh_d
Beginner


Joined: 20 Sep 2006
Posts: 33
Topics: 9

PostPosted: Tue Apr 20, 2010 2:06 am    Post subject: Select * in easytrive Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Apr 20, 2010 11:46 am    Post subject: Reply with quote

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
Code:

JOB INPUT NULL


Btw last but NOT LEAST you need a very good lesson of naming your paragraphs names appropriately . bonk

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
suresh_d
Beginner


Joined: 20 Sep 2006
Posts: 33
Topics: 9

PostPosted: Wed Apr 21, 2010 12:49 am    Post subject: Reply with quote

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 Smile

Thanks,
Suresh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Apr 21, 2010 10:25 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group