In that case, don't use it ;-) Instead do something like this:
Start out with the following code (you can embellish it as you see fit) :
001 PROGRAM jprint
002 INCLUDE JBC.h
003 EQU underscores TO '__'
004 * create a unique item-id by concatenating:
port_username_date_time_milliseconds
005 id = SYSTEM(18):"_":SYSTEM(1015):"_":DATE():"_":TIME():'_':SYSTEM(9)
006 tempdirname = '/tmp' * or any directory with 'write' permissions
('c:\temp' on Windows)
007 OPEN tempdirname TO tempdir ELSE STOP 201, tempdirname
008 OPENSEQ tempdirname:DIR_DELIM_CH:id TO outstream ELSE NULL
009 LOOP
010 INPUT line
011 UNTIL INDEX(line, underscores:"end":underscores, 1) DO
012 ****line := CHAR(13) ;* this line is only needed for Windows
013 WRITESEQ line ON outstream ELSE NULL
014 REPEAT
015 WEOFSEQ outstream ELSE NULL
016 CLOSESEQ outstream
017 * Now do whatever is required with the file; the item-id of this
file is:
018 * tempdirname:DIR_DELIM_CH:id
019 DELETE tempdir, id ;* remove the text file
Note that the program is creating a sequential file from the spooler's
output. At line 017 you have now 'captured' the entire spooler entry as a
text file in the directory designated on line 006. You can now add
additional code after line 018 to modify the print job as required.
Alternatively, you could modify the lines of the print job (just before the
WRITESEQ on line 013) as they are being built. Keeping line 019 is up to
you, but should you decide not to use it then some other part of the
application will be responsible for clean up.
Compile and catalog the program and take note of the directory where the
executable lives; let's assume for this example that the directory is
'/home/bin'.
You will need to define a formqueue (or redefine the 'device' for an
existing formqueue), something like:
SP-CREATE NEW_QUEUE PROG /home/bin/jprint
or
SP-DEVICE EXISTING_QUEUE PROG /home/bin/jprint
Note that it is 'programmatically' executing the 'jprint' program above. Be
sure to supply a full path to the 'jprint' program to avoid conflicts with
any other program that may be called that now or in the future.
Important: This technique requires that the form-type (see
$JBCRELEASEDIR/config/jspform_deflt for details) assigned to the queue
defines :
ENDJOB echo \"\n__end__\n\"
so that the program knows when to stop accepting INPUT. Note that the
'echo'd string must exactly match what is expected in the 'jprint' program,
otherwise the output will be truncated at the point it encounters this
string. So change it in both places (the program and the form-type)
according to your needs.
You will also need 'openseq_creates = true' in Config_EMULATE; otherwise you
will need additional logic in the program to create the sequential file.
All that's left to do is to assign the form-type to the required form
queues, then
SP-ASSIGN =NEW_QUEUE [or whatever the actual queue name is]
LIST MyFile LPTR
Hope some of this helps, and have a nice day!
Dan
On Wed, Aug 11, 2010 at 9:08 AM, jlogdup <[email protected]> wrote:
> Good Morning, I am trying to implement a queue to send printing job to
> a file using a program that I found in this forum:
>
> PROMPT ''
> ID = TRIM(UPCASE(SYSTEM(1015))):".TXT"
> DIRECTORY = 'E:\temp'
> OPENSEQ DIRECTORY,ID TO S.FILE THEN NULL
> *
> LOOP
> NUMCHARS = SYSTEM(14)
> WHILE NUMCHARS DO
> INPUT LINE,NUMCHARS
> LINE := CHAR(13)
> WRITESEQ LINE ON S.FILE ELSE NULL
> REPEAT
> WEOFSEQ S.FILE ELSE NULL
> CLOSESEQ S.FILE
>
>
> But it is not working because SYSTEM(14) always returns 0.
> I found, also in this forum, that SYSTEM(14) does not pass the input
> buffer count when it is run in 3.4.x using the spooler under TELNET.
>
> How can work around this issue to substitute SYSTEM(14) ?
>
> THANKS IN ADVANCE FOR YOUR HELP.
>
> --
> Please read the posting guidelines at:
> http://groups.google.com/group/jBASE/web/Posting%20Guidelines
>
> IMPORTANT: Type T24: at the start of the subject line for questions
> specific to Globus/T24
>
> 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
>
--
Please read the posting guidelines at:
http://groups.google.com/group/jBASE/web/Posting%20Guidelines
IMPORTANT: Type T24: at the start of the subject line for questions specific to
Globus/T24
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