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
 

 

Rexx calling cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Mon Nov 08, 2010 8:36 pm    Post subject: Rexx calling cobol
Reply with quote

I see plenty of articles for Cobol programs calling Rexx programs, but little for the opposite. I am writing a cobol program to read a vsam file, read a certain amount of records, write each record to a DD then return to the rexx program that does an ISPF browse or edit on the DD. Here is what I have:

Rexx
Code:
READ_SYSTEM_BASE:
  SYSTBASE  = VSAMHLQ'.'SYSENV'.'SYSNAME'.DATA'
  PROXY_DSN = USERID()'.'SYSENV'.'SYSNAME'.'ELETYPE'.'ELENAME

  "ALLOC FI(SYSTBASE) DATASET('"SYSTBASE"') SHR"
  "ALLOC FI(PRXYDSN) DATASET('"PROXY_DSN"') SHR"

  KEY = SUBSTR(ELENAME,01,08)||SUBSTR(ELETYPE,01,08)||,
        RIGHT('00'ELEVERS,2)'000001'

  SAY KEY
  CALL PRXYC004 KEY

  ADDRESS ISPEXEC
  'LMINIT DATAID(PRXYDSN) DDNAME(PRXYDSN)'
  'BROWSE DATAID('PRXYDSN')'
  'LMFREE DATAID('PRXYDSN')'
   
  FREE "FI(SYSTBASE)"
  FREE "FI(PRXYDSN)"
RETURN


Cobol
Code:
       FILE-CONTROL.

           SELECT VSAM-FILE    ASSIGN TO SYSTBASE
               ORGANIZATION IS INDEXED
               ACCESS MODE IS DYNAMIC
               RECORD KEY IS VSAM-KEY
               FILE STATUS IS WS-VSAM-STATUS.
           SELECT OUTPUT-FILE  ASSIGN TO PRXYDSN.

       DATA DIVISION.

       FILE SECTION.

       FD  VSAM-FILE
           DATA RECORD IS VSAM-REC.

       01  VSAM-REC.
           05  VSAM-KEY.
               10  VSAM-NON-SEQ-KEY.
                   15  VSAM-ELEMENT-NAME    PIC  X(08).
                   15  VSAM-ELEMENT-NAME    PIC  X(08).
                   15  VSAM-ELEMENT-TYPE    PIC  X(08).
                   15  VSAM-ELEMENT-VERS    PIC  9(02).
               10  VSAM-SEQUENCE-NUM        PIC  9(06).
           05  VSAM-DATA                    PIC  X(72).

       FD  OUTPUT-FILE
           RECORDING MODE IS F
           LABEL RECORDS ARE STANDARD
           BLOCK CONTAINS 0 RECORDS
           DATA RECORD IS OUTPUT-REC.

       01  OUTPUT-REC                       PIC  X(80).

       WORKING-STORAGE SECTION.

       01  WS-VARIABLES.
           05  WS-VSAM-STATUS               PIC X(02) VALUE '00'.

       LINKAGE SECTION.

       01  PARM-LIST-DATA                   PIC X(80).

       01  PARM-KEY.
           05  NON-SEQ-KEY.
               10  KEY-ELEMENT-NAME         PIC  X(08).
               10  KEY-ELEMENT-TYPE         PIC  X(08).
               10  KEY-ELEMENT-VERS         PIC  9(02).
           05  KEY-SEQUENCE-NUM             PIC  9(06).

       PROCEDURE DIVISION USING PARM-KEY.

      *****************************************************************
      *
      *****************************************************************
       XXXX-MAIN-SECTION.

           OPEN INPUT  VSAM-FILE
           OPEN OUTPUT OUTPUT-FILE

           IF WS-VSAM-STATUS = '00'
              CONTINUE
           ELSE
              DISPLAY WS-VSAM-STATUS
              GO TO XXXX-MAIN-SECTION-EXIT
           END-IF

           DISPLAY PARM-KEY
           MOVE PARM-KEY TO VSAM-KEY

      * READ VSAM WITH KEY

           PERFORM XXXX-READ-VSAM-KEY

           IF WS-VSAM-STATUS = '00'
              CONTINUE
           ELSE
              DISPLAY WS-VSAM-STATUS
              GO TO XXXX-MAIN-SECTION-EXIT
           END-IF

      * READ VSAM SEQUENTIALLY

           PERFORM XXXX-READ-VSAM-NEXT
              UNTIL VSAM-NON-SEQ-KEY > NON-SEQ-KEY

      * CLOSE FILES

           CLOSE VSAM-FILE
           CLOSE OUTPUT-FILE.

       XXXX-MAIN-SECTION-EXIT.

           WRITE OUTPUT-REC FROM PARM-KEY

           GOBACK

           EXIT.


      *****************************************************************
      * XXXX-READ-VSAM-KEY
      *****************************************************************
       XXXX-READ-VSAM-KEY.

           READ VSAM-FILE

           EXIT.

       XXXX-READ-VSAM-KEY-EXIT.

           EXIT.

      *****************************************************************
      * XXXX-READ-VSAM-NEXT
      *****************************************************************
       XXXX-READ-VSAM-NEXT.
           PERFORM XXXX-WRITE-OUTPUT-REC

           READ VSAM-FILE NEXT

           EXIT.

       XXXX-READ-VSAM-NEXT-EXIT.

           EXIT.

      *****************************************************************
      * XXXX-WRITE-OUTPUT-REC
      *****************************************************************
       XXXX-WRITE-OUTPUT-REC.

           WRITE OUTPUT-REC FROM VSAM-REC

           EXIT.

       XXXX-WRITE-OUTPUT-REC-EXIT.

           EXIT.


