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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Passing data from Rexx to Cobol and receiving it back to rex
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Mar 22, 2013 12:26 pm    Post subject: Reply to: Passing data from Rexx to Cobol and receiving it b
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Mar 22, 2013 12:42 pm    Post subject: Reply to: Passing data from Rexx to Cobol and receiving it b
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
http://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    Post subject:
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 http://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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Mar 22, 2013 3:32 pm    Post subject:
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: 641
Location: Whitby, ON, Canada

PostPosted: Fri Mar 22, 2013 8:42 pm    Post subject:
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

Senior Member


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

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

http://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    Post subject:
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: 645
Location: Pennsylvania

PostPosted: Tue Mar 26, 2013 10:15 pm    Post subject:
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    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 Hi,Iam trying to unwrap the data base... bhavana yalavarthi DFSORT/ICETOOL 0 Fri Dec 09, 2016 10:25 am
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm


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