Ludmila Koganer wrote:
Thanks for the quick response.
OK here is my code.
I have two simple starter programs, PGM64A in AMODE 64 and PGM A in AMODE 31
I need to pass a field CRITDTE to PGMA and return a return value from PGMA.
The code is below.
PGM64A CSECT
PGM64A AMODE 64
PGM64A RMODE 31
            BAKR   14,0
            LARL    13,SAVEAREA
            LARL    12,PGM64A
            USING  PGM64A,12
            LGHI    15,0
            LLGF    1,CRITDTE
            LLGT    15,=V(PGMA)
            SAM31
            BASR    14,15
            PR        ,

CRITDTE  DS     CL8
SAVEAREA       DS     0D'0',F'0',C'F1SA'

            LTORG
            END        PGM64A.

I can BASR to PGMA no problem. Every time I try to modify the inbound parm,
I get S0C4 / Reson 11. I am not sure where I am coding incorrectly.
Following a few other posts I tried difft combinations of Loaing parm
including LA, LLGT but it is not working. Since if I don't alter the inbound
block  it runs, I am making some glorious mistake on passing the parm. I
cant seem to figure out,.



pgmA is a vsery simple subroutine that only has a L 3,0(1)
LA   5,UPDTXT
MVC  0(7,3),0(5)     =======>Receive inbound value in Reg 3 and update with
the value in updtxt
besides the std prolog and epilog.

Regards,
Ludmil

I did some experiments to come up with some alternative,
perhaps a richer, example. I do not use BAKR / PR linkages,
only classic linkages, although I have gotten into the
habit of coding all reentrant code. For PGM64A, doing a
static call to PGMA:

*PROCESS COMPAT(NOCASE,MACROCASE)
PGM64A CSECT
PGM64A AMODE    64
         SYSSTATE AMODE64=YES,ARCHLVL=2
         llgtr 13,13         * ensure R13 valid 64-bit address
         stmg  14,12,8(13)   * save all passed regs
         larl  12,pgm64a      * get base reg for program
         using PGM64A,12
         getmain r,lv=160  * 144 save area + 16 byte work area
         stg   1,136(13)
         stg   13,128(1)
         lgr   13,1
         mvc   4(4,13),f4sa
         mvc   144(14,13),parmlist
         la    2,150(13)   point to text
         st    2,144(13)
*
         la    2,148(13)  point to halword prefixed string
         wto   text=(2),routcde=(11),mf=(e,genwto)
*
         l     15,vpgma
         o     15,amode31_bit  set target amode to 31
         la    1,144(13)    point to address of data
         bassm 14,15
*
         la    2,148(13)  point to halword prefixed string
         wto   text=(2),routcde=(11),mf=(e,genwto)
*
         lg    13,128(13)
         lg    1,136(13)
         freemain r,lv=144,a=(1)
         lmg   14,12,8(13)
         sr    15,15          * set return code
         bsm   0,14           * return, resetting AMODE
*
f4sa     dc    c'F4SA'
vpgma    dc    v(pgma)
amode31_bit    dc    x'80000000'
parmlist dc    a(critdte)
msgarea  dc    h'8'
critdte  dc    cl8'Original'
genwto   wto   text=(2),routcde=(11),mf=l
         END   PGM64A


=========

Then PGMA:

*PROCESS COMPAT(NOCASE,MACROCASE)
PGMA CSECT
PGMA AMODE      31
         stm   14,12,12(13)     standard save area linkage
         lr    12,15            get entry point address
         using PGMA,12
         l     2,0(1)           save pointer to parms
         GETMAIN R,LV=144
         xc    0(144,1),0(1)    binary zeros everywhere
         st    13,4(,1)         standard backward pointer
         lr    13,1             R13 point to standard save area


         mvc   0(8,2),newvalue

         lr    1,13             point to getmained area
         l     13,4(13)         point to caller's save area
         sr    15,15          * set return code
         FREEMAIN R,LV=144,A=(1)
         lm    14,12,12(13)
         bsm   0,14           * return, resetting AMODE
*
newvalue dc    cl8'Changed'
         END   PGMA

========

After running, in the JES JOB log you will see:

21.29.33 JOB06131  +Original
21.29.33 JOB06131  +Changed

========

To make the call dynamic:

*PROCESS COMPAT(NOCASE,MACROCASE)
PGM64B CSECT
PGM64B AMODE    64
         SYSSTATE AMODE64=YES,ARCHLVL=2
         llgtr 13,13         * ensure R13 valid 64-bit address
         stmg  14,12,8(13)   * save all passed regs
         larl  12,pgm64B      * get base reg for program
         using PGM64B,12
         getmain r,lv=160  * 144 save area + 16 byte work area
         stg   1,136(13)
         stg   13,128(1)
         lgr   13,1
         mvc   4(4,13),f4sa
         mvc   144(14,13),parmlist
         la    2,150(13)   point to text
         st    2,144(13)
*
         la    2,148(13)  point to halword prefixed string
         wto   text=(2),routcde=(11),mf=(e,genwto)
*
         load  ep=pgma
         lgr   15,0
         la    1,144(13)    point to address of data
         bassm 14,15
*
         la    2,148(13)  point to halword prefixed string
         wto   text=(2),routcde=(11),mf=(e,genwto)
*
         lg    13,128(13)
         lg    1,136(13)
         freemain r,lv=144,a=(1)
         lmg   14,12,8(13)
         sr    15,15          * set return code
         bsm   0,14           * return, resetting AMODE
*
f4sa     dc    c'F4SA'
parmlist dc    a(critdte)
msgarea  dc    h'8'
critdte  dc    cl8'Original'
genwto   wto   text=(2),routcde=(11),mf=l
         END   PGM64B



====

Check out our course "z/OS Assembler for Applications
Programmers" at:

http://www.trainersfriend.com/Assembler_%20courses/C500descrpt.htm


--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-393-8716
http://www.trainersfriend.com

  z/OS Application development made easier
    * Our classes include
       + How things work
       + Programming examples with realistic applications
       + Starter / skeleton code
       + Complete working programs
       + Useful utilities and subroutines
       + Tips and techniques

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to