10 Replies Latest reply: May 15, 2014 10:07 AM by elginreigner _ RSS

    Scheduling a .bat Monarch Pro file

    tightwaud _

      We have a .bat file that executes several Monarch Pro(v7.0) statements, and it run successfully when it is ran from the command line.  But, we want to schedule this .bat file from a scheduling application, and when the scheduler runs the .bat file the Monarch statements are seemingly executed but none of the output files are created.  Any suggestions?

        • Scheduling a .bat Monarch Pro file
          Olly Bond

          Hello tightwaud,

           

          DataPump offers this - and a lot more - so it might be worth it...

           

          Can you post an example of the .bat file between tags and some details about the scheduling application?

           

          Best wishes,

           

          Olly

            • Scheduling a .bat Monarch Pro file
              Data Kruncher

              There can be a number of problems that cause Monarch to process but silently (without error dialogs) fail. These are most often incorrect file names/paths, but batch failures can also be caused by incorrect parameters or syntax.

               

              As such, and as Olly mentioned, a copy of the batch file posted here will help immensely.

                • Scheduling a .bat Monarch Pro file
                  tightwaud _

                  We want to schedule this .bat file from an application called GlobalScape.  Here is a copy of the .bat file:

                  REM  Combined Cardon download executed via GlobalScape

                  REM  ===============================================================================================================

                  REM  ===============================================================================================================

                  REM  BMC / Cardon download

                  REM  This is .bat file that emulates an auto-script.  It is executed by GlobalScape.

                  REM  PXCD01 thru PXCD06 are ad hocs that create the cardon download.  Cardon will collect self pay accounts.

                   

                  REM  popd - unassigns a network drive letter for DOS .bat files

                  REM  pushd - temporailiy assigns a network drive letter for the DOS .bat files

                   

                  REM  ==================================== PXCD01 thru PXCD06 =========================================

                  REM  Backup the files to the Zbkbmcd folder

                  If Exist
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd01anyq0000.txt goto Backupfiles1

                  echo File $$pxcd01anyq0000.txt does not exist - Skipping TEST hospital.

                  goto End1

                  :Backupfiles1

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd01anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd01anyq0000.txt

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd02anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd02anyq0000.txt

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd03anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd03anyq0000.txt

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd04anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd04anyq0000.txt

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd05anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd05anyq0000.txt

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd06anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd06anyq0000.txt

                  echo Copying pxcd01 thru pxcd06 to backup folder.

                   

                   

                  REM  Copies files from VPS Server to Monarch.

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd01anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd01.txt

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd02anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd02.txt

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd03anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd03.txt

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd04anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd04.txt

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd05anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd05.txt

                  copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd06anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd06.txt

                   

                  REM Run Monarch

                  c:

                  cd\

                  cd c:\program files\monarch

                  REM  dir . - This result will be in the cmdout.log file

                  program\monarch reports\pxcd01.txt models\pxcd01.mod export\pxcd01.mdb

                  start /wait program\monarch.exe reports\pxcd01.txt models\pxcd01.mod export\pxcd01.mdb

                  start /wait program\monarch.exe reports\pxcd02.txt models\pxcd02.mod export\pxcd02.mdb

                  start /wait program\monarch.exe projects\pxcd012.prj export\pxcd012.mdb

                  start /wait program\monarch.exe reports\pxcd03.txt models\pxcd03.mod export\pxcd03.mdb

                  start /wait program\monarch.exe projects\pxcd0123.prj export\pxcd0123.mdb

                  start /wait program\monarch.exe reports\pxcd04.txt models\pxcd04.mod export\pxcd04.mdb

                  start /wait program\monarch.exe projects\pxcd01234.prj export\pxcd01234.mdb

                  start /wait program\monarch.exe reports\pxcd05.txt models\pxcd05.mod export\pxcd05.mdb

                  start /wait program\monarch.exe projects\pxcd012345.prj export\pxcd012345.mdb

                  start /wait program\monarch.exe reports\pxcd06.txt models\pxcd06.mod export\pxcd06.mdb

                  REM start /wait program\monarch.exe projects\pxcd0123456.prj export\pxcd0123456.csv

                  start /wait program\monarch.exe projects\pxcd0123456.prj
                  nsbmd404\usr\v_Test_Larry\BACardon.dlt

                   

                  REM  Michael W. wrote a Pearl script that copies the file with today's

                  REM  date appended to the file.  The script also deletes any file that

                  REM  is 15 days old.

                  popd

                  pushd
                  NABMD07\Siemens_vps\Scripts\ServnetProcedures

                  perl.exe transfer.pl
                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon.dlt
                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon.dlt 15

                  del
                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon.dlt

                  echo Appending date to file name.

                   

                  goto End1

                   

                  popd

                  pushd
                  file1-okc\siemens_vps\spool\dl\Ztstspool

                  del $$pxcd01anyq0000.txt

                  del $$pxcd02anyq0000.txt

                  del $$pxcd03anyq0000.txt

                  del $$pxcd04anyq0000.txt

                  del $$pxcd05anyq0000.txt

                  del $$pxcd06anyq0000.txt

                  echo BMC Cardon Download is complete.

                  c:

                  cd\

                   

                  :End1

                   

                  Here is a copy of the log file that is generated:

                  ==============================================

                  Command:
                  nwbmd1f5\Monarch\program\Combined_Cardon_DOS_BMC.bat

                  Started at: 06/21/2010 17:05:42

                  Command output:

                  '
                  nwbmd1f5\Monarch\program'

                  CMD.EXE was started with the above path as the current directory.

                  UNC paths are not supported.  Defaulting to Windows directory.

                   

                  C:\Windows>REM  Combined Cardon download executed via GlobalScape

                   

                  C:\Windows>REM  ===============================================================================================================

                   

                  C:\Windows>REM  ===============================================================================================================

                   

                  C:\Windows>REM  BMC / Cardon download

                   

                  C:\Windows>REM  This is .bat file that emulates an auto-script.  It is executed by GlobalScape.

                   

                  C:\Windows>REM  PXCD01 thru PXCD06 are ad hocs that create the cardon download.  Cardon will collect self pay accounts.

                   

                  C:\Windows>REM  popd - unassigns a network drive letter for DOS .bat files

                   

                  C:\Windows>REM  pushd - temporailiy assigns a network drive letter for the DOS .bat files

                   

                  C:\Windows>REM  ==================================== PXCD01 thru PXCD06 =========================================

                   

                  C:\Windows>REM  Backup the files to the Zbkbmcd folder

                   

                  C:\Windows>If Exist
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd01anyq0000.txt goto Backupfiles1

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd01anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd01anyq0000.txt

                          1 file(s) copied.

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd02anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd02anyq0000.txt

                          1 file(s) copied.

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd03anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd03anyq0000.txt

                          1 file(s) copied.

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd04anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd04anyq0000.txt

                          1 file(s) copied.

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd05anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd05anyq0000.txt

                          1 file(s) copied.

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd06anyq0000.txt
                  file1-okc\siemens_vps\spool\dl\Zbkbmcd\$$pxcd06anyq0000.txt

                          1 file(s) copied.

                   

                  C:\Windows>echo Copying pxcd01 thru pxcd06 to backup folder.

                  Copying pxcd01 thru pxcd06 to backup folder.

                   

                  C:\Windows>REM  Copies files from VPS Server to Monarch.

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd01anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd01.txt 

                          1 file(s) copied.

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd02anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd02.txt

                          1 file(s) copied.

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd03anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd03.txt

                          1 file(s) copied.

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd04anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd04.txt

                          1 file(s) copied.

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd05anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd05.txt

                          1 file(s) copied.

                   

                  C:\Windows>copy
                  file1-okc\siemens_vps\spool\dl\Ztstspool\$$pxcd06anyq0000.txt
                  nwbmd1f5\monarch\reports\pxcd06.txt

                          1 file(s) copied.

                   

                  C:\Windows>REM Run Monarch

                   

                  C:\Windows>c:

                   

                  C:\Windows>cd\

                   

                  C:\>cd c:\program files\monarch

                   

                  c:\Program Files\Monarch>REM  dir . - This result will be in the cmdout.log file

                   

                  c:\Program Files\Monarch>program\monarch reports\pxcd01.txt models\pxcd01.mod export\pxcd01.mdb

                   

                  c:\Program Files\Monarch>start /wait program\monarch.exe reports\pxcd01.txt models\pxcd01.mod export\pxcd01.mdb

                   

                  c:\Program Files\Monarch>start /wait program\monarch.exe reports\pxcd02.txt models\pxcd02.mod export\pxcd02.mdb

                   

                  c:\Program Files\Monarch>start /wait program\monarch.exe projects\pxcd012.prj export\pxcd012.mdb

                   

                  c:\Program Files\Monarch>start /wait program\monarch.exe reports\pxcd03.txt models\pxcd03.mod export\pxcd03.mdb

                   

                  c:\Program Files\Monarch>start /wait program\monarch.exe projects\pxcd0123.prj export\pxcd0123.mdb

                   

                  c:\Program Files\Monarch>start /wait program\monarch.exe reports\pxcd04.txt models\pxcd04.mod export\pxcd04.mdb

                   

                  c:\Program Files\Monarch>start /wait program\monarch.exe projects\pxcd01234.prj export\pxcd01234.mdb

                   

                  c:\Program Files\Monarch>start /wait program\monarch.exe reports\pxcd05.txt models\pxcd05.mod export\pxcd05.mdb

                   

                  c:\Program Files\Monarch>start /wait program\monarch.exe projects\pxcd012345.prj export\pxcd012345.mdb

                   

                  c:\Program Files\Monarch>start /wait program\monarch.exe reports\pxcd06.txt models\pxcd06.mod export\pxcd06.mdb

                   

                  c:\Program Files\Monarch>REM start /wait program\monarch.exe projects\pxcd0123456.prj export\pxcd0123456.csv

                   

                  c:\Program Files\Monarch>start /wait program\monarch.exe projects\pxcd0123456.prj
                  nsbmd404\usr\v_Test_Larry\BACardon.dlt

                   

                  c:\Program Files\Monarch>REM  Michael W. wrote a Pearl script that copies the file with today's

                   

                  c:\Program Files\Monarch>REM  date appended to the file.  The script also deletes any file that

                   

                  c:\Program Files\Monarch>REM  is 15 days old.

                   

                  c:\Program Files\Monarch>popd

                   

                  c:\Program Files\Monarch>pushd
                  NABMD07\Siemens_vps\Scripts\ServnetProcedures

                   

                  Z:\Scripts\ServnetProcedures>perl.exe transfer.pl
                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon.dlt
                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon.dlt 15

                  The system cannot find the file specified.

                  Could Not Find
                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon060610.dlt

                   

                  Z:\Scripts\ServnetProcedures>del
                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon.dlt

                  Could Not Find
                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon.dlt

                   

                  Z:\Scripts\ServnetProcedures>echo Appending date to file name.

                  Appending date to file name.

                   

                  Z:\Scripts\ServnetProcedures>goto End1

                   

                  Finished at: 06/21/2010 17:06:03 with code 0

                  ==============================================

                   

                  Any suggestions are appreciated.

                    • Scheduling a .bat Monarch Pro file
                      Data Kruncher

                      Do the report and model files work properly when the work is done manually, rather than automated via batch file in this way?

                       

                      Further, it looks like the batch file was designed with the Monarch v6 command line parameter specification in mind. That syntax was made obsolete with the release of v7, which your profile reflects.

                       

                      Just a thought, but I'd try introducing the "new" parameters such /rpt:, /mod: and the like.

                        • Scheduling a .bat Monarch Pro file
                          tightwaud _

                          Yes, the report files and model files work correctly when they are manually ran.  We have already tried the newer syntax /rpt: /mod: /exp:, and that did not work, either.

                            • Scheduling a .bat Monarch Pro file
                              Data Kruncher

                              Aha! I think that I've got it now.

                               

                              I was focusing on the wrong part. There's nothing wrong with your Monarch syntax. The problem is the syntax of the START command.

                               

                              START needs a "title" before the /WAIT directive, otherwise it gets right confused.

                               

                              Also, the first Monarch line looks like it was duplicated with a start but the first line wasn't removed. You'll want to clean that up.

                               

                              start "PASS01" /wait program\monarch.exe reports\pxcd01.txt models\pxcd01.mod  export\pxcd01.mdb

                              start "PASS02" /wait program\monarch.exe reports\pxcd02.txt models\pxcd02.mod  export\pxcd02.mdb

                              start "PASS012" /wait program\monarch.exe projects\pxcd012.prj export\pxcd012.mdb

                              start "PASS03" /wait program\monarch.exe reports\pxcd03.txt models\pxcd03.mod  export\pxcd03.mdb

                              start "PASS0123" /wait program\monarch.exe projects\pxcd0123.prj  export\pxcd0123.mdb

                              start "PASS 04" /wait program\monarch.exe reports\pxcd04.txt models\pxcd04.mod  export\pxcd04.mdb

                              start "PASS01234" /wait program\monarch.exe projects\pxcd01234.prj  export\pxcd01234.mdb

                              start "PASS05" /wait program\monarch.exe reports\pxcd05.txt models\pxcd05.mod  export\pxcd05.mdb

                              start "PASS012345" /wait program\monarch.exe projects\pxcd012345.prj  export\pxcd012345.mdb

                              start "PASS06" /wait program\monarch.exe reports\pxcd06.txt models\pxcd06.mod  export\pxcd06.mdb

                              REM start /wait program\monarch.exe projects\pxcd0123456.prj  export\pxcd0123456.csv

                              start "PASS 0123456" /wait program\monarch.exe projects\pxcd0123456.prj 
                              nsbmd404\usr\v_Test_Larry\BACardon.dlt[/code]Try that.

                               

                              Kruncher

                                • Scheduling a .bat Monarch Pro file
                                  tightwaud _

                                  Thanks Kruncher, I modified the script to give the START command a target.  Howver, I still get the same results.  Here is that portion of the log file:

                                  c:\Program Files\Monarch>start "PASS01" /wait program\monarch.exe reports\pxcd01.txt models\pxcd01.mod export\pxcd01.mdb

                                   

                                  c:\Program Files\Monarch>start "PASS02" /wait program\monarch.exe reports\pxcd02.txt models\pxcd02.mod export\pxcd02.mdb

                                   

                                  c:\Program Files\Monarch>start "PASS012" /wait program\monarch.exe projects\pxcd012.prj export\pxcd012.mdb

                                   

                                  c:\Program Files\Monarch>start "PASS03" /wait program\monarch.exe reports\pxcd03.txt models\pxcd03.mod export\pxcd03.mdb

                                   

                                  c:\Program Files\Monarch>start "PASS0123" /wait program\monarch.exe projects\pxcd0123.prj export\pxcd0123.mdb

                                   

                                  c:\Program Files\Monarch>start "PASS04" /wait program\monarch.exe reports\pxcd04.txt models\pxcd04.mod export\pxcd04.mdb

                                   

                                  c:\Program Files\Monarch>start "PASS01234" /wait program\monarch.exe projects\pxcd01234.prj export\pxcd01234.mdb

                                   

                                  c:\Program Files\Monarch>start "PASS05" /wait program\monarch.exe reports\pxcd05.txt models\pxcd05.mod export\pxcd05.mdb

                                   

                                  c:\Program Files\Monarch>start "PASS012345" /wait program\monarch.exe projects\pxcd012345.prj export\pxcd012345.mdb

                                   

                                  c:\Program Files\Monarch>start "PASS06" /wait program\monarch.exe reports\pxcd06.txt models\pxcd06.mod export\pxcd06.mdb

                                   

                                  c:\Program Files\Monarch>REM start /wait program\monarch.exe projects\pxcd0123456.prj export\pxcd0123456.csv

                                   

                                  c:\Program Files\Monarch>start "PASS0123456" /wait program\monarch.exe projects\pxcd0123456.prj
                                  nsbmd404\usr\v_Test_Larry\BACardon.dlt

                                   

                                  c:\Program Files\Monarch>REM  Michael W. wrote a Pearl script that copies the file with today's

                                   

                                  c:\Program Files\Monarch>REM  date appended to the file.  The script also deletes any file that

                                   

                                  c:\Program Files\Monarch>REM  is 15 days old.

                                   

                                  c:\Program Files\Monarch>popd

                                   

                                  c:\Program Files\Monarch>pushd
                                  NABMD07\Siemens_vps\Scripts\ServnetProcedures

                                   

                                  Z:\Scripts\ServnetProcedures>perl.exe transfer.pl
                                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon.dlt
                                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon.dlt 15

                                  The system cannot find the file specified.

                                  Could Not Find
                                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon060810.dlt

                                   

                                  Z:\Scripts\ServnetProcedures>del
                                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon.dlt

                                  Could Not Find
                                  nsbmd404\d$\inetpub\ftproot\usr\v_Test_Larry\BACardon.dlt

                                   

                                  Z:\Scripts\ServnetProcedures>echo Appending date to file name.

                                  Appending date to file name.

                                   

                                  Z:\Scripts\ServnetProcedures>goto End1

                                   

                                  Finished at: 06/23/2010 14:54:06 with code 0

                                  ==============================================

                                   

                                  There are no error messages in the log.  But, none of the output files were created in the Export folder.  (When I log onto the PC and run the .bat file from the command line it runs sucessfully.)  Could the scheduling software, GlobaScape, be having a 'permissions' problem on the PC that Monarch resides?  We have given GlobalScape full access to the folders Monarch, Reports, Program and Export.  But, we still get the same results as above.