Hi,

Best way to do all of this , is with an SVC because your GETSP231 needs to be in an authorized library and linked with AC(1) for the modeset to work.... and if you have any non authorized loadlib , on the steplib chain, the MODESET in GETSP231 would not work...

Note: In the old days, they use to say.. .he knows enough to be dangerous to his own health.. but now a days, they call us IT consultants.

Kerneels

On 4/5/2013 2:58 PM, Scott Ford wrote:
Guys:

I have an Assembler routine below i want to call in C. I have changed it to be 
LE conforming.

GETSP231 START 0
GETSP231 AMODE 31
GETSP231 RMODE ANY
          EDCPRLG BASEREG=R12,DSALEN=WORKLEN
          USING LGINWORK,R13       SAVEAREA AND LOCAL VARS
*-------------------------------------------------------------
* LOADS STG AMOUNT  INTO R9, STG ADDR INTO R10 AND RC IN R11
*-------------------------------------------------------------
          LM    R9,R11,4(R1)       LOAD ADDRESS STG AMT, ADR & RC
          L     R9,0(R9)           STG AMT - S/B 4K MULTIPLE
          MODESET KEY=ZERO,MODE=SUP GO INTO SUPERVISOR MODE
          STORAGE OBTAIN,LENGTH=(9),SP=231,LOC=ANY
          ST    R1,0(R5)           RETURN ADDR, IF ANY
          ST    R15,0(R11)         RETURN CODE, OK IF ZERO
          MODESET KEY=NZERO,MODE=PROB BACK TO MORTALITY
*-------------------------------------------------------------
          EDCEPIL
          LTORG
LGINWORK EDCDSAD
WORKLEN  EQU   *-LGINWORK
          YREGS
          END   GETSP231

In C is did this:

/*--------------------------------*/
#include <stdio.h>
#include <string.h>
#pragma linkage(GETSP231,OS)
int rc;
unsigned long int fullwd2;
char fullwd1[8];
main()
{
  fullwd2 = 102400;
  rc = GETSP231(&fullwd2,&fullwd1,&rc);
     printf("Getsp231 rc: %d\n",rc);
  if (rc == 0 )
    { printf("Getsp231 allocation worked\n");
      printf("Allocation of: %d\n,",fullwd2);
      printf("Allocation at: %s\n,",fullwd1);
      }
    else
     { printf("Getsp231 allocation failed\n");
    }
  }

I get a RC=0 which is great, but i should get the address passed back to C and 
I dont see it ..
So ...i call upon the great C crystal ball ...

As always a big thanks,

Scott J Ford
Software Engineer
http://www.identityforge.com/

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to