You have lots of options here.

 If the report is a Hold Entry in the spooler, you can send this to a file
using the (I) 'eye' option of the SP-EDIT command. For example, if you want
to send Entry #42 to a file, enter

SP-EDIT 42 (I)

and you will be prompted for the destination "File name and record key".

A more direct way to accomplish this is with the 'jspcmds' command:

jspcmds COPY "filepath filename" job#

For example, the command...

jspcmds COPY "/tmp/printjobs myjob.txt" 42

will 'copy' hold entry #42 to the '/tmp/printjobs' directory with a
filename of 'myjob.txt'.

Should you wish to also delete the spooler entry then use 'COPYDELETE' in
place of 'COPY' in the above command.

***

A form queue can also be created like this:

        SP-CREATE FILE PROG cat > /tmp/file.txt

When a printjob is despooled, a file will be created in the specified
directory and will be called 'MyPrintFile'. The caveat of this method is
that each time a job is despooled to this queue, it OVERWRITES the previous
file.

***

The most flexible approach is to redirect spooler output to a user-written
Basic program. What this means is that spooler 'output' (stdout) becomes
the 'input' (stdin) to your program. This gives you total control over the
spooler output. A typical program will capture all of the data to a file
and then do something with that 'file' (like email it, convert it to a PDF
or some other format, ftp it to some other machine, etc, the possibilities
are endless). Output can also be handled line-by-line as it is being
despooled.

Here's some code you can start with:

0001     PROGRAM lptext
0002     INCLUDE JBC.h
0003     id = CHANGE(UNIQUEKEY(),'/',']2F') ;* create a unique item-id for
the print job
0004     tempdirname = '/tmp'  ;* This directory must have 'rw' permissions
0005     OPENSEQ tempdirname:DIR_DELIM_CH:id TO outstream ELSE
0006         CREATE outstream ELSE NULL
0007     END
0008     LOOP
0009         numchars = SYSTEM(14)
0010     WHILE numchars DO
0011         INPUT line, numchars
0012         WRITESEQ line ON outstream ELSE NULL
0013     REPEAT
0014     WEOFSEQ outstream ELSE NULL
0015     CLOSESEQ outstream

The next step is to define the form queue. For example, if the program is
cataloged in '/home/bin' then:

SP-CREATE FILE PROG /home/bin/lptext

All that's left to do is assign the queue and print something, e.g.

SP-ASSIGN =FILE
LIST MD SAMPLE 10 LPTR

Note that the above code assumes the system is running jBASE 4 or 5. To get
it to run on jBASE 3 :

1) Replace line 3 with:

    id = SYSTEM(21):'_':DATE():'_':TIME():'_':SYSTEM(9):'_':RND(32000)

2) Replace lines 5 through 7 with:

    OPENSEQ tempdirname:DIR_DELIM_CH:id TO outstream ELSE NULL

3) Add the line:

        openseq_creates = true

to the '$JBCRELEASEDIR/config/Config_EMULATE' file under the appropriate
emulation section, if it does not already exist. This setting allows 'id'
to be created if it does not previously exist.

Hope this helps,

Dan


On Thu, May 2, 2013 at 6:58 PM, troyd1 <[email protected]> wrote:

> I am working on a system that creates print jobs by turning the printer on
> and then using print statements.  I would like to be able to capture the
> output from the print statements into a variable in a program to do
> something with them (basically capturing the print job into a variable).
>
> Here are my thoughts:
>
> Isolate the code and execute it and use a capturing statement.
>
> Do a como on statement and capture the output that way.  If I need to do
> this, is there a way to have the output only go to the como file?
>
> I guess what I am looking for is a way to do this with minimal changes to
> the program.  Basically do a "printer on" and save all output to a variable
> or alternately a file.  I am on jbase 3.4 on an old version of linux.
>
> Thanks in advance for any help.
>
> --
> --
> IMPORTANT: T24/Globus posts are no longer accepted on this forum.
>
> To post, send email to [email protected]
> To unsubscribe, send email to [email protected]
> For more options, visit this group at
> http://groups.google.com/group/jBASE?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "jBASE" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
IMPORTANT: T24/Globus posts are no longer accepted on this forum.

To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"jBASE" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to