>SYSSTATE AMODE64=YES,ARCHLVL=2 >SAM64 Switch Into 64 Bit Addressing Mode A good rule of thumb is "whenever you switch between AMODE 64 and AMODE 31 (in either direction), and at the beginning of your module, specify SYSSTATE to match". It is of course not necessary if there are no macros within a given section, but does no harm, and if you ever change to add a macro, you'll be happy it's there.
Personally I would create a macro that I would use instead of using SAM64 / SAM31 directly, to help me not forget. >CALL (R15),(P1,ORIGIN,P2,RC) > >ORIGIN DS AD >PGM@ DS A Address Of Program to be called >P1 DS A Parameter 1 >P2 DS A Parameter 2 >RC DS A Response Code It is the caller's responsibility to meet whatever interface the callee has defined (decreed). In your example the call is in AMODE 64. The default parameter list in AMODE 64 is 8-bytes wide. If the callee accepts AMODE 64 callers with "normal" AMODE 64 parameter list and accepst an 8-byte value as its second parameter, and 4 byte parameters for P1, P2, RC then what you have will work with respect to the parameter list. (apologies for using "parameters", if "arguments" is right in some cases) However, L R15,PGM@ Load R15 with Other Programs Load will not work properly for AMODE 64, as you have not set the high half of register 15 let along cleared bit 0 of PGM@. LLGT R15,PGM@ Load 64-bit R15 with other program's load would work. I must also point out that if you have an AMODE 64 program target that you LOADed, the address returned by LOAD is what is needed if you are going to call via BASSM. For an AMODE 64 program that means the low bit is on. The CALL macro can be told to use BASSM (LINKINST keyword) but will not do so by default. If you want to use BALR/BASR, then you also need to clear the low bit. Hence, NILL R15,X'FFFE' Clear bit 63 might be needed. Note that you should use BASSM for a target that is not yours only if it is documented to be OK to do so. It might not be OK. The result of using BASSM when you should not is that you will get control back in the wrong AMODE (or might not get control back at all in some cases if your program is above 16M) Peter Relson z/OS Core Technology Design
