okay so I have different reports to print and some reports need a stored proc 
called before the report can be produced to set some vars and create the 
reports temp tables so I have a variety of different report sps to accomplish 
this and in this report printing proceedure I set a var tdvPrintReportCode to 
the reports sp like 'call ReportSp ( )' .  When I print these reports by 
themselves I do a &tdvPrintReportCode that runs the sp and works great.  

Now sometimes users need to print a variety of reports so they 'que' them and 
then I create a cursor that runs threw all the qued reports and prints them one 
at a time BUT when the report requires the stored proc to run I get a 
'Unrecognized Entry/Exit proceedure' error when it hits the &tdvPrintReportCode 
line and the sp doesn't run.  If I hard code 'call ReportSp ( )' in lew of 
&tdvPrintReportCode works but since I have a bunch of these I really don't want 
add a line for every sp.  Any idea why &tdvPrintReportCode with in the cursor 
gives me that error?

here's the full cursor code..

SET WHILEOPT OFF
         drop cursor GetReports
         DECLARE GetReports CURSOR FOR SELECT 
PrintReportCode,ReportTitle,ReportTypeID,ReportID     +
         FROM attZAppReports_Selected
         OPEN GetReports
         FETCH GetReports INTO 
tdvPrintReportCode,tdvReportTitle,tdvReportTypeID,tdvReportID
         WHILE SQLCODE <>100 THEN
            SET VAR vAlertCap TEXT =('Printing report'&.tdvReportTitle)
            SET VAR vAlertHdr TEXT ='Please Wait..'
            EDIT USING ZGenAppAlertNoPaus2 MDI AS 'PleaseWait'

            SWITCH (.tdvReportTypeID)
               CASE '1'
                  --A Scanned In Form
                  SET VAR RptvReportName TEXT= ('highwareForms WHERE 
ReportID=.tdvReportID')
                  BREAK
               CASE '2'
                  --Instructions To Print a Report
                  SET VAR RptvReportName TEXT= ('highwarePrintRptsInstructions 
WHERE ReportID=.tdvReportID')
                  BREAK
               CASE '3'
                  --A Trans or Customer Information Report
                  &tdvPrintReportCode
                  BREAK
               CASE '4'
                  --Cust Scanned Doc
                  SET VAR RptvReportName TEXT= ('CustScannedDoc WHERE 
ReportID=.tdvReportID and ReportTypeID=4')
                  BREAK
            ENDSW
            IF RptvPrintReport = 'N' THEN
               CLOSEWINDOW 'PleaseWait'
               SET VAR vAlertCap TEXT = ('No Report Data.')
               SET VAR vAlertHdr TEXT = ('No records for 
report'&.tdvReportTitle)
               SET VAR vAlertMsg TEXT = (.RptvReportErrorMsg)
               EDIT USING zGenAppAlertOkay
            ELSE
               IF vResponse ='Y' THEN
                  SET VAR tdvPrdRptFilename TEXT = 
(.tdvRptFilename+CTXT(.tdvMergedFileCnt)+'.pdf')
                  SET VAR tdvPrintReportCodeFnl TEXT = ('PRINT 
'+.RptvReportName +' OPTION PDF | FILENAME 
'''+.tdvFileDir+'\'+.tdvPrdRptFilename+''' | BACKGROUND_COLOR WHITE | AUTHOR 
'+.gvUserName +'| OPEN Off')
               ELSE
                  SET VAR tdvPrintReportCodeFnl TEXT =('PRINT '+.RptvReportName 
+'  OPTION SCREEN|ZOOM_TYPE 100_PERCENT')
               ENDIF
               &tdvPrintReportCodeFnl
               CLOSEWINDOW 'PleaseWait'
               IF vResponse ='Y' THEN
                  SET VAR tdvCheck4FileName = 
(.tdvFileDir+'\'+.tdvPrdRptFilename)
                  SET VAR tdvCheck4Dir = (CHKFILE(.tdvCheck4FileName ))
                  IF tdvCheck4Dir='1.' THEN
                     SET VAR vAlertCap TEXT = ('Report Okay.')
                     SET VAR vAlertHdr TEXT = ('Report File Produced.')
                     SET VAR vAlertMsg TEXT = 
('Report'&.tdvReportTitle&'produced PDF 
file'&.tdvFileDir+'\'+.tdvPrdRptFilename)
                     EDIT USING zGenAppAlertOkay
                     SET VAR tdvLastMergedRpt TEXT = 
(.tdvFileDir+'\'+.tdvPrdRptFilename)
                     SET VAR tdvMergedFileCnt INTEGER = (.tdvMergedFileCnt + 1)
                     IF tdvMergedFileCnt ='1' THEN
                        OUTPUT C:\Temp\Rpts\MrgCntrlFile.txt
                     ENDIF
                     WRITE .tdvLastMergedRpt
                  ELSE
                     SET VAR vAlertCap TEXT = ('Report Error.')
                     SET VAR vAlertHdr TEXT = ('No Report File Produced.')
                     SET VAR vAlertMsg TEXT = ('For some 
reason'&.tdvReportTitle&' didn''t produce a PDF file and will not be added to 
the final merged report.')
                     EDIT USING zGenAppAlertOkay
                  ENDIF
               ENDIF
            ENDIF
            SET VAR tdvPrintReportCodeFnl TEXT = NULL
            SET VAR tdvPrintReportCode TEXT = NULL
            SET VAR tdvReportTitle TEXT = NULL
            SET VAR tdvReportID INTEGER ='0'
            SET VAR tdvReportTypeID INTEGER ='0'
            SET VAR RptvPrintReport TEXT = 'Y'

            DROP TABLE 
attSale_SalePayer_PayerItem_CustIns_Cust_MedPro,attCustIntake,attCustDXCodes,attCustFacilityAdd,attPayerDXCodes,attRptADMCData,attRptAuthorizationRequestData,attRptCertOfMedNec,att_RptPMDPresciption,att_SaleAndCustInfo,att_TransPayer

            FETCH GetReports INTO 
tdvPrintReportCode,tdvReportTitle,tdvReportTypeID,tdvReportID
         ENDWHILE
         DROP CURSOR GetReports

Reply via email to