I am getting ASRA abend when calling a simple assembler program from cics program. I am just trying to pass a 12 byte data from cics to assembler and receive a success return code. Please help me to resolve the issue. Thanks.
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
PACASM01 DFHEIENT CODEREG=3,DATAREG=13,EIBREG=11
XR R15,R15
STM R14,R12,12(R13)
LR R12,R15
USING PACASM01,R12
LA R15,SAVEAREA
ST R13,4(R15)
ST R15,8(R13)
LR R13,R15
L 3,0(1)
WTO 'SURYA1',ROUTCDE=11
L R13,SAVEAREA+4
XR R15,R15
RETURN (14,12),RC=(15)
************************************************************
SAVEAREA DS 18F
************************************************************
END PACASM01
Abend received after triggering the transaction:
Code:
TRANSACTION: PA02 PROGRAM: PAC0002P TASK: 0000222 APPLID: CICS1 DISPLAY: 00
STATUS: AN ABEND HAS OCCURRED
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
Your CALL parameters must be DFHEIBLK DFHCOMMAREA WS-DATA.
Establishing addressability to WS-DATA will be 8-Off Register 1. This register will contain a 12-Byte parmlist address and the address for WS-DATA can be found as the last word.
It looks like you've Assembled the program as CICS/Assembler because you've used DFHEIENT.
Don't worry about the RSA as saving and restoring registers will be automatically performed by the program.
When returning to the Caller, use -
Code:
DFHEIRET RCREG=R15
Which will pass back the return code (R15) and is addressable in COBOL as the RETURN-CODE Special-Register.
Instead of a WTO (which is an MVS SVC 35) take a look at the CICS method of write to the operator via the "WRITE OPERATOR" API.
However, instead of this API, you can write a message to one of the external TDQ's, such as CSMT, CSSL, etc. Check with your CICS System Programmer as to which one to use.
One last recommendation, ensure that the sub-program is LINKED as AMODE 31/RMODE ANY, because if it's defaulting to AMODE 24/RMODE 24, you're going to get addressability errors, because normally, CICS COBOL programs are LINKED as AMODE 31/RMODE ANY. You do NOT need AC=1 in your Link Edit step. This is where the AMODE and RMODE need to be specified.
Also, the first source line needs to be -
Code:
*ASM XOPTS(SP,NOEPILOG)
Which allows System Programmer API's and suppresses the Program Epilogue, which is what you want to do when using DFHEIRET.
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
I realise you are new to this, so give this a try. Ensure when you call this sub-program you call it as -
Code:
CALL WS-PACASM01 USING DFHEIBLK DFHCOMMAREA WS-MSG
WS-MSG will contain a 12-Byte message and WS-PACASM01 will contain "PACASM01". As you can see, 8(,R1) is loaded into R7 and now you've addressed WS-MSG. You were loading R3 with 8(,R1) but the problem with that was R3 was designated as your program (CSECT) base-register.
Code:
*PROCESS RENT PROGRAM IS RE-ENTRANT
*ASM XOPTS(NOEPILOG,SP) SUPPRESS EPILOGUE, ALLOW SP
DFHEISTG DSECT DYNAMIC-STG (R13)
CSMTMSGL DS H CSMT MESSAGE-LGTH
CSMTMSGA DS CL80 CSMT MESSAGE-AREA
PACASM01 DFHEIENT CODEREG=R3,DATAREG=R13,EIBREG=R11
L R7,8(,R1) ADDRESS 3RD-PARM
NIHH R7,32767 CLEAR TOP-BIT
MVI CSMTMSGA,C' ' ENSURE SPACES
MVC CSMTMSGA+1(L'CSMTMSGA-1),CSMTMSGA
MVC CSMTMSGA(9),=CL9'PACASM01:'
MVC CSMTMSGA+10(12),0(R7) INSERT 12-BYTE MSG FROM CALLER
LHI R0,L'CSMTMSGA PREPARE FOR 'STH'
STH R0,CSMTMSGL STORE AS HWORD
*
EXEC CICS WRITEQ TD, WRITE TO THE 'CSMT' TDQ, X
QUEUE ('CSMT'), WHICH IS NORMALLY ROUTED TO X
FROM (CSMTMSGA), DD 'MSGUSR' IN THE GIVEN REGION X
LENGTH(CSMTMSGL), X
NOHANDLE,
*
L R15,EIBRESP LOAD THE RESPONSE-CODE
*
DFHEIRET RCREG=R15 RETURN TO CALLER
*
DFHREGS , CICS REGISTER-MACRO
*
PACASM01 AMODE 31 ,
PACASM01 RMODE ANY ,
*
END PACASM01
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
Why are you not using a LINK and just passing the WS-Data commarea instead of a call.
Code:
DFHREGS
EJECT
WSCLIMSG DFHEIENT CODEREG=(R11),EIBREG=(R12),DATAREG=(R13)
SPACE 1
PRINT NOGEN
SPACE 1
WSCLIMSG CSECT
WSCLIMSG AMODE 31
WSCLIMSG RMODE ANY
IMSGINIT EQU *
LA R2,IMSGSTRG ADDRESS OF IMSG STORAGE
LR R4,R2 ADDRESS OF IMSG STORAGE
L R3,=A(IMSGLGTH) LENGTH OF IMSG STORAGE
SR R5,R5 IMSG STORAGE LOW VALUE
MVCL R2,R4 CLEAR OUT IMSG STORAGE
SPACE 1
LH R5,EIBCALEN LOAD THE COMMAREA LENGTH
CH R5,=H'0' DO WE HAVE A COMMAREA ?
BE NCOMABND NO - GO ISSUE THE ABEND
CL R5,=A(COMALGTH) IS LENGTH WITHIN BOUNDS
BH ICOMABND NO - GO ISSUE THE ABEND
SPACE 1
L R9,DFHEICAP LOAD ADDRESS OF COMAREA
USING COMMAREA,R9 ESTABLISH ADDRESSABILITY
SPACE 1
SPACE 1
IMSGEXIT EQU *
L R15,RTRNCODE PASS BACK THE RETURN CODE
SPACE 1
DFHEIRET RCREG=(R15)
EJECT
LTORG
Bill....Assembler call works fine with the code which you gave.Thank you so much.You are a life saver I will code further and get back to you if any issues. Thanks again.
I am able to send/receive data from assembler when calling from CICS. Now am trying to access dataspace from assembler module. I am able to achieve this in Batch. But when i try from CICS, the CICS region goes down.
Note :
In batch, I created the dataspace and accessed through assembler.In CICS, I am trying to access the dataspace created in Batch through assembler.
CICS/Assembler to access dataspace :
*PROCESS RENT
*ASM XOPTS(SP,NOEPILOG)
DFHEISTG DSECT
CSMTMSGL DS H
CSMTMSGA DS CL80
DATAIN DS CL12' '
DATAOUT DS CL12' '
HCOUNT DS ZL8 03200000
HSTART DS ZL8 03200000
DSPCSTKN DS CL8 DATA SPACE STOKEN
DSPCORG DS F DATA SPACE ORIGIN RETURNED
DSPCALET DS F
PACASM01 AMODE 31 00010000
PACASM01 RMODE ANY 00010000
PACASM01 CSECT
PACASM01 DFHEIENT CODEREG=3,DATAREG=13,EIBREG=11
L 7,8(,1)
NIHH 7,32767
SAC 0 SWITCH INTO PRIMARY MODE
SYSSTATE ASCENV=P SET GLOBAL BIT FOR PRIMARY MODE
MVC DATAIN(4),0(7)
MVC DATAOUT(4),DATAIN
MVC 0(12,7),DATAOU1
MVC DSPCALET(4),DATAIN
SAC 512 SWITCH INTO AR MODE
SYSSTATE ASCENV=AR SET GLOBAL BIT FOR AR MODE
LAM 2,2,DSPCALET LOAD ALET OF SPACE INTO AR2
L 2,DSPCORG LOAD ORIGIN OF SPACE INTO GR2
USING DSPCMAP,2 INFORM ASSEMBLER
SAC 0 SWITCH INTO PRIMARY MODE
SYSSTATE ASCENV=P SET GLOBAL BIT FOR PRIMARY MODE
L 15,EIBRESP
DFHEIRET RCREG=15
DFHREGS ,
************************************************************
SAVEAREA DS 18F
DATAOU1 DC CL12'SURYA1234567'
WSALET DC XL4'01FF001B'
DSPCMAP DSECT
DSPWRD1 DS CL42 WORD 1
END PACASM01
I'm facing this problem either, but I don't acctually know why.
I use a static call to invoke a assembler program from a cobol program under cics, as you know, ASRA occurs.