more on brain teaser for gurus
From
Richard Webb@1:116/901 to
all on Thu Jan 12 13:39:34 2012
<<<continued from previous >>>
IF everybody's happy, and we don't need to turn over the
month in the middle of our capture of next seven days'
history it works like this:
:: 300hist.bat
:: main working section.
:regular
logecho $M$D | nset news=$1
call mmsnhist.bat %NEWS%
if exist c:\hold\work\history.dat goto sunhist
goto chkmon
:sunhist
cd \hold\weeknews
echo Today >> history.txt
echo. >> history.txt
type c:\hold\workfile\history.dat >> history.txt
cd \
del c:\hold\work\history.dat
goto chkmon
Of course, we don't need to turn over, or look for it for
Sunday, because system time and date agree. We've of course gotten here because there is going to be no turnover in the
middle.
Hence
:chkmon
count NEWS +1
call mmsnhist.bat %NEWS%
if exist c:\hold\work\history.dat goto monhist
goto chktue
Now of course, if we know we're going to have a turnover of
month some day that week we do an ifnumber test.
Meanwhile mmjsnhist.bat looks for a file with the
appropriate file name, stuff its contents into history.dat
where it will be found, etc.
Of course we have labels chktue, chkwed, etc. along with
slabels sunist, monhist, etc.
Now here's the big question.
I have, as I see it, a couple of options here.
For our check for mOnday's data, I can do an ifnumber test as follows ...
ifnumber %NEWS% biggerequivalthan %TURNOVER% > nul
if errorlevel 1 goto turnmon
This would mean adding turnmon, turntue, etc. Trouble is,
once we no longer need the %TURNOVER% environment variable
I'd like to lose it.
Or, we create another batch if turnover is needed during the week, with semaphore files to guide us as to what day of the week comes next.
Thoughts Paul or any of you other batch gurus out there?
Regards,
Richard
---
* Origin: (1:116/901)