Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 
Calling a PL/I Program from COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
mistah kurtz

Active User


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

PostPosted: Tue Apr 02, 2013 11:05 am    Post subject: Calling a PL/I Program from COBOL
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: 2437
Location: Netherlands, Amstelveen

PostPosted: Tue Apr 02, 2013 11:53 am    Post subject: Reply to: Calling a PL/I Program from COBOL
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: 287
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Apr 02, 2013 1:31 pm    Post subject:
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: 2437
Location: Netherlands, Amstelveen

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

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Apr 02, 2013 1:45 pm    Post subject: Reply to: Calling a PL/I Program from COBOL
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Apr 02, 2013 1:46 pm    Post subject: Reply to: Calling a PL/I Program from COBOL
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: 287
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Apr 02, 2013 1:59 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Apr 02, 2013 3:10 pm    Post subject: Reply to: Calling a PL/I Program from COBOL
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: 287
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Tue Apr 02, 2013 3:53 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 02, 2013 7:27 pm    Post subject: Reply to: Calling a PL/I Program from COBOL
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts Calling CLIST through job and REXX Sahasra K CLIST & REXX 19 Tue Aug 01, 2017 10:25 am
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us