I am posting again on this topic after a long time.
I implemented this solution (per Bhanu's suggestion with a slight difference) as follows:
1. Stored report requests entered by users in a SQL Server database table.
2. Wrote a fex which reads the first request from the table that satisfies the selection criteria based on status and datestamp on it. (status 0 [new request] or 1 with date in last period [processed last reporting period with error] or 2 with date in last period [processed successfully in last period] )
3. Scheduled the fex in 2 to run every minute.
The fex (see below) has statements to
a) Update the database record picked in 2 with status = 1 and the datestamp (using a stored procedure)
b) Execute the fex that creates the compund report
c) Update the database record with status = 2 and datestamp (using stored procedure)
ENGINE SQLMSS SET DEFAULT_CONNECTION CONN1
SQL SQLMSS PREPARE SQLOUT FOR
-* Get all the merchant deck requests
select .......
;
END
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS TEMPFILE FORMAT ALPHA
END
-RUN
-SET &&RECCOUNT = 0;
-*
-READ TEMPFILE NOCLOSE &REQID.A10. &RPTID.I11. &&RPTNAME.A150. &RPTLEVEL.A5. &RPTLVLID.A10V. &DUMMY.I11.
-IF &IORETURN NE 0 THEN GOTO EXITPROC;
-*
-*
-SET &REQID=TRUNCATE(&REQID);
-SET &RLVLID = SUBSTR(17, &RPTLVLID, 7, 17, 10, 'A10');
-SET &OUT_FILE= &&MDECKFOLDER || 'output\' || &REQID || '.pdf';
FILEDEF RPT DISK &OUT_FILE
-*
-* Get the options for this report
-*=================================
EX GetOptions RPTID='&RPTID', REQID='&REQID'
-RUN
-* Get the list of stores to include
-*=================================
EX GetStors RPTLEVEL='&RPTLEVEL', RPTLVLID='&RLVLID', REQID='&REQID'
-RUN
-*=================================
-* Set the status for this request to indicate that it is being run
EX setstartstatus REQID=&REQID, TODAY=&TODAY
-RUN
-*=================================
-* Now run the report
EX m_deck GRPRTMNTH='&GRPRTMNTH', GRPRTYR='&GRPRTYR', MNTHNAME='&MNTHNAME', REQID=&REQID, RPTLEVEL='&RPTLEVEL', RPTLVLID='&RLVLID'
-RUN
-*=================================
-* Set the status for this request to indicate that it is completed
EX setendstatus REQID=&REQID, TODAY=&TODAY
-RUN
-*
-*=================================
-* Now rename the fiel to the right name format
-SET &DOSCMD='MoVe '| &OUT_FILE | ' "' |&&MDECKFOLDER|| 'output\'|| &&RPTNAME || '-' || &REQID ||'-'||&GRPRTMNTH || &GRPRTYR ||'.pdf"';
-*TYPE &DOSCMD
-DOS &DOSCMD
-RUN
-EXITPROC
The issues I am facing are
a) The fex seems to take longer to execute when compared to the time it takes when I execute it by hand (The reports on an average take 15 to 20 seconds when run by hand. There are some that take a minute or over).
b) Whenever a new instance of the fex is spawned (on the next minute) by the Reportcaster before the previous instance has terminated, the new instance seems to get hung up because the database table has been locked by the previous instance. I confirmed this by trying to open the table in the SQL Server Management Stodio. How do I unlock the table soon after the stored procedure(s) has run?
I had expected the 500 requests to get processed in less than 1000 minutes (or 16 hours), assuming an average processing time of two minutes per report, but it goes on for a much much longer time.
Any help in resolving these two issues would be much appreciated.
7.6.4/Windows 2k/