This is file bonus.txt The BUNDLExx package installs these command-line programs: AggHAR for aggregating model data HAR files - see ViewHAR online help Change32 batch global search and replace editor CSV2HAR convert database text format to real header in HAR file. DiffHAR computes differences between matching real matrices on two HAR files. DirSizes shows sizes of directories and subdirectories Fuj2Lhy convert Fujitsu-format HAR file into Lahey-format HAR file GemTimes extracts main CPU times from log file of Gempack simulation HAR2CSV convert real headers in HAR file to database text format. Head2XLS convert specified header in HAR file to XLS file. HideBig temporarily "hide" larger files in current folder (prior to zip or backup) Later for batch files: allows you to branch if fileA is later than fileB Lhy2Fuj convert Lahey-format HAR file into Fujitsu-format HAR file MergeHAR combines headers from 2 HAR files into one; versatile options ScaleHAR multiplies real numbers in HAR file with a common factor. SetErr for batch files: sets or clears the DOS errorlevel ShowBig "unhide" larger files in current folder (undo HideBig) SortHead sorts real vector in HAR file SplitHAR splits 1 HAR file into many; reverses the action of CMBHAR TABLTG a batch file which, ONLY IF NECESSARY, runs TABLO and LTG TinyHAR turns zeroes into tiny numbers, or tiny numbers into zeroes TstHAR allows TABLO-generated program to influence flow-of-control in BAT file Txt2HAR turns GEMPACK text data file into HAR file Where32 locates files on your hard disk XLS2Head convert matrix in XLS file to header in HAR file. Each is designed to be used within the DOS box, or in a batch program. You can get brief help for each command by typing its name without arguments. EG, type "WHERE32" to see instructions. WHERE32 AND DIRSIZES ******************** These are 2 general utility programs: Where32 finds files you have lost, identifies the most recent version of files with the same name, and shows which version of XXX.EXE is run when you type XXX. DirSizes shows the size of the current directory and of each folder below the current directory. It can be used to discover which directories are responsible for using up hard disk space. Often the display is too much for a single screen; in that case, type "DirSizes | more" or "DirSizes > LOG" and then print or view the file LOG. DirSizes takes an optional integer parameter N to restrict report to N directories deep. HIDEBIG and SHOWBIG ******************* Use these when you want to zip or backup a folder, excluding some very large files. You would go: DIR/OS to see files, biggest last HIDEBIG 1000000 to "hide" files size > 1 megabyte ZIP myzip *.* to zip all visible files (but not those > 1 megabyte) SHOWBIG 1000000 to "unhide" files size > 1 megabyte CHANGE32 ******** Batch Global Search and Replace Editor USAGE: change32 changefile infile outfile Converts infile using list in changefile changefile contains a list of replacements each line contains one old/new pair, thus /oldstring/newstring/ any delimiter may be used instead of "/" example from command line: for %a in (*.sti) do change32 chnglist %a newfiles\%a example in batch file: for %%a in (*.sti) do change32 chnglist %%a newfiles\%%a MERGEHAR ******** Merges the contents of two HAR files into one HAR file. This could be useful, when you use TABLO programs to produce data matrices which are scattered over different output files. Or, if you find your TABLO program has to do a lot of copying of matrices from one file to another, consider using MergeHAR to do this task. A HAR file may not contain two matrices with the same 4-character key (or header). MergeHAR allows you to choose what happens if a header name clash occurs. MergeHAR also allows you to exclude from a file any headers that are not also present on another file. Some GEMPACK programs, such as CMBHAR, insist that several input files contain exactly the same headers. You could use MERGEHAR with the "NN1" option (see below) to produce such files. A typical MergeHAR command might be: MERGEHAR OLD1.HAR OLD2.HAR NEW.HAR YY2 where, OLD1.HAR and OLD2.HAR are the 2 existing input files. NEW.HAR is the new output file. The last parameter must consist of 3 characters as follows: Char 1 for headers unique to OLD1: Y - copy, N - ignore. Char 2 for headers unique to OLD2: Y - copy, N - ignore. Char 3 for headers common to both: 1 - use OLD1, 2 - use OLD2, N - ignore So, in the example above, "YY2" means: Take all headers from both files, except OLD1 headers that also exist in OLD2. TABLTG ****** TABLTG is designed to assist the automation of data procedures which use TABLO-generated Fortran programs. These often include one or more batch (BAT) files which: run TABLO to create a FOR file run LTG to create an EXE file run the EXE file Often, the TABLO and LTG stages take much longer than running the EXE. TABLTG saves time by running TABLO and LTG only when necessary, that is, only when the EXE file is missing or predates the TAB file. To use it you would create a BAT file like the following: CALL TABLTG JOB1 JOB1 -cmf JOB1.CMF You might execute the BAT repeatedly, but TABLO and LTG would only be run if you had altered JOB1.TAB since last time. In more detail, the command: CALL TABLTG JOB1 assumes input files JOB1.TAB and JOB1.STI. If JOB1.TAB does not exist, an error is generated. If JOB1.STI does not exist, an appropriate default file of that name is created. The output files are JOB1.AXS, JOB1.AXT and JOB1.EXE. If all of these exist, and have been created after each of the 2 input files, no further action is taken. If on the other hand, any of the 3 output files are missing, or if either of the two input files were created or modified since the output files were made, the following commands are executed: DEL JOB1.AXS DEL JOB1.AXT DEL JOB1.EXE DEL JOB1.FOR TABLO -sti JOB1.STI CALL LTG JOB1 If the TABLO or LTG jobs fail, an error message is displayed and the DOS errorlevel set to 1 (which means error). Note 1: If JOB1.STI is created automatically, it will postdate JOB1.EXE so TABLO and LTG will be run. This normally only happens the first time. Note 2: If JOB1.TAB is not found, an error message is displayed and the DOS errorlevel set to 1, but existing files JOB1.AXS, JOB1.AXT and JOB1.EXE are not deleted. Note 3: If the job fails, it does not actually PAUSE. You can bring about pause-on-error by editing a line near the end of the file TABLTG.BAT. SETERR and LATER **************** These are 2 small programs useful in batch files: SETERR sets or clears the DOS errorlevel LATER allows you to branch if file A is later than file B TABLTG.BAT shows an example of their use. TinyHAR ******* Zeros in CGE databases can cause problems. TinyHAR can be used to turns all zeros into very tiny numbers, so avoiding the problems. You could type: TinyHAR OLD.HAR NEW.HAR 1.0E-20 where OLD.HAR is the existing input file. NEW.HAR is the new output file. zeros and numbers with abs value < 1.0E-20 will be replaced by 1.0E-20. Type "Tinyhar /?" to get more instructions. It is possible to replace zeros in selected headers only. There is also a /D option which turns numbers below a certain limit into zeros. ScaleHAR ******** Multiplies real numbers in HAR file with a common factor. Useful in GAMS where the size of flows must be appropriate. example: ScaleHAR OLD.HAR NEW.HAR 0.001 1BAS 2BAS above, OLD.HAR is the existing input file. NEW.HAR is the new output file. Real numbers will be multiplied by 0.001 1BAS and 2BAS are the headers to be altered. If no headers are specified], zeros will be replaced in ALL real headers will be scaled. The /X (exclude) option may be added at the end to reverse the action. example: ScaleHAR OLD.HAR NEW.HAR 1E-3 1BAS 3BAS /X scales all real numbers EXCEPT headers 1BAS and 3BAS. SplitHAR ******** Splits 1 HAR file into many, corresponding to columns of last dimension (ie, reverses the action of CMBHAR). example: SplitHAR COMBINED.HAR NUFIL JCOL above, COMBINED.HAR is the existing input file. SplitHAR expects this to contain several RE matrices which mostly have a last dimension of length N (N is computed as the modal size of the last dimension of RE matrices). N output files will be produced, each containing 1 of the slices 1-N from all original RE matrices that had last dimension of size N. NUFIL is a key used to construct output filenames by adding digits, giving NUFIL001.HAR, NUFIL002.HAR, up to a possible maximum of NUFIL999.HAR. The last parameter is optional but must be a legal header name not used on the input file. If present, each output file will have an additional header containing a single integer: the column from which data was drawn. Txt2HAR ******* turns GEMPACK text data file into HAR file. examples: Txt2HAR old.txt new.har (reads old.txt, writes new.har) Txt2HAR horse.txt (reads horse.txt, writes horse.har) GPDel ***** deletes rebuildable products of TAB files (to save space) Usage: GPDEL /D Action: for each TAB file in current folder, deletes files of same name with the following extensions (suffixes): .EXE .AXS .AXT .GSS .GST .MIN .MNC .INF .CLO .LOG Option: GPDEL /S Works as above in current folder AND ALL SUBFOLDERS. SortHead ******** Sorts real vector in HAR file. example: SortHead OLD.HAR DAT3 NEW.HAR /R above, OLD.HAR is the existing input file; DAT3 is the header to be sorted: must be a real vector; NEW.HAR is the new output file. /R is optional: it reverses the sort order (so largest comes first). The output file will contain: * a copy of the original header * SRTD: the sorted vector * RANK: the ranking of the original vector [integer] * ORDR: the order in which original items appear in SRTD [integer] * SSET: set SRT sorted elements of input set. Download example programs showing how to use SortHead from: http://www.monash.edu.au/policy/gpmark.htm Note: Above is only useful for older GEMPACK. Since GEMPACK 9, sorting and ranking may be performed from within the TAB file. DiffHAR ******* Computes differences between matching real matrices on two HAR files. example: DiffHAR OLD1.HAR OLD2.HAR DIFFS.HAR P above, OLD1.HAR and OLD2.HAR are the 2 existing input files. DIFFS.HAR is the new output file. The last parameter must consist of either P or D: P for percent changes D for ordinary changes DiffHAR seeks "matching" real matrices [ie, same header and dimension] in the two files, and writes corresponding matrices of ordinary or percent changes to the output file. You could use DiffHAR either for checking differences between two files, or to compute results as the difference between values on the initial and updated datafiles used in some simulation. TstHAR ****** TstHAR: check if specified header in HAR file contains positive scalar; for use in batch files to control flow by errorlevel value. Example: TstHAR OLD.HAR DAT3 above, OLD.HAR is the existing input file; DAT3 is the header to seek If OLD.HAR does not exist, or is not a HAR file, or if there is no scalar RE header DAT3, TstHAR will terminate with errorlevel 2. Otherwise, if DAT3 contains a number <=0, TstHAR will terminate with errorlevel 1. Otherwise, TstHAR will terminate with errorlevel 0. Example BAT file might read ........do something which produces OLD.HAR with scalar header DAT3 ........value in DAT3 controls what happens next TstHAR OLD.HAR DAT3 REM next two tests must be in the following order if errorlevel 2 goto REALERROR if errorlevel 1 goto NONPOS REM if we get here, errorlevel must be zero echo DAT3 contained a positive number ........do some things goto endbat :NONPOS echo DAT3 contained number <= 0 ........do some other things goto endbat :REALERROR echo ERROR...ERROR....ERROR :endbat XLS2Head and Head2XLS ********************* These 2 programs convert between HAR and XLS (Excel97) format. XLS2Head: convert matrix in XLS file to header in HAR file. syntax: XLS2Head xlsfile sheetno nrow ncol row1 col1 head harfile example: XLS2Head NEW.XLS 1 33 2 4 5 DAT3 NEW.HAR above, OLD.XLS is the existing input Excel file; "1" means look in the first worksheet [normally Sheet1]; "33 2" means extract a matrix of 33 rows and 2 columns; "4 5" means topleft cell of matrix is at position [4,5] on the worksheet; DAT3 is the header on output HAR file; NEW.HAR is the output HAR file. Notes: Every cell to be extracted must contain a number. Row and column labels are not extracted. Input XLS must not be currently open in Excel. If outfile file exists, header will be added; otherwise new output file will be created. Head2XLS: convert specified header in HAR file to XLS file. example: Head2XLS OLD.HAR DAT3 NEW.XLS above, OLD.HAR is the existing input file; DAT3 is the header to be placed in XLS: must be a real array; NEW.XLS is the new output Excel file. HAR2CSV and CSV2HAR ********************* These 2 programs convert between HAR and a one-value-per-line text format used by database and some other programs (ComTrade,Stata). The CSV2HAR program is described in CSV2HAR.DOC. HAR2CSV: writes real arrays from HAR file to CSV text-file database format -- one row for each nonzero cell. example: har2csv OLD.HAR NEW.CSV 1BAS 2BAS above, OLD.HAR is the existing input file. NEW.CSV is the new output file. 1BAS and 2BAS are the headers to be written to NEW.CSV. If no headers are specified, all real arrays will be written You can add option "/D" at the end: example: har2csv OLD.HAR NEW.CSV /D The "/D" causes an additional descriptive row to precede each item. Or you can add option "/T" at the end, to use tabs (not commas) as separators; or add "/TD" for both options.