This has been a frustrating adventure. I hope this is easy for someone who has
already done this. I need to call a C++ program from an ASM program and pass it
parameters. I plan to use CEEPIPI to do the call because it is documented as
being efficient(as documented in the “LE Programming Guide”) but when tried it
abends on an S0C4 when attempting to access the parameter. Note: The call was
successful but it failed when accessing the passed parameter. So I tried the
example exactly as coded in the “C++ Programmer’s Guide”. I could not get it to
link properly so I renamed some modules and changed the assembler program to
issue a load and finally received an S0C7! In all cases the CEEDUMP was pretty
much useless and it is not abending in my code.
EDIT TSSDON.CSOURCE(SDKMAIN) - 01.15
Command ===>
****** ***************************** Top of Data ******
000001
000002 // this program will print what is passed. It is
000003
000004 #include <stdio.h>
000005 #include <stdlib.h>
000006 #include <string>
000007
000008 #pragma map(SDKREAD,"SDKREAD") (I do not know what this does)
000009
000010 extern "OS" int SDKREAD(char PRINTLine[121])
000011 {printf("SDKREAD Entered \n"); This executed successfully
000012 //function will be called from assembler
000013 printf(PRINTLine,"\n");
000014 return 0;
000015 }
The meat of the ASM calling program:
Start of program
LOAD EP=CEEPIPI LOAD CEEPIPI ROUTINE DYNAMICALLY
ST R0,PPRTNPTR SAVE THE ADDR OF CEEPIPI ROUTINE
*C INITIALIZE AN LE PIPI SUBROUTINE ENVIRONMENT.
*
LA R5,PPTJL GET ADDRESS OF PIPI TAJLE
ST R5,@CEXPTJL CEEXPTJL-ADDR -> PIPI TAJLE
L R15,PPRTNPTR GET ADDRESS OF CEEPIPI ROUTINE
* INVOKE CEEPIPI ROUTINE
INITPPI CALL (15),(INITSUB,@CEXPTJL,@SRVRTNS,RUNTMOPT,TOKEN)
*C CALL SDKREAD
* CALL (15),(CALLSUB,SDKREADI,TOKEN,SDKBUFA,
* SUBRETC,SUBRSNC,SUBFBC) INVOKE CEEPIPI ROUTINE
LA R1,PRINTA
ST R1,SDKREADM
LA R1,SDKREADP
L R15,PPRTNPTR GET ADDRESS OF CEEPIPI ROUTINE
BASR R14,R15
** End of program **
INITSUB DC F'3' FUNCTION CODE TO INITIALIZE FOR SUBR
@CEXPTJL DC A(PPTJL) ADDRESS OF PIPI TAJLE
@SRVRTNS DC A(0) ADDR OF SERVICE-RTNS VECTOR, 0 = NONE
RUNTMOPT DC CL255' ' FIXED LENGTH STRING OF RUNTIME OPTNS
TOKEN DS F UNIQUE VALUE RETURNED (OUTPUT)
CALLSUB DC F'4' FUNCTION CODE TO CALL SUBROUTINE
PTBINDEX DS F THE ROW NUMBER OF PIPI TAJLE ENTRY
PARM DS A PARAMETER TO PASS TO MEASTRMN
SUBRETC DS F SUBROUTINE RETURN CODE (OUTPUT)
SUBRSNC DS F SUBROUTINE REASON CODE (OUTPUT)
SUBFBC DS 3F SUBROUTINE FEEDBACK TOKEN (OUTPUT)
*
* ====================================================================
* PIPI TAJLE.
* ====================================================================
PPTJL CEEXPIT , PIPI TAJLE WITH INDEX
PPT DS 0A
CEEXPITY SDKPUT,0
CEEXPITY SDKREQ,0
CEEXPITY SDKREAD,0
CEEXPITS END OF PIPI TAJLE
SDKPUTI DC F'0' ROW NUMBER OF PIPI TAJLE FOR SDKPUT
SDKREQI DC F'1' ROW NUMBER OF PIPI TAJLE FOR SDKREQ
SDKREADI DC F'2' ROW NUMBER OF PIPI TAJLE FOR SDKREAD
SDKREADP DS 0A PARAMETER LIST TO CALL SDKREAD
DC A(CALLSUB)
DC A(SDKREADI)
DC A(TOKEN)
SDKREADM DC A(0) MESSAGE TO READ
DC A(SUBRETC)
DC A(SUBRSNC)
SDKREADE DC A(SUBFBC)
PRINTA DC A(X'80000000'+PRINT)
PRINT DC CL121'PRINT THIS LINE'
DC X'00'
I've been working on this for days now, so any help will be greatly appreciated.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN