I meant to add... All you would need to do to rebuild the spooler is run SP-NEWTAB, make the script executable and then run it. Of course I would review it first to make sure it is doing what you want it to.
This spooler really needs to be refreshed and then your original program should work. Dan On Thu, Jan 30, 2014 at 6:49 PM, Daniel Klein <[email protected]>wrote: > That's an 11-line script that should take about 2 minutes to create. > Here's a program that will do it for you, but you need to get 'jsp_scan' > working (maybe run it as 'root' so that permissions are not a problem): > > 0001 EXECUTE @IM:'kjsp_scan > jsp.out' > 0002 OPEN '.' TO curdir ELSE STOP 201,'.' > 0003 READ jspout FROM curdir, 'jsp.out' ELSE STOP 202,'jsp.out' > 0004 script = '' ;* First line could be something like this: > '#!/bin/ksh' > 0005 numlines = DCOUNT(jspout,@AM) > 0006 FOR lineno = 1 TO numlines > 0007 line = TRIM(jspout<lineno>) > 0008 label = line[1,7] > 0009 BEGIN CASE > 0010 CASE label = 'FormQue' > 0011 fqname = FIELD(line,' ',2)[2,-1] > 0012 IF fqname = 'STANDARD' THEN command = 'SP-DEVICE ' ELSE > command = 'SP-CREATE ' > 0013 scriptline = command:fqname > 0014 CASE label = 'DevType' > 0015 devtype = FIELD(line,' ',2)[2,-1] > 0016 scriptline := ' ':devtype > 0017 CASE label = 'DevName' > 0018 devname = FIELD(line,':',2,99) > 0019 scriptline := ' ':devname > 0020 script<-1> = scriptline > 0021 END CASE > 0022 NEXT lineno > 0023 WRITE script ON curdir, 'createqueues' > > > > You could also do: > > SP-EDIT entry# (I > > > On Thu, Jan 30, 2014 at 5:13 PM, troyd1 <[email protected]> wrote: > >> I would rather not do that as they have 11 form queue's set up and I >> really don't want to mess it up. Is there a way using the jspcmds or >> another command to basically do a cat hold #. I am thinking I could >> execute that and capture the output. I think that would work fine. Does >> the jspcmds COPY have a screen option? >> >> >> On Thursday, January 30, 2014 4:00:26 PM UTC-6, Daniel Klein wrote: >> >>> You have a real permissions issue, which is probably the reason your >>> program does not run as it can't access the 'jspool_log' file. >>> >>> I'd advise trashing this spooler and creating a new one, but make sure >>> 'umask 0' is set before running 'SP-NEWTAB'. >>> >>> Dan >>> >>> >>> On Thu, Jan 30, 2014 at 4:12 PM, troyd1 <[email protected]> wrote: >>> >>>> I just ran it with the -v option and only got the following: >>>> jsp_scan - Version $Revision: 3.1 $ >>>> SpoolerDir=/usr/jspooler >>>> ** Error [ 201 ] ** >>>> Unable to open file /usr/jspooler/jspool_log >>>> >>>> >>>> >>>> >>>> On Thursday, January 30, 2014 9:35:41 AM UTC-6, Daniel Klein wrote: >>>> >>>>> If it is not executing the program then the best way to start >>>>> debugging this is to run this command from a Linux prompt: >>>>> >>>>> jsp_scan > jsp.out >>>>> >>>>> and attach the 'jsp.out' file to your reply. >>>>> >>>>> Dan >>>>> >>>>> >>>>> On Thu, Jan 30, 2014 at 7:39 AM, troyd1 <[email protected]> wrote: >>>>> >>>>>> I checked and it is there. I think the biggest point is that it is >>>>>> not executing the program when printing. It should correct? >>>>>> >>>>>> >>>>>> 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]> 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] >>>>>>>> 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. >>>>>> >>>>> >>>>> -- >>>> -- >>>> 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. >> > > -- -- 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.