Display Output
Code:
TS00P100COBOL   09000001
 :   :::         ::H
23


Dataset Ouput with hex on
Code:
 ------------------------------------------------------------------------------
...................H....
0000003E000000000FDC000044444444444444444444444444444444444444444444444444444444
0A000101000000000DA8000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------


Do I need to chain off one of these addresses to get my parameter string?
Back to top
View user's profile Send private message

Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2033
Location: Silicon Valley

PostPosted: Tue Nov 09, 2010 8:37 pm    Post subject: Reply to: Rexx calling cobol
Reply with quote

There is:
Code:
Call my_sub

and
Code:
Address TSO "CALL 'my.load(myprog)"


The linkage is different. (you have to code your program differently) Search the TSO Programming manual for the CPPL. (or maclib for IKJCPPL)

For TSO CALL, the target program can be a regular batch-style program.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Nov 09, 2010 8:48 pm    Post subject: Reply to: Rexx calling cobol
Reply with quote

I was going to question the LINKAGE SECTION details. Don't you have to specify the parameter length as a PIC S9(4) COMP SYNC?
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Tue Nov 09, 2010 10:58 pm    Post subject:
Reply with quote

I did some more research and read that I need reference my linkage to macro IRXEFPL. This is what is passed in R1, and the fifth address in the linkage is the address to the argument array, IRXARGTB, passed from the Rexx program. So here is what I have:


