Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SETLL in SQLRPGLE

Status
Not open for further replies.

annapham

Programmer
Dec 9, 2009
1
0
0
US

My simple program is to display a subfile (self extended subfile) with employee# and name, and a 'position to name:' on subfile control record to start display from this name and forward.

What is wrong with my codings here? Thank you in advance.

D SELECT1 S 500A INZ('SELECT EMPNO, EMPNAME FROM EMP ORDER BY EMPNAME WHERE EMPNAME >= POSITIONTONAME')

C/EXEC SQL
C+ PREPARE SEL FROM :SELECT1
C/END-EXEC
C*
C*
C/EXEC SQL
C+ DECLARE C1 SCROLL CURSOR FOR SEL
C/END-EXEC
*
C/EXEC SQL
C+ OPEN C1
C/END-EXEC
 
Try this :
Code:
D SELECT1         S            500A   VARYING                                 
D                                     INZ('SELECT EMPNO, EMPNAME FROM EMP +   
D                                     ORDER BY EMPNAME +                      
D                                     WHERE EMPNAME >= ')                     
C                   EVAL      SELECT1 += POSITIONTONAME                       
C/EXEC SQL                          
C+ PREPARE ...

Philippe
 
Or using a parameter marker ( ? ) :

D SELECT1 S 500A VARYING
D INZ('SELECT EMPNO, EMPNAME FROM EMP +
D ORDER BY EMPNAME +
D WHERE EMPNAME >= ?')
...
C/EXEC SQL
C+ OPEN C1 Using :pOSITIONTONAME
C/END-EXEC


Philippe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top