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

Passing a variable/value to Rexx


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

New User


Joined: 01 Mar 2007
Posts: 39
Location: Chennai

PostPosted: Wed Jun 24, 2009 1:21 am
Reply with quote

Hi all,

this is not as usual but something different.

I have a rexx program which submits the jcl. And in the JCL i have written an eazytrieve where I have introduced a count variable to find the total number of records in a dataset.

Now i have to pass this eazytrieve variable again to the same rexx code for further processing.

Could anyone help me out to pass the variable/value to the rexx program.

This is my eazytrieve

FILE INPUT1
*
WS-RECCOUNT W 15 N VALUE 0
*
JOB INPUT INPUT1 FINISH PRINT-PARA
WS-RECCOUNT = WS-RECCOUNT + 1
GOTO JOB
PRINT-PARA. PROC
DISPLAY 'NO OF RECORDS:' WS-RECCOUNT
END-PROC.


Thanks,
Ugandar
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jun 24, 2009 1:29 am
Reply with quote

You can't. What happens if the job you submitted doesn't run for 4 hours.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1314
Location: Vilnius, Lithuania

PostPosted: Wed Jun 24, 2009 1:29 am
Reply with quote

ug123 wrote:
this is not as usual but something different.

I have a rexx program which submits the jcl. And in the JCL i have written an eazytrieve where I have introduced a count variable to find the total number of records in a dataset.


And how do you expect to know the REXX exec will know when the EZ job has finished? This is more of the "usual", people trying to create a home-grown scheduler.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jun 24, 2009 1:35 am
Reply with quote

Hello,

Hopefully, you do not intend for an online rexx to wait for the batch job to run. . .

Suggest you end the first rexx when the job is submitted and at the end of the batch easytrieve, invoke rexx in batch. The easytrieve process would write the count into a dataset to be read/used by the batch rexx.
Back to top
View user's profile Send private message
ug123
Warnings : 1

New User


Joined: 01 Mar 2007
Posts: 39
Location: Chennai

PostPosted: Wed Jun 24, 2009 1:40 am
Reply with quote

Wow!!! I hope calling rexx in batch will help me. thanks for your info... i will try and let you know. once again thank you very much...

regards,
Ugandar
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Wed Jun 24, 2009 2:00 am
Reply with quote

icon_rolleyes.gif
Back to top
View user's profile Send private message
ug123
Warnings : 1

New User


Joined: 01 Mar 2007
Posts: 39
Location: Chennai

PostPosted: Wed Jun 24, 2009 9:49 am
Reply with quote

Hi,

I am not able to display the value in the screen when I run the rexx in batch mode.

I could see only in the spool. Is there any other way to display the value in screen.



Thanks,
Ugandar
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Jun 24, 2009 11:20 am
Reply with quote

ug123 wrote:
Hi,
I am not able to display the value in the screen when I run the rexx in batch mode.
I could see only in the spool. Is there any other way to display the value in screen.
Thanks,
Ugandar

And how do you propose that two totally unrelated address spaces to interact together and pass data ?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 24, 2009 5:09 pm
Reply with quote

expat, maybe through a scheduler -- something like CA-7 or Zeke or ... ?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jun 24, 2009 8:40 pm
Reply with quote

Hello,

Quote:
I am not able to display the value in the screen when I run the rexx in batch mode.
I could see only in the spool. Is there any other way to display the value in screen.
Why not simply look at the info in the spool?

You could write the "answer" to some file or member and then later read this into an online screen. If you use NOTIFY in the batch job, you will get an interruption on the screen to tell you the job ended.
Back to top
View user's profile Send private message
d_pansare

New User


Joined: 25 Apr 2009
Posts: 20
Location: Pune

PostPosted: Thu Jun 25, 2009 5:18 pm
Reply with quote

If you just want to count the records in Ezytrv and then display it on screen using rexx then in such scenario why don't you let rexx do both the things for you.. get the count from rexx itself and use it further down the lane for whatever process you want.... icon_confused.gif icon_confused.gif icon_confused.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Thu Jun 25, 2009 5:54 pm
Reply with quote

For a start REXX is one of the slowest and highest resouce comsumers for heavy IO. So would use far more resource and take longer than most other methods.

In addition as the OP is talking about getting the result back to the screen it would appear that this REXX will be processed in foreground, thus locking the terminal from being used by anything else for the duration of this process.

Had you have bothered to search the forum before answering you would have found that this topic has been discussed numerous times before and as always is given the thumbs down as a method of doing what the OP wants. Although REXX can invoke many other programs or utilities to perform the count and return the value, this still locks the terminal and prevents work.
Back to top
View user's profile Send private message
d_pansare

New User


Joined: 25 Apr 2009
Posts: 20
Location: Pune

PostPosted: Thu Jun 25, 2009 6:18 pm
Reply with quote

Quote:

Although REXX can invoke many other programs or utilities to perform the count and return the value, this still locks the terminal and prevents work.


I am in complete agreement with you.. But just thought if there is no other way... and author still wants have the output on the screen then he will have to use this method irrespective of time that will elapse to get the output...
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jun 26, 2009 2:24 am
Reply with quote

Hello,

Quote:
But just thought if there is no other way...
There is nearly always "another way". Unfortunately, "other ways" often require more actual effort and thus become undesirable. . .