Code:
       FILE-CONTROL.

           SELECT VSAM-FILE    ASSIGN TO SYSTBASE
               ORGANIZATION IS INDEXED
               ACCESS MODE IS DYNAMIC
               RECORD KEY IS VSAM-KEY
               FILE STATUS IS WS-VSAM-STATUS.
           SELECT OUTPUT-FILE  ASSIGN TO PRXYDSN.

       DATA DIVISION.

       FILE SECTION.

       FD  VSAM-FILE
           DATA RECORD IS VSAM-REC.

       01  VSAM-REC.
           05  VSAM-KEY.
               10  VSAM-NON-SEQ-KEY.
                   15  VSAM-ELEMENT-NAME    PIC  X(08).
                   15  VSAM-ELEMENT-TYPE    PIC  X(08).
                   15  VSAM-ELEMENT-VERS    PIC  9(02).
               10  VSAM-SEQUENCE-NUM        PIC  9(06).
           05  VSAM-DATA                    PIC  X(72).

       FD  OUTPUT-FILE
           RECORDING MODE IS F
           LABEL RECORDS ARE STANDARD
           BLOCK CONTAINS 0 RECORDS
           DATA RECORD IS OUTPUT-REC.

       01  OUTPUT-REC                       PIC  X(80).

       WORKING-STORAGE SECTION.

       01  WS-VARIABLES.
           05  WS-VSAM-STATUS               PIC X(02) VALUE '00'.
           05  WS-ADDRESS                   USAGE IS POINTER.
           05  WS-ADDRESS-NUMERIC REDEFINES WS-ADDRESS.
               10  WS-ADDRESS-NUM           PIC S9(08) COMP.

       LINKAGE SECTION.

       01  IRXEFPL.
           05  FILLER                      PIC  X(04).
           05  FILLER                      PIC  X(04).
           05  FILLER                      PIC  X(04).
           05  FILLER                      PIC  X(04).
           05  EFPL-ARG-TABLE              USAGE IS POINTER.
           05  EFPL-EVAL-BLOCK             USAGE IS POINTER.

       01  IRXARGTB.
           05  ARG-TBL-ADDR                USAGE IS POINTER.
           05  ARG-TBL-LENGTH              PIC S9(08) COMP SYNC.

       01  PARM-LIST-DATA                   PIC X(80).

       01  PARM-KEY.
           05  NON-SEQ-KEY.
               10  KEY-ELEMENT-NAME         PIC  X(08).
               10  KEY-ELEMENT-TYPE         PIC  X(08).
               10  KEY-ELEMENT-VERS         PIC  9(02).
           05  KEY-SEQUENCE-NUM             PIC  9(06).

       PROCEDURE DIVISION USING IRXEFPL.

      *****************************************************************
      *
      *****************************************************************
       XXXX-MAIN-SECTION.

           OPEN INPUT  VSAM-FILE
           OPEN OUTPUT OUTPUT-FILE

           IF WS-VSAM-STATUS = '00'
              CONTINUE
           ELSE
              DISPLAY WS-VSAM-STATUS
              GO TO XXXX-MAIN-SECTION-EXIT
           END-IF

           WRITE OUTPUT-REC FROM IRXEFPL
           SET ADDRESS OF IRXARGTB    TO EFPL-ARG-TABLE
           SET            WS-ADDRESS  TO EFPL-ARG-TABLE

           SET ADDRESS OF IRXARGTB    TO WS-ADDRESS
           WRITE OUTPUT-REC FROM IRXARGTB
           SET ADDRESS OF PARM-LIST-DATA TO WS-ADDRESS
           WRITE OUTPUT-REC FROM PARM-LIST-DATA
           SET ADDRESS OF PARM-KEY    TO ARG-TBL-ADDR
           WRITE OUTPUT-REC FROM PARM-KEY

           ADD 8 TO WS-ADDRESS-NUM
           SET ADDRESS OF IRXARGTB    TO WS-ADDRESS
           WRITE OUTPUT-REC FROM IRXARGTB
           SET ADDRESS OF PARM-KEY    TO ARG-TBL-ADDR
           WRITE OUTPUT-REC FROM PARM-KEY

           ADD 8 TO WS-ADDRESS-NUM
           SET ADDRESS OF IRXARGTB    TO WS-ADDRESS
           WRITE OUTPUT-REC FROM IRXARGTB
           SET ADDRESS OF PARM-KEY    TO ARG-TBL-ADDR
           WRITE OUTPUT-REC FROM PARM-KEY

           MOVE PARM-KEY TO VSAM-KEY

      * READ VSAM WITH KEY

           PERFORM XXXX-READ-VSAM-KEY

           IF WS-VSAM-STATUS = '00'
              CONTINUE
           ELSE
              DISPLAY WS-VSAM-STATUS
              GO TO XXXX-MAIN-SECTION-EXIT
           END-IF

      * READ VSAM SEQUENTIALLY

           PERFORM XXXX-READ-VSAM-NEXT
              UNTIL VSAM-NON-SEQ-KEY > NON-SEQ-KEY

      * CLOSE FILES

           CLOSE VSAM-FILE
           CLOSE OUTPUT-FILE.

       XXXX-MAIN-SECTION-EXIT.

           MOVE 00 TO RETURN-CODE

           WRITE OUTPUT-REC FROM PARM-KEY

           GOBACK

           EXIT.

      *****************************************************************
      * XXXX-READ-VSAM-KEY
      *****************************************************************
       XXXX-READ-VSAM-KEY.

           READ VSAM-FILE

           EXIT.

       XXXX-READ-VSAM-KEY-EXIT.

           EXIT.

      *****************************************************************
      * XXXX-READ-VSAM-NEXT
      *****************************************************************
       XXXX-READ-VSAM-NEXT.

           PERFORM XXXX-WRITE-OUTPUT-REC

           READ VSAM-FILE NEXT

           EXIT.

       XXXX-READ-VSAM-NEXT-EXIT.

           EXIT.
      *****************************************************************
      * XXXX-WRITE-OUTPUT-REC
      *****************************************************************
       XXXX-WRITE-OUTPUT-REC.

           WRITE OUTPUT-REC FROM VSAM-REC

           EXIT.

       XXXX-WRITE-OUTPUT-REC-EXIT.

           EXIT.


