Call REXX EXEC using COBOL.

Time Sharing Option, Interactive System Productivity Facility and REstructured eXtended eXecutor

Moderator: mickeydusaor

Post Reply
Jeetan Ram
New Member
Posts: 7
Joined: Sun Sep 13, 2015 9:33 am

Call REXX EXEC using COBOL.

Post by Jeetan Ram »

Hi,

I'm trying to call a REXX EXEC using COBOL program. For that, what kind of code is required in a COBOL to call a REXX EXEC? I want to pass one data item to REXX and two different data items should bereturned to the COBOL program. What code will be required in REXX exec to handle the situation said.

Thanks,
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: Call REXX EXEC using COBOL.

Post by enrico-sorichetti »

a simple google search with "rexx cobol interlanguage communication"
would have taken You here
http://publib.boulder.ibm.com/infocente ... 605303.htm

which is the equivalent of You would have got here

http://publibz.boulder.ibm.com/cgi-bin/ ... es/EAUGB10

the examples from the manuals work even if the rexx compiler is not installed
a visual inspection confirmed that the FAN stuff is not used
and I just tested it both the cobol samples
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
Jeetan Ram
New Member
Posts: 7
Joined: Sun Sep 13, 2015 9:33 am

Re: Call REXX EXEC using COBOL.

Post by Jeetan Ram »

This example is helpfule, Thanks!

Code: Select all

//* -->uidIEC JOB - Specify your Job card here
     //*-----------------------------------------------------------*
     //*
     //*    Interlanguage Communication in z/OS
     //*       Calling REXX from COBOL
     //*
     //*-----------------------------------------------------------*
     //*
     //*  Licensed Materials - Property of IBM
     //*  5695-013
     //*  (C) Copyright IBM Corp. 1989, 2003
     //*
     //*-----------------------------------------------------------*
     //* Sample JCL for calling IRXJCL from COBOL program.
     //* For a description also refer to the REXX Compiler guide
     //* SH19-8160.
     //* You may modify this sample for your needs by including
     //* a REXX of your own. The argument for the REXX procedure
     //* may be taylored for your needs.
     //*
     //* Change Activity: 030708 - new for Release 4
     //*-----------------------------------------------------------*
     //* JCLLIB accesses the CLG procs, modify to your needs
     //*-----------------------------------------------------------*
     //*MYLIB   JCLLIB ORDER=RXT.INTLANG.CNTL
     //*-----------------------------------------------------------*
     //* Create REXX procedure HELLO into a temporary Library &&REXX
     //* SYSUT1 is setup for card input, modify to a DSN if desired.
     //*-----------------------------------------------------------*
     //CREATE  EXEC PGM=IEBGENER
     //SYSPRINT DD SYSOUT=*
     //SYSIN    DD DUMMY
     //SYSUT2   DD DSN=&&REXX(HELLO),DISP=(NEW,PASS),
     //            UNIT=SYSDA,SPACE=(TRK,(1,1,1)),
     //            DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)
     //SYSUT1   DD *,DLM=$$
     /* REXX - A simple exec ****************** Start sample exec */
     Parse source src                              /* sample exec */
     Arg n                                         /* sample exec */
       Say 'I am' src                              /* sample exec */
       Say 'Received parm:' n                      /* sample exec */
       If n='' Then n=1                            /* sample exec */
       Do i=1 TO n                                 /* sample exec */
         Say 'Hello World the' i'. time ...'       /* sample exec */
       End                                         /* sample exec */
     Return n           /* Set Return Code to n */ /* sample exec */
     /******************************************* End sample exec */
     $$
     //*-----------------------------------------------------------*
     //*  Compile, link and execute a COBOL program
     //*-----------------------------------------------------------*
     //* Invoke the cataloged procedure IGYWCLG to compile, link and
     //* execute the below listed Cobol program.
     //* The Cobol program below calls the above listed REXX sample
     //* exec as stored in the temporary dataset using the
     //* TSO service IRXJCL.
     //*-----------------------------------------------------------*
     //IGYWCLG  EXEC IGYWCLG
     //COBOL.SYSIN DD *
     CBL NOADV,NODYN,NONAME,NONUMBER,QUOTE,SEQ,XREF,VBREF,DUMP,LIST
            TITLE "COBOL TEST PROGRAM  ".
            Identification Division.
            Program-id.    COBPRG.
     IA0040 Author.    ...
           ***                                                            **
           ***  Invoke REXX procedure HELLO with parameter 3 using IRXJCL **
           ***                                                            **
           ***  Expected display messages:                                **
           ***    "PROGRAM CONPRG   - BEGINNING"                          **
           ***    "PROGRAM COBPRG   - NORMAL END"                         **
           ***                                                            **
           *****************************************************************
            Environment division.
     IA0970 Configuration section.
              Special-names.
            Input-output section.
              File-control.
                Select PRINT-FILE
                    assign to SYS014-S-UPDPRNT
                    file status is UPDPRINT-FILE-STATUS.
            Data division.
            File section.
     IA1570 FD  PRINT-FILE
                recording mode F
                block 0 records
                record 121 characters
                label record standard.
     IA1620   01 print-record                   pic x(121).
            Working-storage section.
              01 Working-storage-for-COBPRG     pic x.
              01 ARGUMENT.
                 03 ARG-SIZE                    pic 9(2) comp.
                 03 ARG-CHAR                    pic x(8).
              77 UPDPRINT-file-status           pic xx.
              77 PGM-NAME                       pic x(8).
           /****************************************************************
           ***                 D O   M A I N   L O G I C                  **
           *****************************************************************
            procedure division.
              000-do-main-logic.
                display "PROGRAM COBPRG   - Beginning".
                display "Return code before call is " RETURN-CODE.
           *
           *    Pass the procedure pame HELLO to IRXJCL.
           *    Pass 3 to REXX procedure 'HELLO'.
           *    Set the size of the argument.
           *
                move "HELLO  3" to ARG-CHAR.
                move 8 to arg-size.
           *    Call "IRXJCL" in order to execute the REXX procedure
                move "IRXJCL" to PGM-NAME.
                CALL PGM-NAME     USING ARGUMENT.
           *    Display the return code.
                display "Return code after  call is " RETURN-CODE.
                display "PROGRAM COBPRG   - Normal end".
                stop run.
     IA9990 end program COBPRG.
     /*
     //*-----------------------------------------------------------*
     //* Define the library containing the REXX exec
     //*-----------------------------------------------------------*
     //GO.SYSEXEC DD DISP=(SHR,PASS),DSN=&&REXX
     //*-----------------------------------------------------------*
     //* Next DD is the data set equivalent to terminal input
     //*-----------------------------------------------------------*
     //GO.SYSTSIN  DD    DUMMY
     //*-----------------------------------------------------------*
     //* Next DD is the data set equivalent to terminal output
     //*-----------------------------------------------------------*
     //GO.SYSTSPRT DD    SYSOUT=*
     //GO.SYSOUT   DD    SYSOUT=*
     //*-----------------------------------------------------------*
//
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: Call REXX EXEC using COBOL.

Post by enrico-sorichetti »

it works, but this solution is better
http://www-01.ibm.com/support/knowledge ... 605304.htm

posting just one link was a way to test Your attitude :mrgreen:

and the
and I just tested it both the cobol samples
should have hinted that there could more

but You just did not care to research further,
...in the index column on the left side of the displayed page
it was clear also from that, that there was one more way of doing it

Your career in IT will be very short if You do not learn that any advice You get is
ONLY A STARTING POINT
and You will have to do more reading and researching on Your own
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “TSO, ISPF & REXX (Do you still do CLIST?!).”