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

Passing data from Rexx to Cobol and receiving it back to rex


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

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Fri Mar 22, 2013 12:18 pm
Reply with quote

I've a REXX program which calls a COBOL module and passes some data to it using simple CALL statements in rexx. COBOL does some business logic and has to return back the result to REXX from where it has been invoked and the REXX will execute the remaining code.

Till now, i used an intermediary file to write the result of COBOL and parse the same file using REXX to get the COBOL result back. Once the application is executed successfully, delete this intermediary file.
But i find this process as tedious (because of creating and deleting many intermediary files) and started searching for an alternative method.

Any one can suggest me an alternate way for doing this process ?

Here only REXX and COBOL modules are to be interfaced.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 22, 2013 12:26 pm
Reply with quote

is the cobol program aware that it is being called by rexx ?
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Fri Mar 22, 2013 12:33 pm
Reply with quote

Yes Enrico.. The COBOL program will be used only by REXX.

Reason for using COBOl first of all is, i'm parsing/Generating XML in the COBOL module and sending the result to REXX.

I guess these functions can't be performed using REXX that's why using COBOL as called program in between of a REXX module. Otherwise i would have performed all my functions in REXX itself.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 22, 2013 12:42 pm
Reply with quote

why not write the program as a REXX external function...

in this way You will have access to the REXX variable pool and able to
pass back and forth any <parameter> <return value>

or for a REXX XML parser You might find interesting this one
sourceforge.net/projects/rexxxmlparser/
Back to top
View user's profile Send private message
dsivapradeep

New User


Joined: 06 Jul 2012
Posts: 43
Location: INDIA

PostPosted: Fri Mar 22, 2013 2:59 pm
Reply with quote

That link is DOM parsing. I'm working in SAX parsing. So i'll use COBOL itself for parsing and generation.
And COBOL can be used as External function too for REXX ??
I don't know how to use COBOL as External Function and kindly provide me some help for doing this.

After searching in Google i found this link. From publib.boulder.ibm.com/infocenter/zos/v1r12/index.jsp?topic=%2Fcom.ibm.zos.r12.ikja300%2Ffpinter.htm what i understood was i need an assembler stub interface to connect REXX to other High level program like COBOL and for manipulation of Register 0 has to be done.

Correct me if i'm wrong.

But I'm not good at Assembler programming.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 22, 2013 3:32 pm
Reply with quote

Quote:
That link is DOM parsing. I'm working in SAX parsing.

How was I supposed to know ? icon_evil.gif

Quote:
And COBOL can be used as External function too for REXX ??

YES

no need to mangle registers, deep mangling is needed if You want to interact with TSO

IIRC the only <structure>s needed are IRXEFPL and the <descendents>

look at FANxxx.SEAGSAM for the COBOL snippets and coding style

google for IRXEFPL COBOL

I should have a snippet somewhere, if I can find it I will post it
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: Fri Mar 22, 2013 8:42 pm
Reply with quote

IRXEXCOM can be used by the Cobol program to retrieve Rexx variables and replace them with new values.

If you search the forum for IRXEXCOM you will probably find some examples.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Sat Mar 23, 2013 2:59 pm
Reply with quote

publib.boulder.ibm.com/infocenter/zos/v1r12/index.jsp?topic=/com.ibm.zos.r12.rexa100/h1981605302.htm also contains links to a downloadable document that has two examples of calling REXX from COBOL. They might just interest you.
Back to top
View user's profile Send private message
Stefan

Active User


Joined: 12 Jan 2006
Posts: 110
Location: Germany

PostPosted: Tue Mar 26, 2013 7:59 pm
Reply with quote

Another easy way of passing variables between a REXX program and a COBOL program is using ISPF variable services VPUT and VGET (and VDEFINE in COBOL too).
The ISPF editor already provides you with working examples.
Simply enter "model class COBOL" respectively "model class REXX" to define the current language when you are in edit mode. Then enter "model" and you will see a menu offering templates for all ISPF services using the current language. Now select the desired service and the code including error handling code fragments and notes lines explaining common errors are copied into your source code.
That's pretty cool. Give it a try !
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue Mar 26, 2013 10:15 pm
Reply with quote

Is the data too large to use the Linkage Section?

I have passed data back and forth that way in the past.

Just make sure the last position of the Linkage Section has a non-space vaule prior to calling the Cobol subroutine. (ask me how I know)
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 1
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top