OK I GOT IT.....
I had to combined the two suggestions you made and it works for now....not the best way...but it works.
Here is what I have done.
The first file is called from CRON.
@echo off
REM ;---------------------------------------------------------------------
REM ;/T/ Batch queue
REM ;
REM ;/D/ Passing Parameters:
REM ;/D/ Field Position
REM ;/D/ ----------------------------- --------
REM ;/D/ Version P1 (ie V60)
REM ;/D/ Batch Queue P2 (ie dayq)
REM ;---------------------------------------------------------------------
call %CLAIMS%\bat\setup.bat %1
REM Change location to the batch queue folder
cd %QUEUES%\%2
REM Check to see if the queue is running
if not exist schedules.dat goto END
REM Check to see if this job has already started, but not completed
if exist running.dat goto END
REM Set a running flag to stop jobs from being picked up twice
copy %CLAIMS%\bat\exit.bat running.dat
REM List every job file in the Queue and redirect it to a file
REM The results of this command are:
REM 1.200610111230.KEN.j12345.User_Listing.
job
REM 3.200610111230.KEN.j12345.Testing_thisP
rocess.job
REM 5.200609111259.DON.j155.UserSecurity.jo
b
dir/b ?.
.*.job > schedules.dat
REM Loop thru the file and run the job
FOR /f %%A in (SCHEDULES.DAT) do call %CLAIMS%\bat\runjob.bat %1 %2 %%AREM Remove the running flag
DEL running.dat
REM ;---------------------------------------------------------------------
:END
The runjob.bat file is called from the first file and it works now.
@echo off
REM ;------------------------------------------------------------------
REM ;/T/ Run Job (called from batchq)
REM ;
REM ;/D/ Passing Parameters:
REM ;/D/ Field Position
REM ;/D/ ----------------------------- --------
REM ;/D/ Version P1
REM ;/D/ Batch Queue P2
REM ;/D/ Job File P3
REM ;------------------------------------------------------------------
REM Set up the current date and time
set CURDATETIME=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%%TIME:~0,2%%TIME:~3,2%
REM Check the run time of the job
set JOBFILE=%3
set RUNDATETIME=%JOBFILE:~2,12%
pause
REM Run the job if the date/time is less than current date/time
if %RUNDATETIME% GTR %CURDATETIME% goto END
REM Rename the job so it runs and doesn't get picked up again
move %3 %3.bat
REM Run the job
call %3.bat > %QUEUES%\%2\logs\%3
REM Archive the job
move %3.bat %3.done
REM ;------------------------------------------------------------------
:END
Thanks for you help.
Ken