Page 1 of 1

Subroutines in LE assembler program

PostPosted: Tue Jun 22, 2010 10:09 pm
by epesin
Hi! Is it possible to write a program on assembler with subroutines in the same file? I.e. the main program begins with the normal "CEEENTRY" macro and then it is calling subroutines belonging to the same CSECT? I'd like not to change the base register, but those subroutines should create new DSAs and all other staff necessary for calling LE services from the subroutines? I want each subroutine to perform a sepatrate function. Does anyone know how to do it?
Like this:

TEST CEEENTRY PPA=MAINPPA,AUTO=WORKSIZE,MAIN=YES,BASE=(R10,R11)

STORAGE OBTAIN,LENGTH=COPYSIZE,LOC=BELOW

LR R9,R1 Move address of storage

L R2,=A(COPYAREA) Point to data to copy
L R3,=A(COPYSIZE) Get size to copy
LR R14,R9 Point to destination
LR R15,R3 Output size = input size
MVCL R14,R2 Copy the data

USING COPYAREA,R9 And now address our copy

* ====================================================================
* First verify that POSIX is ON -- cannot run if not
* ====================================================================
BAL R14,QPOSIX Make sure POSIX enabled
BNZ CLEANUP Failed, get out now

* ====================================================================
* Next let's fetch and display version information.
* ====================================================================
BAL R14,QVERSION Query and display VERSION info
BNZ CLEANUP Failed, get out now

* ====================================================================
* OK, we got and displayed the version. Now create a context.
* ====================================================================
BAL R14,CREATE Create a context
BNZ CLEANUP Failed, get out now


Thank you very much!
Eugene