NAME

runMG -  exe for launching TMQ's MARC Global in scriptable/batch mode

PREREQUISITE

MARC Report must be installed on the computer.

RUNNING IN WINDOWS

The file runMG.exe must be installed in the MARC Report program folder.

You may create a shortcut to runMG.exe and relocate the shortcut 
wherever you desire. Or, in a .bat file, 'cd' to the MARC Report 
program folder before running your tasks.
   

SYNOPSIS

runmg

runmg "(marcInput|marcOutput|workingFolder|configFile)"
runmg "(marcInput|marcOutput|workingFolder|configFile|marcOutput2)"
runmg "(marcInput|marcOutput|workingFolder|configFile|reportFile)"

DESCRIPTION

A scriptable interface to TMQ's MARC Review and Global utilities. 

runMG reads MARC record from a 'marcInput' file; the instructions in a 'configFile' are applied to each record.

MARC results are output to a 'marcOutput' file, and optionally (for Split reviews) to a 'marcOutput2' file. Logs generated as a result of the processing are output to the 'workingFolder'.

OPTIONS

When 'runMg' is called without any parameters, a small windows program
is launched which makes it possible to enter the parameters using a form
and test them.

In all other cases, runMG must be launched with parameters matching one
of the entries in the SYNOPSIS above. The parameter statement must begin
with 

  "( 
     
... and end with 

  )"
  
Each parameter, except the last, must be followed by the "|" separator.
For best results use using fully-qualified pathnames for all parameters.

CONFIGFILE

runMG gets its processing instructions from the 'configFile'. This file
is an .xml file that must be created using the 'Export review' option in
MARC Review/MARC Global.

In general, use the following procedure to create a configFile (for
details see the appropriate help files in MARC Global): start MARC 
Global and setup the parameters for the job(s) that you want to run 
in batch mode. Test the job, etc, then save it to your saved reviews. 
Next, goto the 'Reviews' form, create an Autoreview, and add the 
job(s) you want to run in batch mode to it. Exit the 'Reviews' form, 
select 'Options', goto the 'Import/Export' tab, and use the 
'Export review to .xml' option to export the Autoreview created above.

LOG

runMG generates a summary each time it runs which contains essentially the 
same information as the MARC Global 'Result's screen'. The filename for 
this log is 'runMg-' followed by the filename of the MARC input file. This 
logfile will be written to 'workingFolder'. Thus, for the first example 
below, this log would be named 'd:\marc\runMG-in1.txt'.

The name and location of this log can be changed in the fifth command-line 
parameter (see the last example in the Synopsis), by giving a fully-qualified 
filename that ends with the '.txt' extension. Note that if the fifth param
does not end in '.txt', it is assumed to be the name of a Splitfile.

Do not confuse the runMG log with the default MARC Global 'mglog' created
and maintained for each MARC Global task.

NOTES

When an an Autoreview is exported to xml, the program writes the default
'Output options' to the .xml file. runMG will ignore these filenames when
it runs the Autoreview, and instead generate unique filenames for its output. 
However, when the autoreview is complete, runMG will rename the 
output files to the filenames specified in the command-line options. 

Even if there is only one job that you want to use in runMG, that job
must still be saved as an Autoreview in MARC Global before it is exported
to xml.

When creating an Autoreview it will be helpful to remember that the name
you assign to the Autoreview in MARC Global becomes the name assigned to 
the .xml file created by the Export option; which in turn becomes the 
filename that must be used as the 4th parameter in the runMG options. 

MARC REVIEW

Also unlike MARC Global (and Autoreviews), it is possible to add a 
MARC Review job to runMG. This may be useful in batch processing, when at
some point you want to create two separate streams of records and apply
different processing to each. 

Once you have created and saved the necessary MARC Review job (assuming
it splits the MARC inputfile into two output files), follow these steps to
get it into runMG: start MARC Global (not MARC Review) and goto the
'Reviews' form. Select the 'Include MR' option at the bottom of the screen
(if this option does not appear there is an installation or registration
problem). Create a new Autoreview. Add the MARC Review to the Autoreview, 
press Save, and exit the form. Proceed to export the Autoreview as above.

When using this configFile in a runMG task, follow the parameter-options
format used to support two output files:

  runmg "(marcInput|marcOutput|workingFolder|configFile|marcOutput2)"
Note: if an Autoreview contains a MARC Review job, that must be the only
review present in the Autoreview.

EXAMPLES

The simplest case:

runmg "(d:\marc\in1.mrc|d:\marc\out1.mrc|d:\marc\|c:\reviews\add 001.xml)"

This job applies the Autoreview exported to 'add 001.xml' (which perhaps uses MARC Global's “Add sequential number” option) to every record in 'in1.mrc' and writes the results to 'out1.mrc'.

A more interesting example:

runmg "(d:\in.mrc|d:\in-ok.mrc|d:\work\|c:\work\check XXX.xml|d:\in-not-ok.mrc)"
runmg "(d:\in-not-ok.mrc|d:\in-not-ok-fixed.mrc|d:\work\|c:\work\fix XXX.xml|d:\hopeless.mrc)"
mconcat --sourcefile="d:\in-not-ok-fixed.mrc" --targetfile="d:\in-ok.mrc"
runmg "(d:\in-ok.mrc|d:\in-ok-out.mrc|d:\work\|c:\work\fixes.xml)"

The first step is a MARC Review task that splits the input file into two pieces based on whether the XXX field matches a pattern. The second step applies a fix-up autoreview to the records from the first job that did not match (and were thus split to a separate file); this job splits any records that it could not fix to a file called 'hopeless.mrc'. In step 3, the fixed-up file is added back to the main file (using a concatenation utility); finally, in step 4, a large autoreview containing various tasks is applied to the re-joined records.

A .bat script for the above might look like this:

c:
cd "\program files\tmq\marc report"
runmg "(d:\in.mrc|d:\in-ok.mrc|d:\work\|c:\work\check XXX.xml|d:\in-not-ok.mrc)"
runmg "(d:\in-not-ok.mrc|d:\in-not-ok-fixed.mrc|d:\work\|c:\work\fix XXX.xml|d:\hopeless.mrc)"
mconcat --sourcefile="d:\in-not-ok-fixed.mrc" --targetfile="d:\in-ok.mrc"
runmg "(d:\in-ok.mrc|d:\in-ok-out.mrc|d:\work\|c:\work\fixes.xml)"
d:

BUGS, LIMITATIONS, ETC.

Because of the default behavior used when assigning MARC Global output options, preserving the 'mglog' generated by MARC Global during multiple autoreviews becomes problematic. Because of the internal processing performed by the program to avoid using output filenames saved in reviews, the workaround for this problem is to rename the MARC Global log after each autoreview, as shown here:

c:
cd "\program files\tmq\marc report"
runmg "(d:\in.mrc|d:\in-ok.mrc|d:\work\|c:\work\check XXX.xml|d:\in-not-ok.mrc)"
rename d:\work\mglog.txt d:\work\mglog-job1.txt
runmg "(d:\in-ok.mrc|d:\in-ok-out.mrc|d:\work\|c:\work\fixes.xml)"
rename d:\work\mglog.txt d:\work\mglog-job2.txt

...
phelp/helprunmg.txt · Last modified: 2023/11/01 00:10 by Rick
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki