× 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.



      C/EXEC SQL 
      C+ prepare stmt from :sqlsmt
      C/END-EXEC 

      C/EXEC SQL 
      C+ Declare C1 cursor for stmt
      C/END-EXEC 
 
      C/EXEC SQL 
      C+ Open C1 
      C/END-EXEC 
 
      C/EXEC SQL 
      C+ Fetch C1 into...
      C/END-EXEC 

However, the following is the bees knees
http://archive.midrange.com/rpg400-l/200402/msg00439.html

Rob Berendt
-- 
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





THarteau@xxxxxxxxxxxxxxxxxx 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
04/21/2004 10:49 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Subject
SQL Variable Declare Statement







Hi,
      I need to read a file in the sequence specified by the user.   I 
have
used the execute immediate to use variables on an update, but can I do the
same kind of thing on a declare statement?  I have set up fields that will
hold the field names. For example:

0275.00 C                   IF        InSrt1 = 'P'
0276.00 C                   EVAL      L1Fld = 'JDPSYS'
0278.00 C                   ENDIF
0279.00 C                   IF        InSrt1 = 'B'
0280.00 C                   EVAL      L1Fld = 'JDBPRT'
0282.00 C                   ENDIF
0296.00 C                   IF        InSrt2 = 'P'
0297.00 C                   EVAL      L2Fld = 'JDPSYS'
0299.00 C                   ENDIF
0300.00 C                   IF        InSrt2 = 'B'
0301.00 C                   EVAL      L2Fld = 'JDBPRT'
0303.00 C                   ENDIF

Then I create the select and order by:

0117.04 C                   EVAL      SelSmt =
0117.05 C                             'SELECT * FROM JTD WHERE JDJBT#
= :JOBNO'
0117.07 C                   EVAL      SqlSmt =
0117.08 C                             SelSmt + 'ORDER BY ' + L1Fld + ',' +
L2Fld
0117.09 C                              + ',' + 'JDPROD'

I'm not sure how to now set up the declare. Any ideas?


<===================================================>

Terri Harteau
Felker Brothers Corporation
****************
Paperwork is like kudzu. Both need to be pruned regularly. Usually, a
flamethrower is overkill.      Usually.
****************






_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.