× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: re: Universal SQL procedure
  • From: <acomtois@xxxxxxxx> (Alain L. Comtois)
  • Date: Mon, 12 Mar 2001 10:03:22 -0500

Good Morning,

This is my first time i answer for a question, i hope this will help, you can 
use Dynamic Select in SQL to buit your Cursor on the fly the way you want, 
you will have to do a Sub to put in a Variable your SQL selection, in the 
Exemple here the Var name is Dyn_Sel and my cursor is Jrn_Select, use it like 
a regular Cursor.

You can use
 C/EXEC SQL                                         
 C+ PREPARE Jrn_Select FROM :Dyn_Sel                
 C/END-EXEC                                         
 C*                                                 
 C/EXEC SQL DECLARE JR_DETAIL CURSOR FOR Jrn_Select 
 C/END-EXEC                                         
-------------------------------------------------------------------------------
-----------------
Alain Comtois
BPCS Devloper
333 Rue Avro
Pointe-Claire
Quebec
Canada
H9R 5W3
Tel: (514)428-7828
Fax:(514)428-1001
---------- Original Text ----------

From: "Simmerlein, Stefan" <S.Simmerlein@guenther.de>, on 12/3/01 8:23 AM:

Hi guys.
I hope anyone can help me. 

I need an "universal sql procedure" (RPGIV)
The only parameter is the sql-statement
The result of the sql-procedure should be the whole record of the sql or
only the
fields that i have selected in the sql-statement. 

        
Until now we solved the problem on this way.
We have a sql_procedure with 2 parms. 

For Example:
callp   sql_exec('FILENAME':SQL_STATEMENT)

In the procedure we have a select-statement on the filename. 
For every file we have DECLARE, PREPARE, ...... statements and
export-data-structures.

The problem:    
For every new file in the sql-procedure we need a
new cursor/declare/prepare statement and the
export-data-strcuture declaration.

For Example:
d file1_ds      e ds                  extname(file1)   
d file2_ds      e ds                  extname(file2) 
d file3_ds      e ds                  extname(file3)   

How can i make this universal ? With only one cursor declaration and
one global Export-DS ?


Stefan















_______________________________________________________________

Cott - The Leader in Premium Retailer Brand Beverage Innovation. 
_______________________________________________________________
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.