Another server task issue
Richard Kreiss
rkreiss at verizon.net
Wed Jun 30 08:37:04 PDT 2010
Solved the first problem and the task now runs. This task generates pdf files in a folder called web_files.
Once the files are created, another program runs that copies all of the files to web_files\today and then moves each file to the proper persons individual folder.
My problem is that in today's run(and over the weekend), 129 pdf files were generated and 123 were copied and moved.
All processing is done while standing on one record using rreport.
My code at @once moved to web_files, reads in all of the files into an array dim getfiles(500)(21,*) - see below
Since qq will have the number of files meeting the parameters, I have a count on how many need to be processed.
The pertinent part of the @once processing listed below.
38 ------- - - - - - - - - - - - - - - - -
◄ If: 'set the folder
Then: folder=drive{sl{"web_files"{""
39 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: chdir folder
40 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: ct="1"
41 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: qq=opendir("*.pdf",folder)
42 ------- - - - - - - - - - - - - - - - -
◄ If: qv = ""
Then: qv(3,.0,g)=qq
43 ------- - - - - - - - - - - - - - - - -
loop_fi◄ If:
Then: qr=nextdir()
44 ------- - - - - - - - - - - - - - - - -
◄ If: qr = ""
Then: GOTO done
45 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: filename=mid(qr,"1","17"){".pdf"
46 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: getfiles[ct]=filename;ct=ct+"1";filename=""
47 ------- - - - - - - - - - - - - - - - -
◄ If: ct le qv
Then: GOTO loop_fi
48 ------- - - - - - - - - - - - - - - - -
done ◄ If:
Then: END
Primary processing
loop_mv◄ If:
Then: filename=getfiles[ct]
18 ------- - - - - - - - - - - - - - - - -
◄ If: 'get doc code for this file
Then: doc=mid(getfiles[ct],"1","4");where=folder{sl{doc
19 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: GOSUB ck_fold
20 ------- - - - - - - - - - - - - - - - -
◄ If: mid(filename,"14","2")="00" 'remove 001 from file name
Then: movename=mid(filename,"1","13"){".pdf"
21 ------- - - - - - - - - - - - - - - - -
◄ If: mid(filename,"14","2") ne "00"
Then: movename=filename
22 ------- - - - - - - - - - - - - - - - -
◄ If: 'set copy command with no prompts to copy into folder today
Then: copyit="copy"<folder{sl{filename<folder{sl{"today"{sl{movename
23 ------- - - - - - - - - - - - - - - - -
◄ If: 'for testing remove for task
Then: SHOW("18","5") "count Is \b5"<ct<"\a- of \b2"<qv<"\a-"
24 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: system copyit
25 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: sleep "200"
26 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: system moveit
27 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: ct=ct+"1"
28 ------- - - - - - - - - - - - - - - - -
◄ If: ct gt qv or ct = "501" 'no more files to process
Then: END
29 ------- - - - - - - - - - - - - - - - -
◄ If: getfiles[ct]=""
Then: end
30 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: GOTO loop_mv
31 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: END
32 ------- - - - - - - - - - - - - - - - -
Note: because printwiz checks if the file name already exists, a file may be the form NNNN_20100630001.pdf rather than NNNN_20100630. Line 20 allows the named that is copied/moved to not have the printwiz extension.
Line 19 checks to see if folder NNNN exists and if not create it. That routine has a sleep "500" to insure that the proper permissions are in place before continuing processing.
The 6 files which were not moved today already had folders.
The task starts at 6 AM and showed completion in about a minute and half.
Both process are called from the same batch file so the task will end when the batch file closes.
When I test this program on my system, it runs to completion. Now we know this is not a permission problem as 123 files had been moved.
My simplest solution would be to run the move_pdf routine again to insure everything has been processed.
However, I am wondering if anyone sees what might be causing this problem.
Richard Kreiss
GCC Consulting
rkreiss at gccconsulting.net
More information about the Filepro-list
mailing list