Output
Code:
 ------------------------------------------------------------------------------
...................H....
0000003E000000000FDC000044444444444444444444444444444444444444444444444444444444
0A000101000000000DA8000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
........
00010F0B444444444444444444444444444444444444444444444444444444444444444444444444
00280FEC000000000000000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
..............\...........¢...j....%...Ha..h...-......c.......\Q....... ...S....
00010F0B0F190FEB00000F870F410F960F86093C83680F2603E60F8701330FED0E900F940F0E0000
00280FEC0E3C0D0000000F000FAE0E160EFC1B9812280F002FF80E38101F0D080D000FE00FE20000
 ------------------------------------------------------------------------------
.¦...¦....r..Y..........
061906190F900E900000000044444444444444444444444444444444444444444444444444444444
0A200A200D9008A00000000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
......\.
0F190FEB444444444444444444444444444444444444444444444444444444444444444444444444
0E3C0D00000000000000000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
........................
00000000000000000000000044444444444444444444444444444444444444444444444444444444
00000000000000000000000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
........
00000F87444444444444444444444444444444444444444444444444444444444444444444444444
00000F00000000000000000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
...................H....
0000003E000000000FDC000044444444444444444444444444444444444444444444444444444444
0A000101000000000DA8000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
...................H....
0000003E000000000FDC000044444444444444444444444444444444444444444444444444444444
0A000101000000000DA8000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------


This still isn't what I was expecting. I do not see my argument string...
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10234
Location: italy

PostPosted: Tue Nov 09, 2010 11:27 pm    Post subject: Reply to: Rexx calling cobol
Reply with quote

if You want to pass parameter to a cobol program as if <called> by jcl
look at the REXX manuals for the flavors of Address LINKPGM,LINKMVS and friends

there are also a few topics here ( if You only had cared to search icon_evil.gif )
http://ibmmainframes.com/viewtopic.php?t=46420&highlight=address+linkpgm+cobol
http://ibmmainframes.com/viewtopic.php?t=32320&highlight=address+linkpgm+cobol
http://ibmmainframes.com/viewtopic.php?t=24953&highlight=address+linkpgm+cobol

as described here
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A360/2.5.9?DT=20050714012324
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1753
Location: Bloomington, IL

PostPosted: Tue Nov 09, 2010 11:31 pm    Post subject:
Reply with quote

Now, I'm not a COBOL programmer. However, I wrote a very simple PL/I program:
Code:
 FOO:  PROC (PARM) OPTIONS (MAIN) REORDER;         
                                                   
 DCL PARM CHAR (100) VAR;                         
                                                   
 PUT SKIP EDIT ('PARM IS [', PARM, ']') (A, A, A);
                                                   
 END FOO;                                         

which I compiled and linked in the usual fashion for batch programs. I then wrote an equally simple Rexx script:
Code:
/* Rexx */                                       
  "ALLOC FI(SYSPRINT) DA(*) SHR REUSE"           
  "CALL 'myID.WORK.LOAD(POO14)' '/Hello, world!'"

(For reasons having to do with my shops naming standards, I had to rename source module FOO to load module POO14.)

When I ran that script, the output was:
Code:
PARM IS [HELLO, WORLD!]

I recommend that you prefix and suffix your parameter string with single quotes, like:
Code:
 KEY = "'" || SUBSTR(ELENAME,01,08) || SUBSTR(ELETYPE,01,08) || RIGHT('00'ELEVERS,2) || "000001'"

Beyond that, I think that you have a specifically COBOLish problem with which I cannot help you.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Wed Nov 10, 2010 12:32 am    Post subject: Re: Reply to: Rexx calling cobol
Reply with quote

enrico-sorichetti wrote:
if You want to pass parameter to a cobol program as if <called> by jcl
look at the REXX manuals for the flavors of Address LINKPGM,LINKMVS and friends

there are also a few topics here ( if You only had cared to search icon_evil.gif )
http://ibmmainframes.com/viewtopic.php?t=46420&highlight=address+linkpgm+cobol
http://ibmmainframes.com/viewtopic.php?t=32320&highlight=address+linkpgm+cobol
http://ibmmainframes.com/viewtopic.php?t=24953&highlight=address+linkpgm+cobol

