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
 

 

Pass data back from Rexx to COBOL
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 183
Location: Toronto, ON, Canada

PostPosted: Tue Dec 21, 2010 4:15 am    Post subject: Pass data back from Rexx to COBOL
Reply with quote

I want to call a REXX from a cobol program. The REXX will do a LISTDSI to get the dataset name assigned to a dd. I need to pass the name back to COBOL. Not sure if there is another way to get the name.

To pass back the name I thought of getting the address of a variable in the COBOL program, then convert it to a display number, and pass this to my routine. Rexx can then convert the number to a hex address and use the STORAGE function to update.

Is there an easier way? If I do a PUSH onto a data stack then is there a call in COBOL I can use to get the data?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Dec 21, 2010 4:23 am    Post subject:
Reply with quote

Hello,

Is there some reason you want to use rexx? By chasing "control blocks" you can find a dataset name for a DD statememt in cobol . . .
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 183
Location: Toronto, ON, Canada

PostPosted: Tue Dec 21, 2010 4:32 am    Post subject:
Reply with quote

dick scherrer wrote:
By chasing "control blocks" you can find a dataset name for a DD statememt in cobol . . .


That requires Assembler and I don't know it well enough. Rexx is so much easier
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1219
Location: Israel

PostPosted: Tue Dec 21, 2010 4:42 am    Post subject:
Reply with quote

You can use ISPF services: VPUT in your rexx program, and VGET in your cobol.
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 Dec 21, 2010 5:55 am    Post subject: Reply to: Pass data back from Rexx to COBOL
Reply with quote

You might want to review this previous topic.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7908
Location: Bellevue, IA

PostPosted: Tue Dec 21, 2010 7:50 am    Post subject:
Reply with quote

Quote:
That requires Assembler and I don't know it well enough. Rexx is so much easier
Actually, no it does not. You can find the DSN name for a DD name using nothing but pure COBOL statements.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Dec 21, 2010 1:00 pm    Post subject:
Reply with quote

Why do you actually need to know the name of an output dataset ?
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 183
Location: Toronto, ON, Canada

PostPosted: Tue Dec 21, 2010 7:30 pm    Post subject: Reply to: Pass data back from Rexx to COBOL
Reply with quote

I didn't think it was possible to use COBOL to access the control blocks.

I am still looking for a more general answer of passing data from a rexx back to COBOL. I could write to a file but there should be a simplier way. If I use IRXJCL to invoke the rexx then it will initialize an environment. Can I then use IRXEXCOM to access the rexx variables after calling the rexx? Has anyone tried this?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Dec 21, 2010 7:38 pm    Post subject:
Reply with quote

expat wrote:
Why do you actually need to know the name of an output dataset ?
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 183
Location: Toronto, ON, Canada

PostPosted: Tue Dec 21, 2010 8:26 pm    Post subject:
Reply with quote

expat wrote:
Why do you actually need to know the name of an output dataset ?


This is the requirement that was given to me. The designers want the name of the input dataset to be written to an output dataset. My job is to find a way to make it work. They pay my salary - I code the programs.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Dec 21, 2010 8:41 pm    Post subject: Reply to: Pass data back from Rexx to COBOL
Reply with quote

Quote:
They pay my salary

not our salary!
since You ask and we reply that gives us some more privileges !
since we do not get paid we are free to ask question

remember, replying is on
voluntary base
our own time
our own equipment
free of charge
interest in the argument of the topic

anyway there is no general no easy way of getting back values from REXX to any language

environment settings, control block mangling, not worth the effort at all
it would be wiser to review the architecture
( for example having rexx as the orchestra director instead of COBOL or whatsoever )
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Dec 21, 2010 8:50 pm    Post subject:
Reply with quote

Jerry no inference on you, but where on earth do these hairbrained requirements come from ???

I'm not sure but LISTDSI may only return the first dataset in a concatenation, so if for some reason there is a concatenated input then you may be creating a wrong output file.
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Tue Dec 21, 2010 9:05 pm    Post subject: Reply to: Pass data back from Rexx to COBOL
Reply with quote

Agree with Marso: VPUT in your rexx program, and VGET in your cobol
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: Tue Dec 21, 2010 9:15 pm    Post subject: Re: Reply to: Pass data back from Rexx to COBOL
Reply with quote

jerryte wrote:
I didn't think it was possible to use COBOL to access the control blocks.

I am still looking for a more general answer of passing data from a rexx back to COBOL. I could write to a file but there should be a simplier way. If I use IRXJCL to invoke the rexx then it will initialize an environment. Can I then use IRXEXCOM to access the rexx variables after calling the rexx? Has anyone tried this?
Yes, I have done this, but not in the same context that you are faced with. In my case the Rexx called the Cobol program, and the Cobol program used IRXEXCOM to retrieve/set Rexx variables that were later used by the calling Rexx.
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 183
Location: Toronto, ON, Canada

PostPosted: Tue Dec 21, 2010 10:58 pm    Post subject:
Reply with quote

expat wrote:
Jerry no inference on you, but where on earth do these hairbrained requirements come from ???

I'm not sure but LISTDSI may only return the first dataset in a concatenation, so if for some reason there is a concatenated input then you may be creating a wrong output file.


I ask that question myself sometimes.

In this case there is only one dataset but it is a gdg so the name changes every time a generation is created.

I could do the reverse ie. use a rexx to get the name and then call the cobol program and pass the name in as a parameter.

Thanks to everyone for your input. I will figure something out.
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: Tue Dec 21, 2010 11:26 pm    Post subject:
Reply with quote

I once saw a system with a similar requirement. Many years ago, Canadian banks exchanged payment information via physical tapes. The payment exchange application was required to produce a report listing the DSN and VOLSER of all the tapes it created. This was used as a 'packing list' for the mailroom when they shipped the tapes.

The application used a locally developed Assembler subroutine to obtain the DSN and VOLSER information.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Tue Dec 21, 2010 11:36 pm    Post subject:
Reply with quote

You could call the rexx program in step1 of the jcl, allocate the output file as disp=new and write the dataset name as the first and only record.

In step2 you could call your cobol program unchanged, with the output dataset allocated as disp=mod.

Just an option.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Tue Dec 21, 2010 11:43 pm    Post subject:
Reply with quote

You may also invoke the TSO command LISTALC from within COBOL and parse the results (SYSTSPRT).

O.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Wed Dec 22, 2010 6:15 pm    Post subject: Reply to: Pass data back from Rexx to COBOL
Reply with quote

I have programs calling an assembler routine to get the DSNAME for a DDNAME, 'surfing' Data Areas from Cobol...but when a peer asked me for the cleanest method... I just coded a Rexx like this:

Quote:
/*Rexx */
arg DDNAME
X = LISTDSI(DDNAME "FILE")
queue LEFT(SYSDSNAME,44) Syslrecl SYSrecfm
"execio 1 diskw DDINFO"
Exit


and the cobol program just read the DDINFO.

just my 2 cents.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Wed Dec 22, 2010 7:14 pm    Post subject: Reply to: Pass data back from Rexx to COBOL
Reply with quote

the code of the previous post belongs to a version in which the file is included in the step of the rexx program in the same way as in the Cobol program, other version could be:

Code:

/*Rexx */
arg DsNAME
X = listdsi("'"dsname"'" )   
queue LEFT(SYSDSNAME,44) Syslrecl SYSrecfm
"execio 1 diskw DDINFO"
Exit

;)
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
No new posts How to move a long alphanumeric data ... lind sh COBOL Programming 6 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 CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm


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