I tried a different path.  I found that SYSTEM(20) is the last hold entry. 
 I did a test and was able to create the hold entry and now I know the hold 
number and can find the file.  My issue now is that the hold entry has rw 
permissions and is owned by root and I cannot do anything with it without 
using a jbase command.  I tried your suggestion of doing jspcmds COPY 
"/directory file" hold#, but it just creates a new file with the same 
permissions.  Is there a way I can set the permissions on the spooler 
directory so that I can read this file or else when I do the copy, read it?

On Tuesday, January 28, 2014 4:33:55 PM UTC-6, Daniel Klein wrote:
>
> I think the piece that is missing is 'openseq_creates = true' in the 
> '$JBCRELEASEDIR/config/Config_EMULATE' file, under the appropriate 
> emulation section.
>
> Dan
>
>
> On Tue, Jan 28, 2014 at 2:36 PM, troyd1 <[email protected] 
> <javascript:>>wrote:
>
>> Daniel, thanks for the reply.  I am finally back on this.  I did the 
>> option of redirecting the  output to a program.  I cannot get it to work.
>>
>> I created a program as described.  I am on a 3.x version of jbase.
>>
>> I created the formqueue by doing SP-CREATE PCAPT PROG /jbase/bin/lptext
>>
>> I created a directory under /tmp called PRINTCAPTURE and gave it 777 
>> permissions.  I am on an old version of linux.
>>
>> I ran the program from the command prompt and it was giving me an error 
>> with the sequential file, so I tried saving the output and just opening and 
>> writing the output.
>>
>> It does not seem to even be running the program.
>>
>> Here is the code:
>> * PROGRAM lptext
>>  INCLUDE JBC.h
>> * id = CHANGE(UNIQUEKEY(),'/',']2F')
>>  id = SYSTEM(21):'_':DATE():'_':TIME():'_':SYSTEM(9):'_':RND(32000)
>> * tempdirname = '/tmp/PRINTCAPTURE'
>> * OPENSEQ tempdirname:DIR_DELIM_CH:id TO outstream ELSE
>> *   CREATE outstream ELSE NULL
>> * END
>> EXECUTE 'touch /tmp/PRINTCAPTURE/testtouch'
>> * OPENSEQ tempdirname:'/':id TO outstream ELSE NULL
>> OPEN 'PCAPTURE' TO PCAPTURE ELSE STOP
>> PREC = ''
>>  LOOP
>>    numchars = SYSTEM(14)
>>  WHILE numchars DO
>>    INPUT line, numchars
>>    PREC<-1> = line
>> *   WRITESEQ line ON outstream ELSE NULL
>>  REPEAT
>> * WEOFSEQ outstream ELSE NULL
>> * CLOSESEQ outstream
>> WRITE PREC ON PCAPTURE,id
>> CLOSE PCAPTURE
>> STOP
>>
>> I added the execute touch to see if it was running.  If I run the from 
>> the command prompt by either doing lptext or /jbase/bin/lptext it creates 
>> the touch file.
>>
>> If I do SP-ASSIGN = PCAPT
>> and then SP-ASSIGN ?, it is assigned correctly.  SP-STATUS shows the 
>> formqueue fine.
>>
>> If I do LIST MD SAMPLE 10 LPTR, it does not create the touch file and if 
>> I go to SP-STATUS, there is no job there.  If I assign it to hold(HS) or 
>> another form queue, it prints fine.
>>
>> What am I doing wrong.  I feel like I am 99% there, but missing something.
>>
>> Any suggestions?
>>
>>
>> On Friday, May 3, 2013 5:05:59 AM UTC-5, Daniel Klein wrote:
>>
>>> 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] <javascript:>
>> To unsubscribe, send email to [email protected] <javascript:>
>> 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] <javascript:>.
>> 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