as described here
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A360/2.5.9?DT=20050714012324


When I try LINKPGM, I receive the same results. I am using RXVSAM as a model:

Code:
MAIN100  DS    0H
         IAZXJSAB READ,JOBID=MYJOBID
         SPACE
         LR    R1,R4              RESTORE PARM (R1) FROM SAVED REG
         USING EFPL,R1            SET ADDRESSABILITY
         ST    R1,EFPL@           KEEP POINTER AROUND JUST IN CASE
         LA    R6,OURSHVBL        INIT -> TO OUR SHARED VAR BLK
         USING SHVBLOCK,R6        SET ADDRESSABILITY
         L     R8,EFPLARG         GET -> TO ARGUMENT LIST
         USING ARGTABLE_ENTRY,R8  SET ADDRESSABILITY
         DROP  R1                 DROP EFPL ADDRESSABILITY
         SPACE
         MVC   VSAMEMSG(VMSGLEN),VMSGINIT  INIT VSAM ERROR MSG AREA
         MVC   NTMSG(NTMSGLEN),NTMSGINI    INIT NAME/TOKEN MSG AREA
         SPACE
         SETMSG MSG=M$ALLOK       INITIALIZE RETURN MESSAGE
         MVC   VSAMER15,=CL2'00'  INITIALIZE VSAM REG 15 RC
         SPACE
*R5 already -> environment block -- loaded from R0 at entry to RXVSAM
         SPACE
         USING ENVBLOCK,R5        SET ADDRESSABILITY TO ENVBLOCK   @ANZ
         ST    R5,ENVB@           SAVE ENVIRONMENT BLOCK POINTER   @ANZ
         L     R5,ENVBLOCK_IRXEXTE EXTERNAL ENTRY VECTOR ADDRESS   @ANZ
         USING IRXEXTE,R5         SET ADDRESSABILITY TO EXTE       @ANZ
         L     R0,IRXEXCOM        IRXEXCOM ROUTINE ADDRESS         @ANZ
         ST    R0,IRXEXCO@        SAVE ROUTINE ADDRESS FOR LATER USE
         DROP  R5                 DROP ENVBLOCK ADDRESSABILITY     @ANZ
         SPACE
         L     R5,ARGTABLE_ARGSTRING_PTR  GET ADDR OF REQUEST ARG
         C     R5,=X'FFFFFFFF'    IF ADDRESS IS ALL X'FF'
         BE    MAIN400            NO ARG PASSED,ERROR
         SPACE
         LA    R8,ARGTABLE_NEXT   BUMP TO NEXT ARGUMENT (DDNAME)
         LM    R3,R4,ARGTABLE_ARGSTRING_PTR  GET ADDR & LENGTH OF ARG
         C     R3,=X'FFFFFFFF'    IF ADDRESS IS ALL X'FF'
         BE    MAIN400            NO ARG PASSED,ERROR
         SPACE
         CH    R4,=H'8'           IF DDNAME LONGER THAN 8 CHARACTERS
         BH    MAIN400            IT'S AN ERROR
         LA    R8,ARGTABLE_NEXT   BUMP TO "NEXT" ARGUMENT
         MVC   DDNAME,SPACES      INIT BLANK PADDED DDNAME
         BCTR  R4,0               DECR IN PREPARATION FOR EXECUTED MVC
         EX    R4,MOVEDDNM        SET OUR COPY OF THE DDNAME
         SPACE
         MVC   IEANTNA1,MYJOBID   CREATE "NAME" FOR NAME / TOKEN
         MVI   IEANTNA1,C'X'      SERVICES: JOBID (1ST CHAR ALWAYS "X")
         MVC   IEANTNA2,DDNAME    PLUS DDNAME
         XC    IEANTTOK,IEANTTOK  CLEAR OUT "TOKEN"
         MVC   IEANTLVL,=AL4(IEANT_TASK_LEVEL)  TASK LVL FOR ALL REQ
         EJECT


It is called as such:
Code:
RC = RXVSAM(DDNAME, FUNCTION, PARAM1, PARAM2)


enrico-sorichetti wrote:
there are also a few topics here ( if You only had cared to search icon_evil.gif )


I thought with all of the code and examples that I have provided, that it would prove the due diligence on my part.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10234
Location: italy

