Error in compiling embedded SQLRPGLE in full free format

Tags:
AS 400
RPGLE
SQL
SQLRPGLE
Hi everyone - here's a question from a user in regards to SQLRPGLE: I have written some simple embedded SQL PGMS in COBOL in AS/400, compiled and run successfully. But I am not able to do so in full free format RPGLE. Here is the RPGLE code that doesn't compile.
dcl-s sql_RCONAME char(20) ;
exec sql
select RCOCD
into :sql_RCONAME
from RPFCOMP ;
where RCOCD = 'R'
dsply sql_RCOCD ;

*INLR = *on ;
RPFCOMP is the PF, RCOCD and RCONAME are fields in PF
I compiled with option '14' in PDM as well as with command 'CRTSQLRPGI OBJ(RRDSAASQL) SRCFILE(QRDSSRC) COMMIT(*NONE)'. Error in SQL pre-compiler is same in both the cases, i.e, 'SQL0053 10 No SQL statements found.' I don't know where the mistake is. Could someone point out the mistake in the code for a full free format RPG. Thanks!
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Very little full free form RPG code used here but do use embedded SQL a lot.

Here is an example of some of how ours is set up, I can’t see there should be much of a difference.
C/EXEC SQL                                                          
C+    DECLARE OHR CURSOR FOR                                        
C+       SELECT OHORD#, OHBTKY, OHSPO#, OHENTD, OHHOLD 
C+       FROM  OH                                                   
C+       WHERE OHHOLD = 'E'       
C+       AND OHPRKY <> 'NO_CHRG'                                     
C/END-EXEC                                                          
C/EXEC SQL                                                          
C+    OPEN OHR                                                      
C/END-EXEC

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TheRealRaven
    At a quick look, the only obvious error is the extra semi-colon after the table specification, before the WHERE clause.

    A couple extra bits of info are needed. What is the OS version/release? And is that the exact source, or is it only a copy/paste from a green-screen edit? If it's exact source, it doesn't seem to be in the right starting columns.
    33,220 pointsBadges:
    report
  • BradRDoyle
    Put the semi-colon after the where claude
    10 pointsBadges:
    report
  • azohawk

    Is the source type SQLRPGLE?

    4,015 pointsBadges:
    report
  • TheRealRaven
    If compiled by command, the source type doesn't matter. The source type is referenced by utility functions such as PDM to determine which command to run; compilers don't care.
    33,220 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: