Dan
I've always used an alternative technique for getting spool jobs from
the spooler, take this code for example :
TESTREP
001 Command=SENTENCE()
002 Command=Command[LEN(FIELD(SENTENCE(),' ',1))+2,999]
003
004 EXECUTE 'SP-ASSIGN HF0'
005 EXECUTE Command
006
007 PrintJobNo=SYSTEM(20) ;*** This is the last print job no
008 DATA 'D:\DMS\OUTGOING FILE.TXT'
009 EXECUTE 'SP-EDIT ':PrintJobNo:' (I'
This code will create a file d:\dms\outgoing\file.txt from pretty much
any command that will generate a print...
eg TESTREP LIST ONLY MD (P
You can then open and parse the file in a loop, redisplaying as
necessary. This has the benefit of not requiring a dedicated print
spool queue....
I use this technique for all sorts of things.. Including a LISTCSV
command, which will do a report and then convert it to a csv file for
loading directly in excel..
So taking the above code, you can easily do an OPENSEQ on the file, and
then a READSEQ and parse just as you have.
eg :
001 INCLUDE JBC.H
002 EXECUTE 'SP-ASSIGN HF0;
003 EXECUTE 'SORT TRANS BY DATE BREAK-ON DATE "'VL'" TOTAL 2 (D)'
004 tmpFile= 'tmpfile.txt' ; *** for jbase 3.4 - use
CHANGE(UNIQUEKEY(),'/',']2F') on 4.1
005 DATA 'C:\TEMP ':tmpFile
006 EXECUTE 'SP-EDIT ':SYSTEM(20):' (I'
007 OPENSEQ 'C:\TEMP\':tmpFile TO File ELSE STOP
008 Eof=0
009 LOOP
010 READSEQ Line FROM File ELSE Eof=1
011 UNTIL Eof DO
012 IF INDEX(Line,'0.00',1)=0 ELSE CRT Line
012 REPEAT
013 CLOSESEQ File
012 EXECUTE 'DEL C:\TEMP\':tmpFile
I think this solution is equal in effect to yours?
My solution works
Simon
On 26/09/2010 20:11, Daniel Klein wrote:
I've posted this code in one form or another before, so I'm not going
to go into long explanations on the how's and why's; you can search
http://jbase.markmail.org <http://jbase.markmail.org/> if you are
interested. Or you can email me off-list to my gmail.com
<http://gmail.com> address: danielkleinad
Simply put, all this program is doing is grabbing the spooler output
and sending it to a file. However, it is also doing something
'special' with each line of the report (see program lines 19 thru 21);
it is testing the required condition in order to process the 'line'.
IOW, it will 'print' every line (iow send the line to the sequential
file) that does NOT contain a '0.00' in it. If your report is more
complex than what you posted then you will have to parse each line as
necessary to determine whether or not the 'line' gets 'processed'.
[Note: lines 9 and 11 to 13 only work on jBASE 4.1 and above. Let me
know if you need a jBASE 3 solution.]
0001 PROGRAM jlp_special
0002 * Redirects spooler output to a text file
0003 *
0004 * Create spooler queue with something like: SP-CREATE TEXTFILE
PROG c:\home\bin\jlp_special.exe
0005 * Where:
0006 * 'c:\home\bin' is the directory where the 'jlp_special'
executable lives
0007 *
0008 INCLUDE JBC.h
0009 id = CHANGE(UNIQUEKEY(),'/',']2F')
0010 tempdirname = 'c:\temp' ;* This dir must have 'read/write'
permissions
0011 OPENSEQ tempdirname:DIR_DELIM_CH:id TO outstream ELSE
0012 CREATE tempdirname:DIR_DELIM_CH:id ELSE NULL
0013 END
0014 LOOP
0015 numchars = SYSTEM(14)
0016 WHILE numchars DO
0017 INPUT line, numchars
0018 line := CHAR(13) ;* This line is only needed for
Windows I think
0019 IF INDEX(line,"0.00",1) ELSE
0020 WRITESEQ line ON outstream ELSE NULL
0021 END
0022 REPEAT
0023 WEOFSEQ outstream ELSE NULL
0024 CLOSESEQ outstream
0025
0026 *---At this point we have the file saved as
'tempdirname:DIR_DELIM_CH:id'
0027 *---so we can do whatever we want with it.
0028 *---Typically you would EXECUTE some command against this file.
0029 *---For example, you could build up a command to email the file,
or convert the file to PDF.
0030
0031 *---Finally remove the temporary file...
0032 OPEN tempdirname TO tempdir THEN DELETE tempdir, id
I don't know if you would consider this 'integrated' but, given the
tools you have at hand, it's the closest you are going to come to it.
Dan
On Sun, Sep 26, 2010 at 10:36 AM, Simon Verona <[email protected]
<mailto:[email protected]>> wrote:
Dan
There seems to be an iphone app for everything else....
I can (and do) spool and process the file, just wondered it there
was a more "integrated" way of doing it!
Regards
Simon
On 26/09/2010 14:12, Daniel Klein wrote:
There's no iphone app that will do that? ;-)
Seriously, you would spool the report to a file and then
post-process the file.
Dan
On Sun, Sep 26, 2010 at 7:00 AM, Simon Verona
<[email protected] <mailto:[email protected]>> wrote:
Hi all
This may or may not be a stupid question.
I have a transaction file, with many thousands of entries in,
which should total zero both on a daily basis (there is a
date field in the file) and overall.
If I have a problem, then a check is to find which dates do
not come back to zero...
So, I execute a jQL query like :
SORT TRANSACTIONS BY DATE BREAK-ON DATE "'VL'" TOTAL 2 (D)
Which produces a list like :
02/07/2010 0.00
01/07/2010 0.00
30/06/2010 0.00
29/06/2010 -585.31
28/06/2010 0.00
27/06/2010 0.00
etc etc
All I want to see though is the dates that don't come to zero....
Can this be done using jQL?
Thanks
Simon
--
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]
<mailto:[email protected]>
To unsubscribe, send email to
[email protected]
<mailto:[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]
<mailto:[email protected]>
To unsubscribe, send email to [email protected]
<mailto:[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]
<mailto:[email protected]>
To unsubscribe, send email to [email protected]
<mailto:[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
--
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