PostPosted: Wed Nov 10, 2010 12:45 am    Post subject: Reply to: Rexx calling cobol
Reply with quote

RXVSAM is a REXX external function,
the parameter passing model is completely different,

so You are just choosing the wrong model

Quote:
thought with all of the code and examples that I have provided, that it would prove the due diligence on my part.


no You thought wrong, You just showed diligence in putting the burden of problem determination on us

all the info we posted can be easily be found in the manuals , and by a simple forum search

and if You had looked there before asking ... that would have been due diligence
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Tue Dec 21, 2010 9:14 pm    Post subject:
Reply with quote

I finished my program, and I wanted to post a sample of what is involved. There isn't much available on the internet for doing this kind of procedure.

To call the assembler:

Code:
TEST_RC = TEST(ARG1,ARG2,ARG3)


Assembler:

Code:
         REGEQU
*
TEST     CSECT
TEST     AMODE 31
TEST     RMODE ANY
         STM   R14,R12,12(R13)            SAVE REGISTERS
         LR    R12,R15                    ESTABLISH BASE
         USING TEST,R12
         ST    R13,SAVEAREA+4             CHAIN SAVEAREA
         LR    R15,R13
         LA    R13,SAVEAREA
*
**********************************************************************
* PARSE PARM LIST
**********************************************************************
         MVC   RC,=CL2'00'                INITIALIZE RETURN CODE
         USING EFPL,R1                    ADDRESS FUNCTION PARM LIST
         L     R8,EFPLARG                 LOAD ARGUMENT LIST ADDRESS
         L     R2,EFPLEVAL                GET EVAL BLOCK ADDR
         L     R2,0(,R2)                  POINT TO EVALBLOCK
         USING EVALBLOCK,R2               ADDRESS EVALUATION BLOCK
         DROP  R1                         DROP PARM LIST
*
CHECKARG DS    0H
         USING ARGTABLE_ENTRY,R8
         BAL   R6,GETARG
         MVC   ARG1,ARGUMENT
         BAL   R6,GETARG
         MVC   ARG2,ARGUMENT
         BAL   R6,GETARG
         MVC   ARG3,ARGUMENT
         B     PROCESS
*
GETARG   DS    0H
         LM    R3,R4,ARGTABLE_ARGSTRING_PTR GET ADDR OF OUTPUT FILE
         C     R3,=X'FFFFFFFF'            IF ADDRESS IS ALL X'FF'
         BE    INVLDARG
         BCTR  R4,0
         MVC   ARGUMENT,SPACES
         EX    R4,MOVEARG
         ST    R4,ARGLEN
         LA    R8,ARGTABLE_NEXT           BUMP TO NEXT ARGUMENT
         BR    R6
*
MOVEARG  MVC   ARGUMENT(0),0(R3)
*
PROCESS  DS    0H

...

EXIT     DS    0H
*
         MVC   EVALBLOCK_EVLEN,=F'2'      PREPARE REXX RETURN
         MVC   EVALBLOCK_EVDATA(2),RC
         DROP  R2
*
         L     R13,SAVEAREA+4
         LM    R14,R12,12(R13)
         SR    R15,R15                    SET REGISTER TO 0
         BR    R14
*
***********************************************************************
* VARIABLES
***********************************************************************
SAVEAREA DS    18F
RC       DS    F
REASON   DS    F
*
ARGUMENT DS    CL80
ARGLEN   DS    F'0'
SPACES   DC    CL80' '
         LTORG
*
         IRXEFPL
         IRXARGTB
         IRXEVALB
         DCBD
         END
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10234
Location: italy

PostPosted: Wed Dec 22, 2010 12:50 am    Post subject: Reply to: Rexx calling cobol
Reply with quote

the biggest misunderstanding here is on the solution provided VS the question asked
REXX calling COBOL
which means something like.... given a COBOL program
call it from REXX passing some parameters and receiving back some results
the program being a general use program.

the solution and code snippet posted relates to something completely different
the thing is coded following the rules and convention of REXX external functions...
where the methodology for parameter passing back and forth is disctated by the REXX conventions

a program written in this way can interact only with REXX

just to straighten things out and not have people understand things wrong!
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts RULES(NOEVENPACK) in cobol jackzhang75 COBOL Programming 5 Wed Mar 29, 2017 12:47 am
No new posts REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm


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