Re: create()

brian at aljex.com brian at aljex.com
Wed Aug 28 22:00:43 PDT 2013


I have not dug into this code, I am just making a tangential remark.

sleep() should be renamed voodoo()

Ok in reality there are uses for sleep(), but sleeping to make sure a filesystem operation has completed is pure unadulterated (and inexcusable) voodoo.

You either closed the file or you didn't. That's all there is to it. If you closed it, then it's ready, for anything, immediately. If you didn't close it, then no amount of waiting will ensure it's ready.

-- 
bkw

-----Original Message-----
From: "Richard Kreiss" <rkreiss at gccconsulting.net>
Sent: Wednesday, August 28, 2013 5:07pm
To: "filepro-list at lists.celestial.com" <filepro-list at lists.celestial.com>, "Fp Support (fpsupport at fptech.com)" <fpsupport at fptech.com>
Subject: Re: create()

Windows Server 2008
Workstations Window 7
filePro 5.6.10

I have a process that creates a batch file.  This same processing exists in 2 programs. 

 In the original program there is no problem creating the file in rreport.  However, in the new version, the batch file is not created when running in rreport but is with dreport.(used with the debugger to see if the create() line is executed.

I am creating an xml file prior to the batch file without a problem. I have a sleep "700" after closing the xml file and before creating the batch file. 

Anyone have an idea why this works in the older processing table but not the new one?  

There were major code changes elsewhere in the program which run after the create section. 

65  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:
       Then: declare batfile
 66  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:
       Then: batfile="runthis.bat"
 67  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:
       Then: aa=create(batfile)
 68  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If: aa = "0"
       Then: ERRORBOX "(69) RUNTHIS batch File Not Created\n\rSJ #\r"<1<"\n\rRecord #\r"<@rn<"\r";EXIT "90"
  69  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:                                                                   
       Then: ex=exists(batfile)                                             
 70  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
        iIf: @fstat["11"] lt @t4                                               
       Then: msgbox "Runthis.bat file out of Date\nNew File Note created\nPress \kZ To Exit";EXIT "90"
 71  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
            If:                                                                   
       Then: ab=writeline(aa,FLCMD)                                            
 72  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
            If:                                                                   
       Then: ac=close(aa)      
73  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If: 'pause to give file a chance to close
      Then: sleep "500" 


Richard Kreiss
GCC Consulting

Office: 410-653-2813


                                   
_______________________________________________
Filepro-list mailing list
Filepro-list at lists.celestial.com
Subscribe/Unsubscribe/Subscription Changes
http://mailman.celestial.com/mailman/listinfo/filepro-list







More information about the Filepro-list mailing list