Macros 란?
Macro는 ASAP에서 Script로 프로그래밍을 하기 위한 수단으로 사용되어지는 일종의 명령어로써 광학적인 어떤 기능을 가지지는 않는다.
Macro는 ASAP에 미리 정의되어 있는 것들도 있고, 사용자가 임의로 만들어서 사용하는 것도 있다. ASAP 내에서 “$” 나 “&” 문자가 명령어 앞에 붙으면 이 명령어는 Macro를 의미한다. Macro를 알면 시스템을 구성하거나 pattern을 만들때, 그리고 결과물을 확인할 때 아주 유용하게 쓰인다. C 나 Fortran 같은 프로그램을 사용해 본 경험이 있다면 이 기능을 더욱 유용하게 사용할 수 있을 것이다.
Macro에는 프로그램의 흐름을 도와주는 명령어들과 입/출력을 도와주는 명령어들이 주종을 이루고 있다. 아래에 흔히 사용되는 몇가지 명령어들을 열거하였다.
▧ Program Flow Control
$GO Skip over input records
$IF Conditionally processes a block of records
__$ENDIF
$DO Loops through single or multiple records
$ITER Iterates through a block or records, varying parameters
▧ Input and Output Control
$CASE Specifies input case sensitivity
$ECHO Controls the echo of input to the Command Output window
$REG Display the contents of register variables
$ASK Sets a register variable by interactive prompting
$SCR Edits/displays register fields on a user-defined screen or the Command Output window
$GRAB Grabs numbers from the Command Output window and copies them to register variables
$STO Stores or recalls an entire register set to or from a file
$RECAL
$READ Temporarily reads input from another file, and returns
$IO Redirects general I/O
▧ Other Predefined Macros
$DATIM Suppresses date, time, and version numbers in graphics
$UNVAR Determine whether an undeclared variable should cause a warning or an error when encounters
$TIC Displays elapsed CPU time
$FCN Defines a new math function
$EVAL Evaluates a function
$SYS Runs a DOS command or Program