IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

ASRA abend calling Assembler from CICS


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
surya8

New User


Joined: 02 Sep 2015
Posts: 6
Location: india

PostPosted: Thu Sep 10, 2015 7:50 pm
Reply with quote

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.

CICS program :


Code:
       LINKAGE SECTION.                                               
       01 DFHCOMMAREA PIC X(12).
     
       CALL 'PACASM01'  USING WS-DATA



Assembler program :

Code:
         PRINT NOGEN
PACASM01 CSECT
PACASM01 AMODE 31
PACASM01 RMODE ANY
PACASM01 CSECT
R0       EQU 0
R1       EQU 1
R2       EQU 2
R3       EQU 3
R4       EQU 4
R5       EQU 5
R6       EQU 6
R7       EQU 7
R8       EQU 8
R9       EQU 9
R10      EQU 10
R11      EQU 11

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

    EIBTIME      = 193555
    EIBDATE      = 0115253
    EIBTRNID     = 'PA02'
    EIBTASKN     = 222
    EIBTRMID     = '0037'

    EIBCPOSN     = 4
    EIBCALEN     = 0
    EIBAID       = X'7D'                                         AT X'001000EA'
    EIBFN        = X'1806'  SEND                                 AT X'001000EB'
    EIBRCODE     = X'000000000000'                               AT X'001000ED'
    EIBDS        = '........'
+   EIBREQID     = '........'
 OFFSET:X'0008B2'                        INTERRUPT: PROTECTION
 ABEND :   ASRA                          PSW: X'079D0000 8AEE04A6 00040004'


Compile jcl for Assembler :

Code:
//ASMLINK  EXEC DFHEITAL,LNKPARM='LIST,XREF,MAP,AC=1,RENT'
//TRN.SYSIN DD DSN=U454279.PROJ.CICS1(PACASM01),DISP=SHR
//LKED.SYSIN DD *
    NAME PACASM01(R)
    ORDER DFHEAI
    INCLUDE SYSLIB(DFHEAI)
/*


Code'd
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Thu Sep 10, 2015 8:31 pm
Reply with quote

I tihnk , "storage protect" is turned off.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Sep 10, 2015 9:10 pm
Reply with quote

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.

HTH....
Back to top
View user's profile Send private message
surya8

New User


Joined: 02 Sep 2015
Posts: 6
Location: india

PostPosted: Fri Sep 11, 2015 12:44 pm
Reply with quote

Thank you Bill.Will try and let you know.
Back to top
View user's profile Send private message
surya8

New User


Joined: 02 Sep 2015
Posts: 6
Location: india

PostPosted: Fri Sep 11, 2015 4:53 pm
Reply with quote

I tried below assembler code with AMODE 31 and RMODE ANY. Still getting ASRA abend. It is getting abended while returning.


*ASM XOPTS(SP,NOEPILOG)
PRINT NOGEN
PACASM01 CSECT
PACASM01 AMODE 31
PACASM01 RMODE ANY
PACASM01 CSECT
L 3,8(1)
WTO 'TEST1',ROUTCDE=11
L 13,SAVEAREA+4
LM 14,12,12(13)
WTO 'TEST2',ROUTCDE=11
SR 15,15
DFHEIRET RCREG=15

************************************************************
SAVEAREA DS 18F
************************************************************
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Sep 11, 2015 8:01 pm
Reply with quote

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. icon_eek.gif
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                                                   

HTH....
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Fri Sep 11, 2015 8:29 pm
Reply with quote

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
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Sep 11, 2015 9:05 pm
Reply with quote

Hi Mickey,

The original post indicated the OP wanted to use a CALL. As far as using a LINK-API instead, your guess is as good as mine. icon_confused.gif

Regards,
Back to top
View user's profile Send private message
surya8

New User


Joined: 02 Sep 2015
Posts: 6
Location: india

PostPosted: Tue Sep 15, 2015 3:53 pm
Reply with quote

Bill....Assembler call works fine with the code which you gave.Thank you so much.You are a life saver icon_biggrin.gif I will code further and get back to you if any issues. Thanks again.
Back to top
View user's profile Send private message
surya8

New User


Joined: 02 Sep 2015
Posts: 6
Location: india

PostPosted: Tue Sep 15, 2015 3:54 pm
Reply with quote

Mickeydusaor..Thanks for your code.I will use it if i want to link the program instead of a call.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Sep 15, 2015 5:14 pm
Reply with quote

Glad to be able to help with the CALL solution. Mickey's LINK-API solution should also be tucked away for a rainy day. icon_wink.gif

With both solutions, you now have templates with which you can build on.

Regards,
Back to top
View user's profile Send private message
surya8

New User


Joined: 02 Sep 2015
Posts: 6
Location: india

PostPosted: Tue Sep 22, 2015 4:01 pm
Reply with quote

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

WTO 'DSACCESS'

MVC HSTART(8),0(2) HASH START
MVC HCOUNT(8),8(2) HASH COUNT

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
Back to top
View user's profile Send private message
Sam White

New User


Joined: 18 Mar 2016
Posts: 1
Location: China

PostPosted: Sun Mar 20, 2016 6:46 am
Reply with quote

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.

Thank you.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Mon Mar 21, 2016 6:31 pm
Reply with quote

Quote:
I'm facing this problem

so it is your problem so start your own topic - do not use someone elses.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts ABEND 0717 during starting IMS IMS DB/DC 0
No new posts MacKinney Batch to CICS upgrade causi... CICS 7
No new posts Associating a USERID with a CICS-Libe... CICS 0
No new posts omegamon for cics -UNSUPPORTED ENVIRO... CICS 2
No new posts Help needed in automation cics transa... CLIST & REXX 1
Search our Forums:

Back to Top