You can customize CSBatch's behavior by creating a
PFF file. You can then use the PFF file as a command line parameter for CSBatch.exe. For example, if you name your PFF file MyEdits.pff, then you run the batch edit application by invoking:
"C:\Program Files (x86)\CSPro 8.0\CSBatch.exe" MyEdits.pff
This assumes that CSPro was installed in the default directory. Your PFF file must have a .pff extension.
You can create a PFF file in one of two ways: either [1] create one with a text editor (such as Notepad or Wordpad), or [2] have it generated automatically for you by launching your batch application from within the CSPro Designer. The file will have the same name as your application, but with a .pff extension instead of .bch. For example, if your batch application was named MyEdits.bch, the generated PFF would be named MyEdits.pff. You can also manipulate PFF files in logic by using the
Pff object.
The following section shows the options available to you in a CSBatch PFF file. A PFF file is not case sensitive, so you can use any combination of upper and lower case text.
[Run Information]
Version=CSPro 8.0
AppType=Batch
[Files]
Application=.\MyEdits.bch
InputData=.\MyInputData.dat
OutputData=.\MyOutputData.dat
Paradata=.\MyParadataLog.cslog
Listing=.\MyEdits.lst
Freqs=.\MyEdits.tbw
ImputeFreqs=.\MyEdits.impute_freq.lst
ImputeStat=.\MyEdits.impute_stat.csdb
WriteData=.\WriteMessages.txt
SaveArray=.\MyEdits.bch.sva
CommonStore=.\MySettings.db
HtmlDialogs=.\MyDialogsDirectory
BaseMap=.\MyMap.mbtiles
[ExternalFiles]
LOOKUP_DICT=.\LookupFile.dat
[Parameters]
ViewListing=Always
ViewResults=Yes
ListingWidth=120
MessageWrap=No
ErrmsgOverride=No
InputOrder=Sequential
Parameter=your choice
Language=LN
OnExit=.\Menu.pff
The [Run Information] block is required and must appear exactly as shown in the example above.
The [Files] block is required. A description of the files, not all of which have to be specified, is as follows:
- Application=the name of the batch edit application that you created.
- InputData=the data file(s) against which the batch edit program will run. These files will not be modified during the run.
- OutputData=the revised/corrected input data will be saved as this file(s).
- Paradata=the name of a file where events logged during the application's run are saved.
- Listing=a report of the batch operation.
- Freqs=a frequencies file containing the results of Freq statements.
- ImputeFreqs=if you have any impute function calls in your program, the results of these statements will be written to this frequencies file.
- ImputeStat=if you have any impute function calls in your program that use the stat command, the results of these statements will be written to this data file.
- WriteData=if there are one or more write function calls in your program, the text of these statements will be written to this file.
- SaveArray=if your program contains one or more saved arrays, the contents of these arrays will be read from and written to this file.
- CommonStore=if you use the loadsetting or savesetting functions in your program, this file overrides the default location where these settings are saved.
- HtmlDialogs=the name of a directory that contains custom HTML dialogs that override the default CSPro ones.
- BaseMap=the name of the online map or the filename of an offline map used for CSPro mapping.
If the
[ExternalFiles] block is present, it means that a second (or more) dictionary was linked to the batch application. In the example above, LOOKUP_DICT is the dictionary name, and LookupFile.dat is the name of the data file that contains the
lookup codes.
The [Parameters] block is optional. This section defines parameters for the batch run.
- ViewListing=determines whether you see the batch run report. If this entry is missing or set to Always, then you will see the generated report. Other available options are OnError, in which case you will see the listing report only if an error occurred during the run, or Never, in which case you will never be shown the generated report.
- ViewResults=determines whether or not the impute and/or write file are displayed in Text Viewer at the end of the run. The available choices are Yes or No. If the entry is missing, the resultant file(s) will be displayed by default. For more information on these files, see Run a Batch Edit Application.
- ListingWidth=allows you to control the number of characters outputted to the listing file before forcing the start of a new line. This is set to 120 characters by default. If your screen resolution and/or printer permits, it may be useful to increase the width of the listing file. This only applies to text listing files.
- MessageWrap=determines whether or not summary messages displayed at the end of a listing file will be outputted on several lines when they are too long to fit on one line. The default option is No, in which case the messages are truncated so that they fit on one line. This only applies to text listing files.
- ErrmsgOverride=allows you to override the default behavior of the errmsg function. The override only affects errmsg functions used in the code without a case or summary specifier. The option No maintains the default behavior (displaying the messages for each case, as well as in the summary). The option Summary only displays the message in the summary. The option Case displays the message for each case but not in the summary.
- InputOrder=allows you to override the default order in which cases are processed in a data file. The default option, Sequential, means that cases will be processed from the first case to the last case, in file order. The option Indexed overrides this order and cases will be processed in alphabetical order of the case IDs. Text data files can contain duplicates case IDs if processed in sequential order, but not in indexed order.
- Parameter=allows you to pass in a string to your program. The parameter can be any length, although the string that retrieves the value in your program (via the sysparm function) must be large enough to accommodate it. Once the parameter is retrieved, it can be parsed by your program for further usage.
- Language=specifies the initial language of the program. The parameter must match the name of a language specified in the dictionary or message file.
- OnExit=specifies a PFF file to run after the application closes. This can be useful, for example, if you want to relaunch a menu program after processing data.