Printing Results from the Server

You can print the results from an Production Reporting program directly from the server. Printing directly from the server avoids the network overhead required to transfer the results back to the client for printing. Using asynchronous mode to run reports also frees up the client application to perform other operations.

*  To print the results from the server:

  1. Log into the server.

    Use a login configured to work with Production Reporting Remote. You should be able to use this login with the RemoteRun method.

  2. Create the script with the filename printsqr.sh and set its execute permission.

    The script uses the first parameter as the Production Reporting program filename and the second parameter as the database connectivity. The script also uses the $$ value to generate a unique LIS filename to avoid multi-user conflicts. The script also passes to Production Reporting the -f$LIS_FILE parameter to generate the specified LIS file and the -PRINTER:ps parameter to generate Postscript output. Finally, the script uses the UNIXD command lp to print the results.

    This example shows a Bourne shell script. Adjust the script as necessary to fit the needs of your particular server environment.

    #!/bin/sh
    . .profile
    LIS_FILE=$$.spf
    sqr "$1" "$2" -f$LIS_FILE -PRINTER:ps < /dev/null
    if [ $? -eq 0 ]; then
    Production Reporting ActiveX Control
    44 Using Production Reporting Activator
    lp $LIS_FILE
    fi
    rm $LIS_FILE
  3. Start theSQR Production Reporting Activator Visual Basic sample program on the client.

  4. Open a connection to the server using Production Reporting Remote by selecting Remote Connect.

  5. Copy the sample Production Reporting program customer.sqr to the server account by selecting Remote Put under the Production Reporting menu. Then:

    1. Enter customer.sqr into the local file and remote file input fields.

    2. Select the radio button text transfer and click OK.

  6. Execute the following command asynchronously (with no wait) on the server by selecting Remote Exec No Wait under the Production Reporting menu.

    printsqr.sh customer.sqr dblogin/dbpasswd

Following is the Visual Basic code to invokes the printsqr.sh script on the server. Adjust the values of myserver, mylogin, mypasswd, dblogin, and dbpasswd to fit your particular environment. To run an Production Reporting program other than customer.sqr, specify the filename of that Production Reporting program. Note how the following code assumes that the Production Reporting program already exists on the server. This avoids copying the Production Reporting program file to the server upon each run and also avoids multi-user conflicts.

Sqr0cx.RemoteConnect("myserver", "mylogin", "mypasswd"," ")
Sqr0cx.RemoteExecNoWait("printsqr.sh customer.sqr
dblogin/dbpasswd", "output.txt")
Sqr0cx.RemoteDisconnect