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



Can you post codes starting from line 134.00 till the FETCH statement?

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Valerio Vincenti
Sent: Friday, April 07, 2006 10:33 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: 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 
> .
> 
> 

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.