in other programs, usually with parameters, like the preprocessor facilities in C and related languages. Macros can include conditional assembler instructions, such as AIF (an ‘if’ construct), used to generate different code according to the chosen parameters. That makes the macro facility of this assembler very powerful. While multiline macros in C are an exception, macro definitions in assembler can easily be hundreds of lines. Operating system macros Most programs will require services from the operating system, and the OS provides standard macros for requesting those services. These are analogous to Unix system calls. For instance, in MVS (later z/OS), STORAGE (with the OBTAIN parameter) dynamically allocates a block of memory, and GET retrieves the next logical record from a file. Unlike Unix system calls, macros are not standardized across operating systems though. Even something as simple as writing a "sequential file" is coded differently e.g. in Z/OS than in Z/VSE. Examples The following fragment shows how the logic "If SEX = 'M', add 1 to MALES; else, add 1 to FEMALES" would be performed in assembler. CLI SEX,C'M' Male? BNE IS_FEM If not, branch around L 7,MALES Load current value of MALES into register 7 LA 7,1(7) add 1 ST 7,MALES store back the result B GO_ON Finished with this portion IS_FEM EQU * A label L 7,FEMALES Load current value in FEMALES into register 7 LA 7,1(7) add 1 ST 7,FEMALES store back the result GO_ON EQU * - rest of program - * MALES DC F'0' Counter for MALES (initially=0) FEMALES DC F'0' Counter for FEMALES (initially=0) The following is the ubiquitous Hello world program, and would, executing under an IBM operating system such as OS/VS1 or MVS, display the words 'Hello World' on the operator's console: HELLO CSECT The name of this program is 'HELLO' * Register 15 points here on entry from OPSYS or caller. STM 14,12,12(13) Save registers 14,15, and 0 thru 12 in caller's Save area LR 12,15 Set up base register with program's entry point address USING HELLO,12 Tell assembler which register we are using for pgm. base LA 15,SAVE Now Point at our own save area ST 15,8(13) Set forward chain ST 13,4(15) Set back chain LR 13,15 Set R13 to address of new save area * -end of housekeeping (similar for most programs) - WTO 'Hello World' Write To Operator (Operating System macro) * L 13,4(13) restore address to caller-provided