MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CICS Error calling a common routine

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> CICS and Middleware
View previous topic :: View next topic  
Author Message
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Thu Jun 02, 2011 10:51 am    Post subject: CICS Error calling a common routine Reply with quote

Hi ,
I've a cics common routine PGM2 and I'm trying to use in PGM1 by using CICS link by passing the dealer num and I'm a program interruption error in PGM2.

Can someone help if I'm passing the right paramaters in PGM1?

Also,If someone can explain what TWA Addr, and set address statements do in PGM2 that would help me a lot.

Code:


PGM 2 -- GET DEALER NAME USING DEALER NUM
=========================================
LINKAGE SECTION.                                   
01  DFHCOMMAREA.                                   
    05 LS-CICS-PTR                USAGE IS POINTER.
    05 LS-CICS-BIN   REDEFINES    LS-CICS-PTR       
                                  PIC X(4).         
01  LS-CICS-DATA.                                   
    05 LS-LDA-PTR                 USAGE IS POINTER.
    05 LS-LDA-BIN    REDEFINES    LS-LDA-PTR       
                                  PIC S9(8)   COMP.
01  LS-TWA-AREA.                                         
    05 TWA.                                               
       10 LS-PARM-POINTER                USAGE IS POINTER.

01  LS-I-O-COMM-AREA.                         
    05 LS-I-DEALER-CODE             PIC X(05).
    05 LS-O-DEALER-NAME             PIC X(30).



***
1000-OPENING-ROUTINE.                                         
                                                             
    EXEC CICS HANDLE CONDITION                               
         ERROR( 1000-ADDRESS-ERROR )                         
    END-EXEC.                                                 
                                                             
    PERFORM 1001-GET-TWA-ADDR  THRU  1001-EXIT.               
                                                             
    SET ADDRESS OF LS-CICS-DATA   TO  LS-CICS-PTR.           
                                                             
    SET ADDRESS OF LS-I-O-COMM-AREA  TO  LS-LDA-PTR.     
                                                             
    MOVE LS-I-O-COMM-AREA    TO  WS-I-O-COMM-AREA.   
                                                             
    MOVE 0                       TO  WS-RET-CODE.             
                                                             
    GO TO 1000-EXIT.                                         
                                                             
1000-ADDRESS-ERROR.                                           
                                                             
    MOVE 99                       TO  WS-RET-CODE.           
                                                             
1000-EXIT.                                                   
    EXIT.                                                     
                                                             

1001-GET-TWA-ADDR.                                       
                                                         
    EXEC CICS ADDRESS                                     
         TWA (WS-TWA-POINTER)                             
    END-EXEC.                                             
                                                         
    SET ADDRESS OF LS-TWA-AREA       TO  WS-TWA-POINTER. 
                                                         
1001-EXIT.                                               
    EXIT.                                                 



Code:

PGM 1 TO CALL PGM2
==================
INITIALIZE               LS-I-O-COMM-AREA.   
MOVE '12345' TO LS-I-DEALER-CODE.   
                                                 
EXEC CICS LINK                                   
     PROGRAM  ('PGM2')                       
     COMMAREA (LS-I-O-COMM-AREA)           
END-EXEC.                                       
                 



Thanks,
Vijay
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Jun 02, 2011 11:05 am    Post subject: Reply with quote

vijay,

check this example for LINKing CICS programs

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Fri Jun 03, 2011 9:02 am    Post subject: CICS Error calling a common routine Reply with quote

Hi Kolusu,
I'm still not able to figure out the problem.

Here is the code I wrote to call module DLRC0115.As u see DLRC0115 returns the address register value.The layou will be 5859 bytes as in LS-O-RESPONSE.

I'm getting a protection exception in 2000-START where I'm moving dfhcommarea to ws-dlr-i-o-comm-area.

Code:


WORKING STORAGE
================

01  WS-DLR-I-O-COMM-AREA          PIC X(5867).

01  WS-CICS-DATA.                                   
    05 WS-CICS-PTR                 USAGE IS POINTER.
    05 WS-CICS-BIN    REDEFINES    WS-CICS-PTR       
                                  PIC S9(8)   COMP. 
   
01  DLRC0115-LINKAGE.                                 
    05 DLRC0115-MAIN-PTR             POINTER.         
    05 DLRC0115-MAIN-BIN  REDEFINES  DLRC0115-MAIN-PTR
                                     PIC  X(4).       
    05 DLRC0115-DATA-PTR             POINTER.         
    05 DLRC0115-DATA-BIN  REDEFINES  DLRC0115-DATA-PTR
                                     PIC S9(8)    COMP.
    05 DLRC0115-POSTAL-CODE          PIC  X(6).       

                                                 

LINKAGE SECTION.                             
================
01  DFHCOMMAREA.                             
    05 LS-I-DEALER-CD             PIC X(6).   
    05 LS-O-ADDRESS-CNT           PIC 9(2).   
    05 LS-O-RESPONSE              PIC X(5859).
                                             
    COPY TCPTWALS.                           



START OF THE PROGRAM
=====================

2000-START.
SET ADDRESS OF DFHCOMMAREA   TO  WS-CICS-PTR.         
MOVE DFHCOMMAREA             TO  WS-DLR-I-O-COMM-AREA.

2000-EXIT.
     EXIT.





 2200-LINK-DLRC0115.                                         
                                                             
     EXEC CICS HANDLE CONDITION                             
          ERROR(2200-LINK-ERROR)                             
     END-EXEC.                                               
                                                             
     COMPUTE DLRC0115-DATA-BIN  =  WS-CICS-BIN  +  8.       
     MOVE DLRC0105-MAIN-BIN        TO  DLRC0115-MAIN-BIN.   
     MOVE WS-DLR-I-DEALER-CODE     TO  DLRC0115-DEALER-CODE.
                                                             
     INITIALIZE WS-DLR-O-DLRC0115-RESPONSE.                 
 
                                                             
     EXEC CICS LINK                                         
          PROGRAM  ("DLRC0115")                             
          COMMAREA (DLRC0115-LINKAGE)                       
          LENGTH   (14)                                     
     END-EXEC.                                               
                                                             
     MOVE DFHCOMMAREA              TO  WS-DLR-I-O-COMM-AREA.
                                                             
     GO TO 2200-EXIT.                                       
                                                             
 2200-LINK-ERROR.                                           
                                                             
                       
     MOVE 99                       TO  WS-RET-CODE.         
                                                             
 2200-EXIT.                                                 
     EXIT.                                                   




Your help is appreciated.

Vijay
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Jun 03, 2011 10:35 am    Post subject: Reply with quote

i see that you never check the length of the dfhcommarea (eibcalen or something like that)
prior to trying to access the 'passed data'.

you are getting a protection exception because you are try to access 5867 bytes, some of which (maybe all) are protected from your code.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> CICS and Middleware All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group