I am trying to pass back a parameter from an external subroutine written in assembler. The calling routine is in cobol, and the parameters to the external assembler routine look like this:
01 CALCSHRS-PARMS.
05 CS-DEPOSIT-AMT PIC 9(5)V99 COMP-3.
05 CS-SHARE-PRC PIC 9(3)V99 COMP-3.
05 CS-SHARE-AMT PIC 9(9)V99 COMP-3.
The call looks like this:
CALL 'CALCSHRS' USING CS-DEPOSIT-AMT
CS-SHARE-PRC
CS-SHARE-AMT.
The routine uses the CS-DEPOSIT-AMT and the CS-SHARE-PRC to calculate the CS-SHARE-AMT, which needs to get passed back. Here is the assembler routine:
CALCSHRS CSECT
*
PRINT NOGEN
*
STM 14,12,12(13) SAVE ENTRY REGS
LR 12,15 SET BASE REG
USING CALCSHRS,12 ESTABLISH ADDRESSABILITY
*
LA 14,SUBPSAVE STANDARD
ST 13,4(,14) SAVE
ST 14,8(,14) AREA
LR 13,14 LINKAGE
*
LM 2,4,0(1) LOAD THE PARAMETERS
*
ZAP DEPOSITP,0(2,4) GET THE DEPOSIT AMOUNT
ZAP SHAREPCK,0(3,3) GET THE SHARE PRICE
*
ZAP SHARESP(9),DEPOSITP INITIALIZE SHARES
*
MP SHARESP,=P'10000' MULTIPLY BY 1000
DP SHARESP,SHAREPCK DIVIDE BY SHARE PRICE
ZAP SHARESPR,SHARESP(6) MOVE THE FIRST 5 BYTES
*
SRP SHARESPR(6),(64-1),5 SHIFT TO ROUND
SRP SHARESPR(6),2,5 SHIFT AGAIN
*
MVC 0(6,4),SHARESPR ME ATTEMPTING TO RETURN SHARESPR...
*
L 13,4(,13) STANDARD SAVE
LM 14,12,12(13) AREA LINKAGE
SR 15,15 SET RETURN CODE TO 0
BR 14
*
LTORG
*
SUBPSAVE DC 18F'0'
*
SHAREPCK DS PL3 SHARE PRICE PACKED
DEPOSITP DS PL5 DEPOSIT IN PACKED DECIMAL
SHARESP DS PL9 SHARES IN PACKED DECIMAL
SHARESPR DS PL6 SHARES ROUNDED
*
END CALCSHRS
I just need to return SHARESPR and have it go in CS-SHARE-AMT back in my cobol program. Everything else works the way I want it to. Anyone know how I need to do that? Any help is much appreciated.