Quote:
then he will have to use this method irrespective of time that will elapse to get the output
which is how an incredible number of really pathetic processes are being justified and causing problems on lots of systems now being supported/maintained by rather incompetent system management people. In previous days, something would not be permitted. . .
Back to top
View user's profile Send private message
ug123
Warnings : 1

New User


Joined: 01 Mar 2007
Posts: 39
Location: Chennai

PostPosted: Fri Jun 26, 2009 2:35 am
Reply with quote

Hi all,

I tried to count the total number of records using REXX program. But it helps only if the dataset has less than 2 lakhs of records. If the dataset has more number of records, REXX variable is not able to store and throwing an error message as 'unable to obtain storage'.

Thanks,
Ugandar
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Jun 26, 2009 2:40 am
Reply with quote

Hello,

You should not be running this in rexx. . . .
Back to top
View user's profile Send private message
d_pansare

New User


Joined: 25 Apr 2009
Posts: 20
Location: Pune

PostPosted: Fri Jun 26, 2009 1:50 pm
Reply with quote

Quote:

If the dataset has more number of records, REXX variable is not able to store and throwing an error message as 'unable to obtain storage'.



You got this kind of error because you must be reading the whole file in an array and getting your record count using value present in '0' th node. This will work unless and until your array does't take the storage space more than 2MB ( 2 MB is the threshold storage limit for REXX program variables ).

If upfront you are aware that size of your file is more thab 2 mb then don't read the entire file rather keep reading one by one record until you reach the end of file...

Let me know if you would like to have the code to count the record....

_________________

Always there to give and take the HELP !!!!!
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Fri Jun 26, 2009 1:54 pm
Reply with quote

Quote:
2 MB is the threshold storage limit for REXX program variables

please quote or give the link to the manual where You read that
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Jun 26, 2009 2:06 pm
Reply with quote

And also pay attention to the comment of Dick above.

I await your reply to Enricos request eagerly, having processed files of over 10Mb in the past.
Back to top
View user's profile Send private message
d_pansare

New User


Joined: 25 Apr 2009
Posts: 20
Location: Pune

PostPosted: Fri Jun 26, 2009 4:31 pm
Reply with quote

Apologies.. I quoted the wrong figure..

Here is the snapshot of what is mentioned in TSO/E REXX reference manual..

<<<<<<<<<<<<<<<<<<<<<<

There is no limit to the length of the values of variables, as long as all variables fit
into the storage available.
Implementation maximum: No single request for storage can exceed the fixed
limit of 16 MB. This limit applies to the size of a variable plus any control
information. It also applies to buffers obtained to hold numeric results.

>>>>>>>>>>>>>>>>>>>>>>>>

Here is the link ...

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IKJ4A370/2.0?DT=20060626210253

So if this true then one cannot write the whole file to array if the size is more than 16MB....

Again sorry for the confusion as far as actual storage is concerned...




[/url]
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Fri Jun 26, 2009 4:36 pm
Reply with quote

do a bit of rereading, please
the 16MB limit is for a single variable, not for an array ( wrong term anyway ) as a whole
each entry of an array ( as You call it ) is a variable

( the right term would be a STEMMED variable )

each [stemmed] variable ( apart a few bytes of control info ) can be up to 16 MB

how many variables You can define and use depends on the virtual storage avilable
Back to top
View user's profile Send private message
ug123
Warnings : 1

New User


Joined: 01 Mar 2007
Posts: 39
Location: Chennai

PostPosted: Fri Jun 26, 2009 8:00 pm
Reply with quote

Dick, I appologies for not responding. Please let me know other than rexx how can we do that...

This is what I am doing currently.
DSN='HLQ.XXXX'
"ALLOC DA('"DSN"') F(OUTDD) SHR"
"EXECIO 0 DISKR OUTDD(OPEN"
"EXECIO * DISKR OUTDD(STEM I."

COUNT = 0
DO LIN = 1 TO I.0
COUNT = COUNT + 1
END
ZEDLMSG = 'TOTAL RECORDS:' || COUNT
"ISPEXEC SETMSG MSG(ISRZ001)"

"EXECIO 0 DISKR OUTDD(FINIS"
"FREE F(OUTDD)"

Please give some code if anything is wrong in the above code.


Thanks,
Ugandar...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Fri Jun 26, 2009 8:09 pm
Reply with quote

edited to correct my first wrong impression
Quote:
nothing wrong from a REXX syntactic point of view,


why in <heaven> the loop
Code:
COUNT = 0
DO LIN = 1 TO I.0
COUNT = COUNT + 1
END

at the end count will be equal to i.0
are You trying to be real sure that things match icon_biggrin.gif icon_confused.gif

the approach is wrong because an "EXECIO * READ .... (STEM ...."
will try to read in memory all the records and trying to manage in rexx more than a few thousandths records will give a poor performance from any point of view.

if there is a real business need to have an interactive count the most performing approach would be to invoke from rexx Your sort product
to count the records, writing a single output record with the result

and then in rexx read the single line displaying the result

see the jcl/dfsort forums on samples about counting records

but, I really see a little need to find out in an interactive way the record count
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 Run rexx with JCL Job CLIST & REXX 3
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
No new posts REXX/CMS How to place command console... CLIST & REXX 4
Search our Forums:

Back to Top