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



Ops.  That's correct.  Thanks Michael. 

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Michael_Schutte@xxxxxxxxxxxx
Sent: Friday, April 07, 2006 1:40 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: AW: Compiler error RNF5377 with embedded SQL

Should at least be....

%Trim(W03LastNm)

Michael Schutte
Work 614-492-7419
email  michael_schutte@xxxxxxxxxxxx


 

             "Lim Hock-Chai"

             <Lim.Hock-Chai@us

             amobility.com>
To 
             Sent by:                  "RPG programming on the AS400 /

             rpg400-l-bounces@         iSeries" <rpg400-l@xxxxxxxxxxxx>

             midrange.com
cc 
 

 
Subject 
             04/07/2006 02:34          RE: AW: Compiler error RNF5377
with 
             PM                        embedded SQL

 

 

             Please respond to

              RPG programming

              on the AS400 /

                  iSeries

             <rpg400-l@midrang

                  e.com>

 

 





It will make the program easier to understand and run faster if you
change those sql statements to be something like below:

D searchThis      S            500A   varying

C/EXEC SQL
C+ DECLARE PREMCSR SCROLL CURSOR FOR
C+   select CUJGTX, CUJHTX
C+      from COREDTA10/RECUREP
C+             where upper(CUJGTX) like :searchThis
C+             order by CUJGTX, CUJHTX
C/END-EXEC

C                   eval      searchThis = '%'+ W03LastNm + '%'


C/EXEC SQL
C+ OPEN PREMCSR
C/END-EXEC

C/EXEC SQL
C+ FETCH NEXT FROM PREMCSR
C+ INTO :W02LastNm, :W02FirstNm
C/END-EXEC


Note: Remember to close and reopen the cursor everything the search
criteria changed.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Valerio Vincenti
Sent: Friday, April 07, 2006 12:27 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: AW: Compiler error RNF5377 with embedded SQL

Here are my stand alone fields:

D Select1         S            100A   INZ('select CUJGTX, CUJHTX from
-
D                                     COREDTA10/RECUREP where -
D                                     upper(CUJGTX) like')
DOrderBy          S            100A   INZ('order by CUJGTX, CUJHTX')
D Quote           S              1A   INZ('''')
D SQLStmt         S            500A   INZ(' ')

 *
 * Build SQL statement to retrieve records according to request
 *
C                   MOVEL     Select1       SQLStmt
C     SQLStmt       CAT       Quote:1       SQLStmt
C     SQLStmt       CAT       '%':0         SQLStmt
C     SQLStmt       CAT       W03LastNm:0   SQLStmt
C     SQLStmt       CAT       '%':0         SQLStmt
C     SQLStmt       CAT       Quote:0       SQLStmt

C     SQLStmt       CAT       OrderBy:1     SQLStmt

>>> Hauser@xxxxxxxxxxxxxxx 04/07/06 12:23PM >>>
Hi,

it's not an SQL error, but an RPG error.
Are you sure you did not for get an apostrophe to close your string or

something like this?

Just show us how you build your SQL-Statement.

Mit freundlichen Gru?en / Best regards

Birgitta

"Shoot for the moon, even if you miss, you'll land among the stars."
(Les Brown)

-----Ursprungliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx
[ mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von Valerio Vincenti

Gesendet: Freitag, 7. April 2006 17:33
An: rpg400-l@xxxxxxxxxxxx
Betreff: Re: Compiler error RNF5377 with embedded SQL


No, it's fixed format

>>> michaelrtr@xxxxxxxxx 04/07/06 11:22AM >>>
Are you trying to do free form RPG? Embedded SQL (until V5R4) requires

fixed
format. the rest of your code can be free format, but the SQL stuff
needs a /End-Free above it to seperate it from free form.

On 4/7/06, Valerio Vincenti < vvincenti@xxxxxxxxxxxxxxxxxx > wrote:
>
> I'm having trouble compiling a QRPGLESRC program that uses embedded
SQL.
> Let me state first that I'm not very familiar with embedded sql, so
you
> can expect to see something stupid here.
>
> My goal is to have a subfile loaded dynamically with data matching a


> wildcard entered by the user in a field in the SFLCTL format. I need

the
> subfile to be populated with the results of the following sql
> statement:
> select fielda, fieldb from lib/file where upper(fielda) like '%X%'
> (where X is the wild card value from the field in the SFLCTL format.


>
> Following recommendations and examples from a medley of articles that

I
> have gathered about embedding sql, I have defined a stand alone field


> which contains the static part of the sql statement. Then, using CAT,

I
> complete the statement with the dynamic portion (quotes, percent
signs
> and the wild card value) into another stand alone field that I named


> SQLSTMT. So, if the user enters 'AMB', the field SQLSTMT contains:
> select CUJGTX, CUJHTX from COREDTA10/RECUREP where upper(CUJGTX) like


> '%AMB%'
>
> Then I coded the prepare:
> C/EXEC SQL
> C+ PREPARE SEL FROM :SQLSTMT
> C/END-EXEC
>
> followed by the cursor declaration:
> C/EXEC SQL
> C+ DECLARE PREMCSR SCROLL CURSOR FOR SEL
> C/END-EXEC
>
> and the cursor opening:
> C/EXEC SQL
> C+ OPEN PREMCSR
> C/END-EXEC
>
> Finally, in the subfile load routine, I loop thru the result set to 
> populate the subfile:
> C/EXEC SQL
> C+ FETCH NEXT FROM PREMCSR
> C+ INTO :W02LastNm, :W02FirstNm
> C/END-EXEC
>
> When I try to compile using the CRTSQLRPGI command, I get error
> *RNF5377 (The end of the expression is expected.). Below is an
excerpt
> of the compile list where the error occurs (lines 234 thru 241 are
not
> in my code but are added by the compiler):
>
> 228 * Get the next row from the SQL Cursor
> 229 *
> 230 C*EXEC SQL
> 231 C* FETCH NEXT FROM PREMCSR
> 232 C* INTO :W02LastNm, :W02FirstNm
> 233 C*END-EXEC
> *RNF5377 20 226 013400 The end of the expression is expected.
> 234 C Z-ADD -4 SQLER6
> 235 C CALL SQLROUTE
> 236 C PARM SQLCA
> 237 C PARM SQL_00006
> 238 C SQL_00009 IFEQ '1'
> 239 C EVAL W02LASTNM = SQL_00011
> 240 C EVAL W02FIRSTNM = SQL_00012
> 241 C END
>
> As I said, I'm not a sql expert, but I can't see anything wrong with


> that expression.
> Any suggestion would be greatly appreciated.
>
> Thanks!
> Val
>
> Valerio Vincenti
> IT Business Analyst
> County of Spotsylvania, I.S. Department Spotsylvania, VA 22553 Phone 
> (540) 507-7507 Fax (540) 582-9841
> e-mail: vvincenti@xxxxxxxxxxxxxxxxxx
>
> --
> 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 
> .
>
>
--
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 .
--
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 .



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

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


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



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

Follow-Ups:

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.