Automatic Routines in Datafile

It is possible to set up routines in Datafile that will run automatically and unattended at a specified time. This is especially useful for running programs such as 'Save Aged Analysis' in the Sales Ledger which require exclusive use of the database files. Setting up an automatic routine enables you to run such routines overnight so that they don't interfere with what other users of the system are doing.

To achieve this you need to use a task scheduling program. Windows operating systems have such a program in-built - in Start, Settings, Control Panel, Scheduled Tasks in Windows 2000; and in My Computer, Scheduled Tasks in Windows 98.

The DFWIN.EXE program needs to be called as usual, but with a parameter file that specifies which Datafile option to run. To do this you open the task scheduler and go to Add Scheduled task, browse to find the DFWIN.EXE program - usually in g:\df\prog. Then specify a name for the scheduled task, if you are setting up more than one auto-routine you should choose a name that describes the option being called. Choose a schedule for the task and tick the box for 'Advanced Properties'. You should be careful to choose a time to run your program that doesn't interfere with anything else on your network - backups in particular.

In the box titled 'Run', add the pathname of the parameter file that you will create to tell Datafile which option to run. This will normally be in the DF folder.

Next you need to create the parameter file in the folder you have just specified for the task scheduler. Use explorer to navigate to the correct folder, right-click in a space and select New, Text Document. The parameter file needs to contain the following:

USER-ID: This can be an existing User, which is useful if the procedure you are running creates spool files for later inspection eg. a profiler report that takes a while to compile. For any other procedure it may be better to create a special user-id such as AUTO to prevent the ID being signed on to the system twice - which can cause corruption.

PASSWORD: The assigned password for the user.

COMPANY: The Datafile company ID for which to run the procedure

AUTOCLEAR: Determines whether you want any users currently signed on to be cleared from the system in case they are locking the files you need. This should be used with caution - see article 11 "User Locks in Datafile"

PROGRAM: The Datafile Program required

PARAMETER: The particular function of the program

INDEX: Required only for program options that need a particular database record.

The format for the "aged.run" file for this example is:

userid=auto
password=auto
autoclear=yes

company=dem
program=sl.exe
parameter=7799A

To check which program parameter to use you can access a list - see article 10 "Datafile Menu Configuration".

In the example above, SL.EXE calls the Sales Ledger program, and 7799 calls the Save Aged Analysis option. The 'A' suppresses the prompt for the "Save Aged Analysis As At" date.

Software Connection, Unit 6, 1st Floor, Durable House, 8 Greenock Road, Acton, London W3 8DU
Tel: +44 (0)20 8896 3838  Fax: +44 (0)20 8896 3341
E-mail: enquiries@softwareconnection.co.uk