I don't have a close cursor between report runs.  I thought that was only
needed when you declare a cursor.  I'm using PREPARE and EXECUTE.

Should I have the following after each report run:
==========
exec sql
 close (not sure what goes here)
end-exec
==========





"Smith, Mike" <Mike_Smith@xxxxxxxxxxxxxxxx>@midrange.com on 04/22/2005
03:09:56 PM

Please respond to RPG programming on the AS400 / iSeries
       <rpg400-l@xxxxxxxxxxxx>

Sent by:    rpg400-l-bounces+fkany=averittexpress.com@xxxxxxxxxxxx


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

Subject:    RE: Embedded SQL Problem


Do you have a close cursor between report runs?

Michael Smith
iSeries.mySeries.


-----Original Message-----
From: fkany@xxxxxxxxxxxxxxxxxx [mailto:fkany@xxxxxxxxxxxxxxxxxx]
Sent: Friday, April 22, 2005 2:48 PM
To: RPG400-L@xxxxxxxxxxxx
Subject: Embedded SQL Problem



If anyone can help figure out what's going on, I'd appreciate it.
Here's what's happening so far:
========================================================================
=========
Screen 1: User selects the reports they would like to print(Report 1,
Report 2, or Report 3)

<Enter Pressed>

(SQL RPG Program Begins)

If Report 1
callp PRCS_REPORT1
ENDIF

If Report 2
callp PRCS_REPORT2
ENDIF

If Report3
callp PRCS_REPORT3
ENDIF

start PRCS_REPORT1
SQLSTRING = 'DECLARE GLOBAL TEMPORARY TABLE.......'
/EXEC SQL
      PREPARE SQLCMD FROM :SQLSTRING
      EXECUTE SQLCMD
/END-EXEC
end PRCS_REPORT1

start PRCS_REPORT2
SQLSTRING = 'DECLARE GLOBAL TEMPORARY TABLE.......'
/EXEC SQL
      PREPARE SQLCMD FROM :SQLSTRING
      EXECUTE SQLCMD
/END-EXEC
end PRCS_REPORT2

start PRCS_REPORT3
SQLSTRING = 'DECLARE GLOBAL TEMPORARY TABLE.......'
/EXEC SQL
      PREPARE SQLCMD FROM :SQLSTRING
      EXECUTE SQLCMD
/END-EXEC
end PRCS_REPORT3

*INZSR BEGSR
C/EXEC SQL
C+ Set Option
C+     Naming    = *Sys,
C+     Commit    = *None,
C+     UsrPrf    = *User,
C+     DynUsrPrf = *User,
C+     Datfmt    = *iso,
C+     CloSqlCsr = *EndMod,
C+     Commit    = *none
C/END-EXEC
ENDSR

(SQL RPG Program Ends)
========================================================================
=========

I can run Report 1, 2, or 3 one at a time with no problems, but if I
select all 3 reports to print, the 1st report will print, but the
program crashes on the 2nd report.  Am I missing an SQL statement
anywhere?  I'm only using PREPARE and EXECUTE.

Thanks,

Frank





This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 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.