MACRO, Batch File Enhanser 4.02 Page 1 1. License You are licenced to use MACRO at no cost in a non-commercial environment. A commercial environment is a business, government organization, school, or any individual or organization that uses MACRO in a for-profit venture. Commercial users may evaluate MACRO for a period of 30 days. After 30 days, you must register MACRO, or stop using it. Contact the author for details on registration. MACRO shall not be bundled with any other software package without permission of the author, unless the program is also FREE, and the MACRO files are kept in their own archive. No fees shall be imposed for the distribution of MACRO beyond the cost of the media and shipping costs. All rights to MACRO are retained by GARY A. MAYS. You may give archived copies of MACRO to others or make MACRO available for download on a bulletin board system. No files may be added or deleted from the original distribution archive. You may re-pack the original files in a format different from the original distribution archive, provided that no files are added, deleted, or modified. List of files in the original distribution archive: M.EXE The command line macro processor. M.DOC M.EXE reference. M.NEW Whats new. M.DIZ Another name for FILE_ID.DIZ BATPOWER.TXT A bunch of the BATPOWER echo conference messages answered, but never sent. BATS \ *.* Batch file solutions using M.EXE BEEP.EXE Use to make sounds in batch files EATKEYS.EXE Use before menus to kill any stacked keyboard input. FILE_ID.DIZ Brief description. CHOOSE.EXE Display then search and optionally select a line or a block of text from the standard input. SELECT.EXE Hot-Key selection of standard input text. TIMED.EXE Displays the execution time of a batch file or command. SEMAPHOR.EXE Program to make semaphore files. GETK001.ZIP Contains GETKEY.EXE 0.01, a symbolic implementation of the DOS CHOICE command with names for all keys. MACRO, Batch File Enhanser 4.02 Page 2 2. Warranty MACRO IS FREELY AVAILABLE, BUT COPYRIGHTED BY GARY A. MAYS. GARY A. MAYS OFFERS NO WARRANTY, EITHER EXPRESS OR IMPLIED, WITH REGARD TO THE USE OF MACRO AND HEREBY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL GARY A. MAYS BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING, BUT NOT LIMITED TO, DESTRUCTION OF DATA OR DAMAGE TO YOUR EQUIPMENT. MACRO, Batch File Enhanser 4.02 Page 3 3. Introduction 3.1. What it does MACRO writes the command line or all standard input lines to the standard output. When the command line contains a bracketed macro expression, then the brackets plus the expression will be replaced with the macro value. One such macro would be [day$] which would expand to the day of the week: Monday, Tuesday, ..., Sunday. When the command line is blank or contains a reference to a standard input macro [] or [ ], then each line of the standard input is edited into the command line and then written to the standard output. The default standard input is from the keyboard, when you enter just M without any parameters, then the following is assumed: m [] A program that writes to the standard output can have its output piped into MACRO with the | symbol: dir | m [] You can direct a file into the standard input with the < redirection symbol: m [] operator. m ***[]newfile.txt The standard output can also be piped into a program that accepts standard input: m **[]> output redirection operation: m ***[]>newfile.txt MACRO will execute the result when the /XQT is specified, and will perform the functions of the DOS command SET when the /SET option is specified. It is up to you, the programmer, to create a valid command line to execute or a valid SET command to perform. MACRO, Batch File Enhanser 4.02 Page 4 3.2. Switches All of MACROs switches must appear to the left of any parameters. Switches don't have to be separated by spaces. /? Displays this help screen. /NUL Does nothing with the result of the command line. Any reportable errors are processed and all macros are processed. /XQT Executes the result instead of writing to the standard output. Commands are written to a file in the temporary directory named by the TEMP environment variable. If the standard input is being used, then execution is delayed until an eof is encountered. Only the first 127 characters of a command line will be accepted by DOS. /Q May be used with the /XQT switch. It prevents the displaying of the command line being executed. /SET Performs the dos SET functions on the command line. M/SET displays all environment variables M/SET farble displays value of the environment variable farble M/SET farble= deletes farble M/SET x=value sets x to value where value is a string which may contain macros described later. /D May be used with the /SET switch to display the environment bytes used and bytes free. /i:n Take no more than n lines from the standard input. The default is unlimited. /halt3 will force a halt for errorlevels 3, 4, or 5. /halt4 will force a halt for errorlevels 4 or 5 /halt5 will force a halt for errorlevel 5 /exitcode displays the exit errorlevel for debugging. The /NUL, /XQT, and /SET switches are mutually exclusive, only one of them can be used. 4. Macros definitions When the output of a program is piped into MACRO, or a file is directed into MACROs input, then one of the standard input macros must exist. The exception is when the command line is blank, then the [] macro is assumed and input is expected from the console. MACROs command line in the following examples is blank since the piped or redirected input is stripped by the command processor before MACRO is executed. MACRO then assumes the command line of [] and will accept the redirected input. m v2 then T else F [v1`gt`v2] if v1 > v2 then T else F [v1`ge`v2] if v1 >= v2 then T else F [v1`in`v2`v3`v4] T if v1 is in the set of v2 through v4, else F. If both v1 and v2 are numeric, then the rest of the values are expected to be numeric. The example shows three values, but the set of values can have one or more values. 4.3. Math All math is performed on integers only. Form Replaced by {} = optional parameter ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [v1`add`v2] The sum of v1 and v2. [v2`sub`v2] The difference of v1 and v2. [v1`div`v2] The quotient of v1 divided by v2. [v1`mod`v2] The remainder of v1 divided by v2. [random`n] A random number from 0 to n-1 where n is 0..65535. 4.4. Environment and System Form Replaced by {} = optional parameter ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [detansi] If ANSI detected then T else F [dosmajor] DOS major version number. (20 for OS/2) [dosminor] DOS minor version number. (20 for DOS 6.2, 30 for OS/2 Warp) [{env`}name] text of the environment string = name. When ENV` is used, then a reference to an undefined variable returns an empty string. When ENV` is not used, and the environment variable does not exist, an errorlevel 1 exit for undefined macro is performed. [parse`d`s`output-list] Parse, with delimiter d, s into output list. MACRO, Batch File Enhanser 4.02 Page 6 Where output list is delimited with the grave accent and consists of three different actions: 1) an empty string makes parse item part of parse macro output. 2) The string NUL or nul discards the parsed item. 3) An environment variable which receives the parsed item. When parsed items exceeds the output-list items, then the last list item gets rest of the parsed items. When output-list items exceeds the parsed items, then if output item is an environment variable, it will be cleared. When the delimiter is a space, then one or more spaces may exist between parsed items. [v++] The value of the environment variable V is output, then it is incremented by one. [v--] The value of the environment variable V is output, then it is decremented by one. [++v] The environment variable V is incremented by one, then its value is output. [--v] The environment variable V is decremented by one, then its value is output. 4.5. Console Form Replaced by {} = optional parameter ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [cr] Returns a carriage return, line feed for splitting the output onto more than one line. [menu`menutitle`items] Makes a popup menu with a title of menutitle. If menutitle is prefixed with a !, then the title will blink. One or more menu items are separated with the grave accent. The first capitalized letter of an item will select that item. If no capital letters exist, then the first letter or character will select the item. Alphabetic characters are always returned in upper case. A menu item can have an optional alternate key. When a menu item is prefixed with an @, then pressing an Alt-alphanumeric for that menu item will return that items letter prefixed with an A. The menu item @Space returns S when S is pressed and returns AS when Alt-S is pressed. Menus macros are one place where you can easily exceed the DOS limitation of 127 characters on a command line. A way to have up to 255 characters in a menu string will be discussed in the examples. [msg`text] Displays text in a popup message at the bottom of the screen. It goes away when MACRO exits, so use it in front of a prompt or menu so it can be seen. [msgdelay`text{`d}] Displays the same as MSG, but exits when d milliseconds have passed. If d is not specified, then 5000 milliseconds or 5 seconds is assumed. [msgpause`text] Displays the same as MSG, but will pause until ESC or Enter is pressed. [?Prompt`d`l`t] console response to "Prompt". The input is prompted in a popup window. If prompt begins with ^, then the response will not be echoed. All MACRO, Batch File Enhanser 4.02 Page 7 fields are optional, [?] is all that is needed. The default response is set to d, the length of the response is limited to l, and the prompt will timeout after t seconds with errorlevel 6. [?delay{`d}] Delays d milliseconds. If d is not specified, then 5000 milliseconds or 5 seconds is assumed. 4.6. Date & Time Form Replaced by {} = optional parameter ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [udate] UNIXDATE - the number of seconds that have elapsed since midnight on Jan 1st 1970 as a eight place hexidecimal number. [uidate] UNIXDATE Integer - the number of seconds that have elapsed since midnight on Jan 1st 1970 as an integer number. [pdate`datestr] Packed date as days since January 1, 1900. DATESTR can be a date as mm/dd/yy, TODAY, YESTERDAY, MONDAY...SUNDAY, THISWEEK`MON ... THISWEEK`SUN, LASTWEEK`MON ... LASTWEEK`SUN, THISMONTH, LASTMONTH. [pdateend`datestr] Packed date as days since January 1, 1900. The end date of the period specified by DATESTR, or today whichever is less, is returned. If [pdate`lastmonth] returned a packed date representing 3/1/95, then [pdateend`lastmonth] will have a packed date representing 3/31/95. All of the following date macros have an optional packed date parameter, such as [date`[pdate`lastmonth]]. [date] date as mm/dd/yy [month] month as 1..12 [day] day as 1..31 [dayofweek] day of the week as 1..7 where 1=Monday. [julian] julian date - three digit zero filled day of year. [year] year as yyyy [leapyear] If the year is a leap year then T else F. [yyyymmdd] Eight digit year, month, day. [yymmdd] Six digit year, month, day. [mm] Two digit zero filled month. [dd] Two digit zero filled day. [yy] Two digit zero filled year. [yyyy]] Four digit year [month$] month as January..December [month3$] month as Jan..Dec [day$] day as Monday..Sunday [day3$] day as Mon..Sun [time] time as hh:mm:ss [hour] hour as 0..23 [minute] minute as 0..59 [second] second as 0..59 [hhmmss] Six digit hour, minute, second. [julianwk`d`w] d=Mon..Sun; w=relative week (0=this week) Three digit zero filled julian date of the week starting on day d (today or day just past) for week w. The julian date of this Friday (today or just past) is [julianwk`fri`0] MACRO, Batch File Enhanser 4.02 Page 8 [weeknum`day`w] d=Mon..Sun; w=relative week (0=this week) Two digit zero filled week number in year starting on day d (today or day just past) for week w. The week number of this Monday (today or just past) is [weeknum`mon`0] 4.7. Disk and File Form Replaced by {} = optional parameter ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [@farble] first line of the text file farble [@farble`n] nth line of the text file farble [@farble`last] last line of the text file farble [@farble`grep`grepstring] The first line of the file farble that matches the grepstring. Current grepstring is a simple find of a string beginning in column 1. [afn`filespec] when ambibuous filespec exists then T else F [ufn`filespec] when unique filespec exists then T else F [directory`d:] current directory of drive d with trailing \ - remember to append a period if you just want the directory. d is optional, but can be d: or a full path. [diskfree`{drivespec}] free space of disk drive (-1 for undefined drive or floppy not installed). [disksize`{drivespec}] size of disk drive (-1 for undefined drive or floppy not installed). {drivespec}: blank for default drive, or A through Z. [fdrive`filespec] extracts the disk drive of the filespec. [fname`filespec] extracts the file and type of filespec [fonly`filespec] extracts the file name less type and path of filespec [fpath`filespec] extracts only the directory path of filespec with a trailing \ [ftype`filespec] extracts only the file type of filespec [getdir`{dirspec}] puts directories matching {dirspec} into window for selection. Ctrl-Enter returns that directory, Enter just displays another window of that directory. Returns trailing \ , so append . if using to change directory. [getfage`filespec] age in days of unique file filespec. When filespec does not exist, then -1 is returned. [getfages`filespec] age in seconds of unique file filespec. When filespec does not exist, then -1 is returned. [getfdate`filespec] date of file filespec [getufdate`filespec] hexidecimal unixdate of file filespec [getuifdate`filespec] integer unixdate of file filespec [getfile`{filespec}] puts files matching {filespec} into window for selection. Selecting a directory shows that directory. [getfsize`filespec] size of file filespec [promptgetfile`{prompt}`{filespec}] prompts for file name with {filespec} as the MACRO, Batch File Enhanser 4.02 Page 9 default. If the response to the prompt is ambiguous (contains ? or *), then operation is the same as GETFILE. Append N, SHORT, or NSHORT to GETFILE to get the following: GETFILE Normal listing with directories and a full listing. GETFILEN No directories are listed. GETFILESHORT Use a short file listing without size and date attributes. GETFILENSHORT No directories and a short listing. The same can be done for PROMPTGETFILE. 4.8. String editing Form Replaced by {} = optional parameter ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [cap`string] Capitalizes string [lcase`string] Converts string to lower case [chg`s1`s2`s3] Change all s1 to s2 in the string s3. [len`string] Length of string [lpad`info`c`fill] Pad info at left to c columns using the fill string [ltpad`info`c`fill] Force info to c spaces by truncating or padding to the left with the fill string [nul`string] Reduces the output of string to an empty string. Useful if an environment variable is incremented or decremented and its output is not desired: [nul`[++v]] [pad`info`c`fill] Pad info to c columns using the fill string [pos`substr`string] Returns position of substr in string. [ss`info`s`c] The substring of info starting at column s for c characters. [tpad`info`c`fill] Force info to c spaces by truncating or padding with the fill string [ucase`string] Converts string to upper case 4.9. Supplying more that 127 characters to macros Dos will only read the first 127 characters from the batch file lines. Some macros can accept more than 127 characters. MACRO can produce up to 255 characters on standard output lines. A long menu may require a line of more than 127 characters. You can submit more that 127 characters to some macros by storing extra characters in an environment variable or in a file. Here, the second part of a long menu string is set into an environment variable where MACRO can fetch it on the following line: set mx=5 the fifth menu item,6 the sixth menu item,7 the seventh me nu item,8 the eighth menu item,9 the ninth menu item m [menu`Select`1 the first menu item,2 the second menu item,3 the t hird menu item,4 the fourth menuitem,[env`mx]] Here, the menu macro gets its menu string from a file: MACRO, Batch File Enhanser 4.02 Page 10 m [menu`Select`[@menu]] 4.10. Literal next The ASCII tilde ~ is used as a literal next character. Place it in front of a bracket to make that bracket become an output character instead of being a macro begin character. To output a tilde enter double tildes. 4.11. Nested Macros Nested macros are allowed: m [?What is [comspec], [?What is your name]] says you. Even the result of a macro may be a macro: set x=[comspec] M [?The comspec is [x], [?What is your name? ]]. 4.12. Testing macros from the console To give yourself confidence on whether your macros are properly composed, you can enter M [!] and MACRO will process input from the console. The macro [!] will cause any macros in the input text to be processed. If you entered [comspec], you would get something like C:\DOS\COMMAND.COM. Try this to test the proper syntax for your macros. 4.13. Errorlevels The errorlevels returned are: 0 - ok 1 - Syntax error or undefined macro 2 - Unable to open or read file 3 - Unable to find file 4 - Undefined environment variable 5 - User canceled console prompt or file name prompt 6 - Timeout from a prompt or list selection Errorlevels 1 and 2 always result in a halt of MACRO. Errorlevels 3, 4, and 5 do not cause a halt unless the command line contains one of the /halt# options. MACRO, Batch File Enhanser 4.02 Page 11 4.14. M/XQT errors while executing a command These errors have been biased by adding 100 to the actual error level returned by DOS. This makes the errorlevel discernable from the errors encountered by M/XQT. 102 - File not found 103 - Path not found 105 - File access denied 106 - Not enough memory 4.14.1. M/XQT'ed Errorlevels M/XQT normally executes commands via the current command processor as named in the environment variable COMSPEC. The command processor does not return the errorlevel of the executed command to M/XQT. If you specify the exact path of the executed command along with the file type (.EXE or .COM) then M/XQT will execute the command directly, except when the command has input or output re-direction. If the .EXE or .COM program is in a directory defined in your system's PATH statement, then M/XQT will find it without you having to specify the complete path. You can then test for the command's errorlevels: :: farble.exe is in a directory in the PATH statement. m/xqt farble.exe if errorlevel 2 goto two if errorlevel 1 goto one M/XQT also has errorlevel exits when user input is canceled or there is a syntax error. So, the errorlevel being returned may be because of an error in syntax or a user Esc from an M/XQT prompt. M/XQT also uses a fair amount of memory because of the library routines that it must have to process the macros. To allow a program to have all available memory and to allow for testing of the program's errorlevels, then don't execute commands directly with M/XQT. Instead, use M/SET to create environment variables that can be tested or executed. M/SET sets environment variables. It modifies the active shells environment, The following example prompts for an .EXE file name, and executes it by substituting its name on its own line in the batch file. :LOOP M/SET/HALT5 C=[GETFILENSHORT`*.exe] IF ERRORLEVEL 1 GOTO QUIT ECHO %C% IS THE FILE BEING EXECUTED %C% IF ERRORLEVEL 2 GOTO TWO IF ERRORLEVEL 1 GOTO ONE :ONE :TWO GOTO LOOP :QUIT The macro [GETFILE`] would select all files. [GETFILEN`] gets all files without any directories in the selection. [GETFILENSHORT`] is the same, but the size and time/date is not shown. MACRO, Batch File Enhanser 4.02 Page 12 The errorlevel test after M/SET is testing for an escape from the file selection window. The /HALT5 makes M/SET halt for errorlevel 5 (escape from prompt). The command processor expands the %C% into the selected EXE file name and then processes the line. The errorlevel tests after the %C% now properly detect the errors in your program. 4.15. Creating new environment space You can display the available environment space by entering m/set/d and you will get an output like: ActiveShell PSP:0318 Env:043D Size: 2048 Used: 692 Free: 1356 If you discover that you need more free environment space then you must add SHELL=C:\DOS\COMMAND.COM C:\DOS\ /E:1024 /p to your CONFIG.SYS to make more room for environment variables. 4.16. Reserving space in shelled environments Reserve space in the environment by placing the following line in your AUTOEXEC.BAT file: SET RESERVE=----------------RESERVED-SPACE---------------- Use up to 127 characters. When needed, M/SET will remove the RESERVE variable to make space available. MACRO, Batch File Enhanser 4.02 Page 13 5. Speed Considerations Many batch files can be shortened by replacing the functions of many lines with only one line using MACRO. Use the included program TIMED.EXE to compare the execution times of your batch file that does not use MACRO and the batch file that does. Even though MACRO is nearly 70K bytes when compressed with PkLite, you may find that your batch file actually runs faster if you can just make it have fewer lines with the aid of MACRO. This is because DOS has to open and re-read the batch file for each line that it has to execute. With the /xqt switch, the COMMAND processor is used to execute the output of MACRO. When the executed program name has the .COM or .EXE extension specified and there are no standard i/o redirection characters, then MACRO will bypass the COMMAND processor and execute the program directly. If you use MACRO a lot, such as in batch files used in running a BBS, you can place a copy of the command processor and a copy of MACRO into a directory on a ram disk. Then set the comspec environment variable to that directory, and add that directory to the PATH. You should then place your main batch files on the ram disk. If you do all of this, then your batch files will execute more quickly. Example of changes to your autoexec.bat: :: A ram disk F: has been created in the CONFIG.SYS m/xqt copy [comspec] f:\ m/set path=f:\;[path] m/set comspec=f:\[fname`[comspec]] copy c:\util\m.exe f:\ MACRO, Batch File Enhanser 4.02 Page 14 6. Batch file notes This is not intended to be a tutorial of batch file programming. Some important points that sometimes get overlooked are covered. 6.1. Semaphore Files Any one the following three lines can create a semaphore file: rem >mailedit.now echo. >mailedit.now echo This text>mailedit.now and MAILEDIT.NOW will be created in the current directory. COMMAND.COM scans and acts on the standard output redirection operator ">" by creating the specified file and removing the operator and the file name from the command line. The file is created regardless of whether the program can process standard output text. IF EXIST FARBLE.DOC >DOC.NOW will always create DOC.NOW regardless of whether the IF is true or false. To create DOC.NOW when FARBLE.DOC exists requires a simple program that just creates the file name specified on its command line. The SYMAPHOR.EXE program does just that: IF EXIST FARBLE.DOC SEMAPHOR DOC.NOW 6.2. Using the TMP and TEMP environment variables DOS and many programs use the environment varible TEMP to be the name of a directory to hold temporary files. If you have the spare RAM, then you should create a ram disk and set the TEMP variable to this drive: md e:\trashcan set temp=e:\trashcan then, dir \inbound >%temp%\temp.txt places the directory listing of inbound into the text file e:\trashcan\temp.txt. In the example, when the TEMP variable does not exist, then the root directory is used instead. Here is one instance where having a TEMP variable defined will cause a problem. The DOS format command will try to make a copy of the source disk into the TEMP directory when you do DISKCOPY A: A:. If the temporary directory cannot hold a whole disk image, then DOS will require multiple insertions of the disks. A solution here would to temporarily remove the TEMP variable by SET TEMP=, then restore it MACRO, Batch File Enhanser 4.02 Page 15 after the whole disk copy is completed. 6.3. Batch Labels Labels begin with a colon in column one followed by up to eight characters. Labels cannot have spaces, semicolons or equal signs. 6.4. Long Lines No batch file line can have more than 127 characters. Valid command lines created with M/XQT must contain 127 charcters or less. 6.5. Tests with IF If tests the equality or non equality of two string using the == operator. Each test string must have at least one non-blank. if %1==y call newbatch will fail if %1 is blank. To prevent this error, just add a character to both sides. if %1'==y' call newbatch If you know that both strings will always be non-blank, then you can eliminate the extra character. 6.6. Error Logging Errors will be logged to a file named by the environment variable MERR. If you enter this line in your AUTOEXEC.BAT file: set merr=c:\misc\merr.log then any error that causes a halt will be logged to the specified file name. This may be useful in debugging complex batch files without having to watch too closely. I use the following batch file to view the error log: @echo off m/set A=[getfages`[env`merr]] m/set f=[ucase`[env`merr]] choose /n/t:"Age of %f% is %a% seconds."<%f%>nul set a= set f= MACRO, Batch File Enhanser 4.02 Page 16 7. Examples The M.EXE archive contains many batch file examples. Some of these files are for everyday use: such as XLIST.BAT, INFO.BAT, LOTTERY.BAT, and more. MACRO, Batch File Enhanser 4.02 Table of Contents 1. License ....................................................... 1. 2. Warranty ...................................................... 2. 3. Introduction .................................................. 3. 3.1. What it does ............................................. 3. 3.2. Switches ................................................. 4. 4. Macros definitions ............................................ 4. 4.1. Standard Input ........................................... 5. 4.2. Relational ............................................... 5. 4.3. Math ..................................................... 5. 4.4. Environment and System ................................... 5. 4.5. Console .................................................. 6. 4.6. Date & Time .............................................. 7. 4.7. Disk and File ............................................ 8. 4.8. String editing ........................................... 9. 4.9. Supplying more that 127 characters to macros ............. 9. 4.10. Literal next ........................................... 10. 4.11. Nested Macros .......................................... 10. 4.12. Testing macros from the console ........................ 10. 4.13. Errorlevels ............................................ 10. 4.14. M/XQT errors while executing a command ................. 11. 4.14.1. M/XQT'ed Errorlevels ............................ 11. 4.15. Creating new environment space ......................... 12. 4.16. Reserving space in shelled environments ................ 12. 5. Speed Considerations ......................................... 13. 6. Batch file notes ............................................. 14. 6.1. Semaphore Files ......................................... 14. 6.2. Using the TMP and TEMP environment variables ............ 14. 6.3. Batch Labels ............................................ 15. 6.4. Long Lines .............................................. 15. 6.5. Tests with IF ........................................... 15. 6.6. Error Logging ........................................... 15. 7. Examples ..................................................... 16.