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

Calling Rexx program from Cobol


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 14
Location: India

PostPosted: Thu Oct 29, 2020 6:00 pm
Reply with quote

Hi All,

I have a requirement where i need to call the REXX Program from Cobol and need to pass some parameters to Rexx. I am new to REXX so not sure how to call rexx program from Cobol and how to execute using JCL. I searched forums but not getting the simillar sample program. Can anybody provide sample cobol program which inturn call the REXX program with parameters and also JCL to execute the cobol programs.

Thanks in advance for your great help.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Thu Oct 29, 2020 6:40 pm
Reply with quote

The issue with calling COBOL from JCL has absolutely nothing to do with calling REXX from COBOL.

1) try to understand the difference
2) try to RTFM
3) try not mixing different environments for no reason, and unless you clearly understand the mechanism of their interaction
4) try to do ANY of your own attempts to do your job, and demonstrate it here
Back to top
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 14
Location: India

PostPosted: Thu Oct 29, 2020 6:56 pm
Reply with quote

Thanks for your reply. But my requirement is REXX module are already there which are currently executed manually based on request. We are trying to automate now. We are adding new DB2 table which will have request details and different rexx module will be executed based on the request type. So we are adding cobol program which will read this DB2 table and identifies the request type and accordingly call different rexx modules to process these requests.

Hope this clarifies.

Thanks in advance.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Oct 29, 2020 7:00 pm
Reply with quote

Try using you favorite search engine and search for: cobol calling rexx

There are several examples, including some from this forum.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Thu Oct 29, 2020 7:05 pm
Reply with quote

Code:
WORKING-STORAGE SECTION.
01  CALL-REXX          PIC X(6) VALUE "IRXJCL" .
01  CALL-PARM.
    05  PARM-LEN         PIC S9(4) BINARY VALUE 8.
    05  PARM-VALUE      PIC X(8)  VALUE "REXPROG1'.
PROCEDURE DIVISION.
    CALL CALL-REXX USING CALL-PARM.
    STOP RUN.
In a JCL use SYSEXEC propery.
Back to top
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 14
Location: India

PostPosted: Thu Oct 29, 2020 7:20 pm
Reply with quote

Thank you rohit. i tried this but its not calling REXX program and i am getting abend (***BAD RC*** FROM REXX=20048 ) and also we need to pass parameters to the rexx program.

Can you please provide me sample JCL and sample program which is running fine.

Thanks in Advance.
Back to top
View user's profile Send private message
Srinivas B

New User


Joined: 05 Sep 2020
Posts: 14
Location: India

PostPosted: Thu Oct 29, 2020 7:34 pm
Reply with quote

Sorry Rohit..my Bad. Now i have changed the code as sugessted by you.

But still i am getting RC-20 from while calling REXX.

Code:
    05 WS-IRXJCL                     PIC X(8) VALUE 'IRXJCL'.
                                                                 
     01 ARGUMENT.                                                 
         03 ARG-LENGTH                 pic S9(4) BINARY VALUE 8. 
         03 ARG-CHAR                   pic x(6).                 


MOVE 'REXXADD' TO ARG-CHAR                       
                                                 
CALL WS-IRXJCL   USING ARGUMENT                 
IF  RETURN-CODE NOT = 0                         
    DISPLAY '***BAD RC*** FROM REXX=' RETURN-CODE
ELSE                                             
    DISPLAY 'REXX CALL SUCESSFULL:' RETURN-CODE 
END-IF                                           

*****************************
***BAD RC*** FROM REXX=00020



Can anybody help on this..
Cod'ed
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Fri Oct 30, 2020 12:45 am
Reply with quote

Srinivas B wrote:
Thank you rohit. i tried this but its not calling REXX program and i am getting abend (***BAD RC*** FROM REXX=20048 ) and also we need to pass parameters to the rexx program.

Can you please provide me sample JCL and sample program which is running fine.

Thanks in Advance.

Mostly your JCL don't have those libs that required for REXX but You will also need to look up manuals and existing jobs that do type of calls this at your site.
Please make a use of code tags as and when needed.

www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.rexa100/h1981605303.htm
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Fri Oct 30, 2020 3:10 am
Reply with quote

Why mix COBOL and Rexx? You can easily write a program in Rexx to do what your COBOL code is meant to do.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Fri Oct 30, 2020 1:27 pm
Reply with quote

Agree . But based on the TS knowledge it seems he don’t know REXX ( which is fine ) and hence writing a cobol module as a wrapper to call various REXX modules based on the values in the Db2 table ( Which is fine too ). Either should work.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Fri Oct 30, 2020 5:36 pm
Reply with quote

Rohit Umarjikar wrote:
Agree . But based on the TS knowledge it seems he don’t know REXX ( which is fine ) and hence writing a cobol module as a wrapper to call various REXX modules based on the values in the Db2 table ( Which is fine too ). Either should work.

The person who claimed he can write the “wrapper” in COBOL must be able to do the same in REXX, from the first attempt. Otherwise I have to doubt if he really knows programming (in any language).

Reading a little bit about REXX would cost much less compared to all headaches when mixing REXX with COBOL...
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Fri Oct 30, 2020 7:25 pm
Reply with quote

I hope so. He got the info what is needed to get going.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Sat Oct 31, 2020 7:28 am
Reply with quote

IRXEXCOM can be used to communicate between COBOL and Rexx.
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top