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

Calling a PL/I Program from COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Apr 02, 2013 11:05 am
Reply with quote

Hi,

I'm trying to call a PL/I program from COBOL Program, but encountering an unusual Return Code (2720), though output is coming fine. Can you please suggest what could be the possible reason and how can I resolve it.

Here is my code:


Calling Program (COBOL)

Code:

       WORKING-STORAGE SECTION.                                       
      *                                                               
       01 POLICY-PTR                    USAGE IS POINTER.             
      * THIS SEGMENT IS USED BY TSUXXX WHEN CONVERTING A               
      * POLICY NO FROM FILE FORMAT TO DISPLAY FORMAT                   
       01 POLICY-FORMAT.                                               
           03 WS-POLICY1               PIC X(11) VALUE SPACES.       
           03 WS-POLICY2               PIC X(13) VALUE SPACES.       
           03 WS-STATUS                PIC X(02) VALUE SPACES.       
      *                                                               
       PROCEDURE DIVISION.                                             
      *                                                               
      *    MAINLINE                                                   
      *                                                               
      *======================                                           
       000-MAINLINE SECTION.                                           
      *======================                                           
      *                                                                 
           MOVE '001234567 8'       TO WS-POLICY1   OF POLICY-FORMAT         
      *                                                                 
           SET  POLICY-PTR          TO ADDRESS      OF POLICY-FORMAT         
      *                                                                 
           CALL 'TSUXXX'    USING POLICY-PTR                           
      *                                                                 
           IF WS-STATUS  OF POLICY-FORMAT NOT EQUAL SPACES                 
              DISPLAY 'BAD STATUS FROM TSUXXX:'                         
                                         WS-STATUS  OF POLICY-FORMAT         
           ELSE                                                         
              DISPLAY 'FORMATTED POLICY NO IS:'                         
                                         WS-POLICY2 OF POLICY-FORMAT         
           END-IF.                                                     
      *                                                                 
       000-EXIT.                                                       
           STOP RUN.                                                   
      *                                                                 
      *    END OF MAINLINE                                             
      *                                                               



Called Program (PL/I)



Code:


   /*  TSUXXX  -  FORMAT POLICY NUMBER.      */
 TSUXXX:                                                               
         PROC (POLICY_PTR) OPTIONS (REENTRANT) REORDER ;               

   DCL 1 POLICY_FORMAT          BASED (POLICY_PTR),                           
       7  WS_POLICY_1       CHAR(11)
      ,7  WS_POLICY_2       CHAR(13) 
      ,7  WS_TATUS          CHAR(02)   ;


Edited to add JES Messages:
Code:

JESYSMSG:
IEF142I AAAAA001 STEP01 - STEP WAS EXECUTED - COND CODE 2720

SYSOUT:
FORMATTED POLICY NO IS:1234,567/8



~Neeraj
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Apr 02, 2013 11:53 am
Reply with quote

Code:

01  RETURN-CODE GLOBAL PICTURE S9(4) USAGE BINARY VALUE ZERO.     


STOP RUN.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Apr 02, 2013 1:31 pm
Reply with quote

Thanks Peter..I have changed it as below and it's working fine now:

Code:

IF WS-STATUS  OF POLICY-FORMAT NOT EQUAL SPACES         
   DISPLAY 'BAD STATUS FROM TSUXXX:'                     
                              WS-STATUS  OF POLICY-FORMAT
   MOVE 100           TO RETURN-CODE                     
ELSE                                                     
   DISPLAY 'FORMATTED POLICY NO IS:'                     
                              WS-POLICY2 OF POLICY-FORMAT
   MOVE 00            TO RETURN-CODE                     
END-IF.                                                 
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Apr 02, 2013 1:34 pm
Reply with quote

You are welcome.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 02, 2013 1:45 pm
Reply with quote

RETURN-CODE is a "Cobol special register". After a CALL the contents of Register 15 will be stored in it, and when the current program returns to where it came from, the RETURN-CODE will become the final value of Register 15 when it arrives at z/OS.

So, since you do nothing to RETURN-CODE in your Cobol program, I guess the value is coming from the PL/I.

Have you looked here?

What you have now done is ignore the value coming back from the PL/I program, which may be indicating something you need to know about.

When you display "bad" messages, it is really useful to have some type of "key" or reference to be able to identify the input with the problem.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 02, 2013 1:46 pm
Reply with quote

Peter,

RETURN-CODE is a Cobol "Special Register". It is defined by the Compiler, not the programmer.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Apr 02, 2013 1:59 pm
Reply with quote

Hi Bill,

I have changed the PL/I Module as below and it's working fine with the previous COBOL Code.
Code:

   /*  TSUXXX  -  FORMAT POLICY NUMBER.      */
 TSUXXX:                                                               
         PROC (POLICY_PTR) OPTIONS (REENTRANT,COBOL) REORDER ;               
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Apr 02, 2013 3:10 pm
Reply with quote

Thanks for letting us know.
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Apr 02, 2013 3:53 pm
Reply with quote

Thanks Bill and Peter..for helping me out :-)
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 Apr 02, 2013 7:27 pm
Reply with quote

FWIW, the PL/I equivalent to RETURN-CODE is PLIRETC.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top