Sybernet / Supplied Functions Reference
Release 3.00
Oct 14, 2002
backwards forwards

HTTP.SP_PRINT

Sybercron is not the easiest process to explain. The fact that it happens behind the scenes only complicates its explanation. If you are familiar with Sybercron, you know that it can send e-mail, create files, and run shell scripts, but it is not capable of doing more than one of these tasks at a time. But it is possible, however, to accomplish this feat by having Sybercron schedule itself in your stored procedure. sp_print is such a procedure.

sp_print is a function that allows you to create a disk file and then print that file to a true printer device. It does all of this in one procedure call.

Syntax

FUNCTION SP_PRINT
(
    BUTTON                        VARCHAR2
,   PROCNAME                      VARCHAR2
,   PARAM1                        VARCHAR2
,   PARAM2                        VARCHAR2
,   PARAM3                        VARCHAR2
,   SHELLSCRIPT                   VARCHAR2
,   FILENAME                      VARCHAR2
,   DEVICENAME                    VARCHAR2
,   SENDER                        VARCHAR2
,   CONFIGURATION                 VARCHAR2
)
RETURN NUMBER;

Parameters

Parameter Description
button
 
For internal use.
procname
 
The name of your stored procedure.
param1
 
An optional parameter passed to your procedure by position.
param2
 
An optional parameter passed to your procedure by position.
param3
 
An optional parameter passed to your procedure by position.
shellscript
 
The name of the shell script that will print the output result of your stored procedure.
filename
 
The name of the disk file that is created. If not specified, a unique filename will be invented.
devicename
 
A valid device name from the table HTTP.CRON_DEVICENAMES.
sender
 
Your e-mail address.
configuration
 
The name of the configuration file to be passed to html2ps.

Returns

The ROW_ID of this entry in the HTTP.CRON table.

Example 1

The following example illustrates how to call sp_print.

declare
    row_id binary_integer;
begin
    row_id:=sp_print
    (
        PROCNAME => 'sp_HelloWorld'
    ,   SHELLSCRIPT => 'HTML2PS.csh'
    ,   DEVICENAME => 'hp5ad136'
    ,   SENDER => 'nospam@nospams.com'
    )   ;
end;

Example 2

Something like Personal Action Reprints would be a good candidate for this facility, and since each print file is no more than a couple of pages, the html2ps converter would be a convenient facility to print these directly to a printer.

The procedure that actually creates the HTML would need two parameters: BUTTON which tells it what to do and EMPLNO which tells it who to do it to.

A cursor, a while loop, and a call to sp_print is about all you will need to accomplish this:

declare
    row_id binary_integer;
begin
    for r in (select * from PS_JOB_CURRENT) loop

        row_id:=sp_print
        (
            PROCNAME    => 'HRPRD.sp_html_reprint'
        ,   PARAM1      => 'REPORT'                  -- corresponds to BUTTON.
        ,   PARAM2      => r.EMPLID                  -- corresponds to EMPLNO.
        ,   SHELLSCRIPT => 'HTML2PS.csh'
        ,   DEVICENAME  => 'hp4mv-ad236'
        ,   SENDER      => 'yamini@unix.sri.com'
        )   ;

     end loop;
end;



Sybernet is a trademark of SRI International.
Copyright © 1996-2008 SRI International. All Rights Reserved.
Denis D. Workman / http://Sybernet.sri.com/