Consultor Eletrônico



Kbase P110851: How to remotely generate and print a report in an AppServer batch Progress session?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/11/2005
Status: Unverified

GOAL:

How to remotely generate and print a report in an AppServer batch Progress session?

GOAL:

How to start a batch Progress session on the AppServer to generates and prints a report?

FIX:

The following three procedures demonstrate how to remotely run an AppServer 4GL procedure that will spawn a new batch Progress session to generate and print a report:
1. The client side calling procedure "RunBatchReportOnAppServer.p ":
/* Procedure Name: RunBatchReportOnAppServer.p */
/* This is the client side procedure that connects */
/* to the AppServer and runs the remote procedure */
/* AppServerRunCustomerBatchReport.p on the AppServer */
DEFINE VARIABLE hAppServerHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE lReturnedResult AS LOGICAL NO-UNDO.
DEFINE VARIABLE cAppServerStatusMessage AS CHARACTER NO-UNDO.
CREATE SERVER hAppServerHandle.
assign
lReturnedResult = hAppServerHandle:CONNECT ("-AppService asbroker1 -H yshanshi2000 -S 5162").
IF NOT lReturnedResult THEN
MESSAGE "Failed to connect to AppServer"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
ELSE DO:
RUN AppServerRunCustomerBatchReport.p ON hAppServerHandle (OUTPUT cAppServerStatusMessage).
MESSAGE cAppServerStatusMessage
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
ASSIGN
lReturnedResult = hAppServerHandle:DISCONNECT().

DELETE OBJECT hAppServerHandle.
2. The AppServer side called procedure "AppServerRunCustomerBatchReport.p":
/* Procedure Name: AppServerRunCustomerBatchReport.p */
/* This procedure is run remotely from the client */
/* It starts an AppServer batch Progress session to */
/* print the desired report. */
DEFINE VARIABLE cCommandLine AS CHARACTER NO-UNDO.
DEFINE OUTPUT PARAMETER cAppServerStatusMessage AS CHARACTER NO-UNDO.
ASSIGN
cCommandLine = 'C:\Progress91E\bin\prowin32.exe sports2000 -b -p C:\WRK91E\GenerateCustomerReport.p'.

OS-COMMAND SILENT VALUE(cCommandLine).
IF ERROR-STATUS:ERROR THEN
cAppServerStatusMessage = "some error occurred".
ELSE
cAppServerStatusMessage= "executedbatch command".
3. The AppServer side procedure that runs in the Progress batch mode session to generate and print the report:
/* Procedure Name: GenerateCustomerReport.p */
/* This is the AppServer side procedure that */
/* is run in the batch session and that */
/* generates and p[rints the actual report */
OUTPUT TO PRINTER.
FOR EACH customer NO-LOCK WHERE Custnum > 10 AND Custnum < 20:
PUT UNFORMATTED
custnum FORMAT "ZZZZZ" AT 1
NAME FORMAT "X(30)" TO 37
SKIP.
DOWN WITH FRAME a.
END.