I like to code in assembler as well-structured, even though that's not the 
maximum possible efficiency. For example, I'll break up the program into 
subroutines even when the subroutine is only executed from one place.

In COBOL this actually is optimal, since the optimizer will inline the 
instructions. You get the benefit of an easy to understand and maintain program 
with no loss in performance.

In assembler, the oldest programs I inherited still used BAL logic for such 
routines, with a register save area. Later code may use a BAS/JAS with a 
register but not save the register, if that register isn't needed by the 
subroutine.

Now I have subroutine macros that will call and return from such routine using 
a Jump.

What I'm wondering is, is there a reasonable way to have HLASM inline the code?

I mean, the code would be written as:

Instruction
Instruction
* here's where I want to insert ROUTINE_A
Instruction

 :
 :

ROUTINE_A EQU *
Routine A's instructions
*end of routine A

But it would assemble routine A in the place in the instruction stream where it 
was "called".

I'm thinking it should be possible with LOCTR but I've never actually used 
that, and it isn't clear how.

Note: If I were to actually do this, I'd do it by having the subroutine 
entry/exit/call macros generate the desired code.

Reply via email to