22.02.2015 Views

HLASM Language Reference

HLASM Language Reference

HLASM Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Positional Parameters<br />

Symbolic parameters have a local scope; that is, the name and value they are<br />

assigned only applies to the macro definition in which they have been declared.<br />

The value of the parameter remains constant throughout the processing of the<br />

containing macro definition during each call of that definition.<br />

Notes:<br />

1. Symbolic parameters must not have multiple definitions or be identical to any<br />

other variable symbols within the given local scope. This applies to the system<br />

variable symbols described in “System Variable Symbols” on page 262, and to<br />

local-scope and global-scope SET symbols described in “SET Symbols” on<br />

page 319.<br />

2. Symbolic parameters should not begin with &SYS because these characters are<br />

used for system variable symbols provided with High Level Assembler.<br />

The two kinds of symbolic parameters are:<br />

Positional parameters<br />

Keyword parameters<br />

Each positional or keyword parameter used in the body of a macro definition must<br />

be declared in the prototype statement.<br />

The following is an example of a macro definition with symbolic parameters.<br />

MACRO<br />

Header<br />

&NAME MOVE &TO,&FROM Prototype<br />

&NAME ST 2,SAVE Model<br />

L 2,&FROM Model<br />

ST 2,&TO Model<br />

L 2,SAVE Model<br />

MEND<br />

Trailer<br />

In the following macro instruction that calls the above macro, the characters HERE,<br />

FIELDA, and FIELDB of the MOVE macro instruction correspond to the symbolic<br />

parameters &NAME, &TO, and &FROM, respectively, of the MOVE prototype statement.<br />

HERE MOVE FIELDA,FIELDB<br />

If the preceding macro instruction were used in a source program, the following<br />

assembler language statements would be generated:<br />

HERE ST 2,SAVE<br />

L<br />

2,FIELDB<br />

ST<br />

2,FIELDA<br />

L<br />

2,SAVE<br />

Positional Parameters<br />

You should use a positional parameter in a macro definition if you want to change<br />

the value of the parameter each time you call the macro definition. This is because<br />

it is easier to supply the value for a positional parameter than for a keyword<br />

parameter. You only have to write the value you want the corresponding argument<br />

to have in the correct position in the operand of the calling macro instruction.<br />

However, if you need a large number of parameters, you should use keyword<br />

parameters. The keywords make it easier to keep track of the individual values you<br />

254 <strong>HLASM</strong> V1R5 <strong>Language</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!