# Copyright (c) 2002 Peter Guntert. All rights reserved. ## 7MACROS: job - check a macro for errors and execute it ## ## Usage: job {} ## ## "job" is a standard macro usually used in batch jobs that first checks ## the macro for errors without doing the actual calculation on ## the data and then executes it, provided that there were no errors in ## the check phase. Otherwise, the values of all global variables are ## listed and the program is stopped. ## The types of errors that are detected during the check phase are ## determined by the value of the system variable check. By default, ## command and file errors are detected. If no error was detected, the ## required memory and workspace are given after the check. ## Execution of the macro is not started if the macro requires more memory ## or workspace than available. job resets the system variables usedsize ## and usedwork. ## ## See also: check, maxsize, maxwork, usedsize, usedwork var i params if (nparam.lt.1) error "*** Missing macro name." print print " Checking the macro \"$p1\":" print erract := "show; quit" if (.not.def('check')) check := command, file params := do i 2 nparam params := $params $p$i end do usedsize = 0 usedwork = 0 $p1 $params check := NULL print print " Macro \"$p1\" checked." print " $usedsize/$usedwork words of memory/workspace required." if (usedsize.gt.maxsize .or. usedwork.gt.maxwork) \ error "Only $maxsize/$maxwork words of memory/workspace available." print $p1 $params