Discussion:
"Static" external functions
(too old to reply)
Bob Bridges
2016-09-09 16:54:17 UTC
Permalink
Raw Message
Ok, so I'm going to write that Replace function. In many cases I could make it an external function and use it just once or twice in a program. But the particular application I have in mind this time will call the function many times in one run, maybe a few dozen, so I'll probably want to make it internal.

But whatever version of Replace I write is going to be longish; I'd rather not have it taking up a lot of space in my otherwise simple REXX routine. Which brings me here: Isn't there some way to get REXX to load an external function and ~keep~ it, rather than throw it away and then reload it with each invocation?

The standard method is the latter, which makes it unacceptable to call an external REXX routine inside a loop that's going to be executed (say) 1000 times; it makes the program run far too long. Nothing in the REXX manual hints at the ability to have the interpreter keep an external routine around between invocations, so I'll accept it if y'all agree it can't be done.

So what's the alternative? If I write the Replace function in a compiled language, would REXX then load it and keep it around between invocations? PL/1, perhaps? Or COBOL (although I'm not a fan of COBOL and especially not for a string-handling routine)? What are my alternatives?

---
Bob Bridges
***@gmail.com, cell 336 382-7313
***@InfoSecInc.com

/* When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. */

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Baldon, David
2016-09-09 17:28:44 UTC
Permalink
Raw Message
You could write your own REXX function package. This will give a very natural feel to your EXECs.
i.e. address STRLIB "replace(buffer, 'abc', 'xyz')". While it will take more effort you will have the ability (luxury?) to write the functions in whichever language you choose. Assembler will give you the best performance and is easier to implement but harder to write/maintain depending on your level of knowledge. I've written several of these with the outer layer being assembler which loads C/C++ routines to do the "real" work. Details are in the TSO/E REXX Reference in the TSO/E REXX programming services section.

...David

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Bob Bridges
Sent: Friday, September 09, 2016 11:54 AM
To: TSO-***@VM.MARIST.EDU
Subject: "Static" external functions

Ok, so I'm going to write that Replace function. In many cases I could make it an external function and use it just once or twice in a program. But the particular application I have in mind this time will call the function many times in one run, maybe a few dozen, so I'll probably want to make it internal.

But whatever version of Replace I write is going to be longish; I'd rather not have it taking up a lot of space in my otherwise simple REXX routine. Which brings me here: Isn't there some way to get REXX to load an external function and ~keep~ it, rather than throw it away and then reload it with each invocation?

The standard method is the latter, which makes it unacceptable to call an external REXX routine inside a loop that's going to be executed (say) 1000 times; it makes the program run far too long. Nothing in the REXX manual hints at the ability to have the interpreter keep an external routine around between invocations, so I'll accept it if y'all agree it can't be done.

So what's the alternative? If I write the Replace function in a compiled language, would REXX then load it and keep it around between invocations? PL/1, perhaps? Or COBOL (although I'm not a fan of COBOL and especially not for a string-handling routine)? What are my alternatives?

---
Bob Bridges
***@gmail.com, cell 336 382-7313
***@InfoSecInc.com

/* When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. */

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Bob Bridges
2016-09-09 17:58:29 UTC
Permalink
Raw Message
I've been in this business over 40 years now, and I've written in other assemblers but never for the mainframe. Past time I learned, wouldn't you say? So maybe I should take this option seriously.

---
Bob Bridges
***@gmail.com, cell 336 382-7313
***@InfoSecInc.com

/* The difference between theory and practice is wider in practice than it is in theory. -C J Date */

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Baldon, David
Sent: Friday, September 9, 2016 13:29

You could write your own REXX function package. This will give a very natural feel to your EXECs.
i.e. address STRLIB "replace(buffer, 'abc', 'xyz')". While it will take more effort you will have the ability (luxury?) to write the functions in whichever language you choose. Assembler will give you the best performance and is easier to implement but harder to write/maintain depending on your level of knowledge. I've written several of these with the outer layer being assembler which loads C/C++ routines to do the "real" work. Details are in the TSO/E REXX Reference in the TSO/E REXX programming services section.

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Bob Bridges
Sent: Friday, September 09, 2016 11:54 AM

Ok, so I'm going to write that Replace function. In many cases I could make it an external function and use it just once or twice in a program. But the particular application I have in mind this time will call the function many times in one run, maybe a few dozen, so I'll probably want to make it internal.

But whatever version of Replace I write is going to be longish; I'd rather not have it taking up a lot of space in my otherwise simple REXX routine. Which brings me here: Isn't there some way to get REXX to load an external function and ~keep~ it, rather than throw it away and then reload it with each invocation?

The standard method is the latter, which makes it unacceptable to call an external REXX routine inside a loop that's going to be executed (say) 1000 times; it makes the program run far too long. Nothing in the REXX manual hints at the ability to have the interpreter keep an external routine around between invocations, so I'll accept it if y'all agree it can't be done.

So what's the alternative? If I write the Replace function in a compiled language, would REXX then load it and keep it around between invocations? PL/1, perhaps? Or COBOL (although I'm not a fan of COBOL and especially not for a string-handling routine)? What are my alternatives?

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Peete Baer
2016-09-09 18:16:07 UTC
Permalink
Raw Message
Good morning Bob:

If you are serious about z/OS Assembler there are many good books, but none better than the one by John Ehrman.

You can download John's book from the Marist site.

As for the difference between theory and practice, my favorite is attributed to Yogi Berra - "In theory, there's no difference
between theory and practice. In practice, there is".

Which leads me to the REXX to zOS Assembler interface. It's called the Evalblok interface.

It allows you to call an Assembler program from REXX, access passed parameters, return results, and access REXX variables.

Might be useful considering the task set forth.

Cordially,

Peete W. Baer



Journal Technologies, Inc.
(510) 682 – 5743 (Cell-Text)


-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Bob Bridges
Sent: Friday, September 09, 2016 10:59 AM
To: TSO-***@VM.MARIST.EDU
Subject: Re: [TSO-REXX] "Static" external functions

I've been in this business over 40 years now, and I've written in other assemblers but never for the mainframe. Past time I learned, wouldn't you say? So maybe I should take this option seriously.

---
Bob Bridges
***@gmail.com, cell 336 382-7313
***@InfoSecInc.com

/* The difference between theory and practice is wider in practice than it is in theory. -C J Date */

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Baldon, David
Sent: Friday, September 9, 2016 13:29

You could write your own REXX function package. This will give a very natural feel to your EXECs.
i.e. address STRLIB "replace(buffer, 'abc', 'xyz')". While it will take more effort you will have the ability (luxury?) to write the functions in whichever language you choose. Assembler will give you the best performance and is easier to implement but harder to write/maintain depending on your level of knowledge. I've written several of these with the outer layer being assembler which loads C/C++ routines to do the "real" work. Details are in the TSO/E REXX Reference in the TSO/E REXX programming services section.

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Bob Bridges
Sent: Friday, September 09, 2016 11:54 AM

Ok, so I'm going to write that Replace function. In many cases I could make it an external function and use it just once or twice in a program. But the particular application I have in mind this time will call the function many times in one run, maybe a few dozen, so I'll probably want to make it internal.

But whatever version of Replace I write is going to be longish; I'd rather not have it taking up a lot of space in my otherwise simple REXX routine. Which brings me here: Isn't there some way to get REXX to load an external function and ~keep~ it, rather than throw it away and then reload it with each invocation?

The standard method is the latter, which makes it unacceptable to call an external REXX routine inside a loop that's going to be executed (say) 1000 times; it makes the program run far too long. Nothing in the REXX manual hints at the ability to have the interpreter keep an external routine around between invocations, so I'll accept it if y'all agree it can't be done.

So what's the alternative? If I write the Replace function in a compiled language, would REXX then load it and keep it around between invocations? PL/1, perhaps? Or COBOL (although I'm not a fan of COBOL and especially not for a string-handling routine)? What are my alternatives?

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX

-=Protected by Progent EmailGuard=-
Baldon, David
2016-09-09 18:23:37 UTC
Permalink
Raw Message
Well it would be interesting no doubt...lol I think the hurdle is high but worth the payoff. The cool thing about a function package is once you get the basics down you can very easily add to it.

...David

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Bob Bridges
Sent: Friday, September 09, 2016 12:59 PM
To: TSO-***@VM.MARIST.EDU
Subject: Re: "Static" external functions

I've been in this business over 40 years now, and I've written in other assemblers but never for the mainframe. Past time I learned, wouldn't you say? So maybe I should take this option seriously.

---
Bob Bridges
***@gmail.com, cell 336 382-7313
***@InfoSecInc.com

/* The difference between theory and practice is wider in practice than it is in theory. -C J Date */

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Baldon, David
Sent: Friday, September 9, 2016 13:29

You could write your own REXX function package. This will give a very natural feel to your EXECs.
i.e. address STRLIB "replace(buffer, 'abc', 'xyz')". While it will take more effort you will have the ability (luxury?) to write the functions in whichever language you choose. Assembler will give you the best performance and is easier to implement but harder to write/maintain depending on your level of knowledge. I've written several of these with the outer layer being assembler which loads C/C++ routines to do the "real" work. Details are in the TSO/E REXX Reference in the TSO/E REXX programming services section.

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of Bob Bridges
Sent: Friday, September 09, 2016 11:54 AM

Ok, so I'm going to write that Replace function. In many cases I could make it an external function and use it just once or twice in a program. But the particular application I have in mind this time will call the function many times in one run, maybe a few dozen, so I'll probably want to make it internal.

But whatever version of Replace I write is going to be longish; I'd rather not have it taking up a lot of space in my otherwise simple REXX routine. Which brings me here: Isn't there some way to get REXX to load an external function and ~keep~ it, rather than throw it away and then reload it with each invocation?

The standard method is the latter, which makes it unacceptable to call an external REXX routine inside a loop that's going to be executed (say) 1000 times; it makes the program run far too long. Nothing in the REXX manual hints at the ability to have the interpreter keep an external routine around between invocations, so I'll accept it if y'all agree it can't be done.

So what's the alternative? If I write the Replace function in a compiled language, would REXX then load it and keep it around between invocations? PL/1, perhaps? Or COBOL (although I'm not a fan of COBOL and especially not for a string-handling routine)? What are my alternatives?

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Mickey Bee
2016-09-12 14:02:42 UTC
Permalink
Raw Message
It can be done in Rexx, if you have a compiler.

-----Original Message-----
From: Baldon, David
Sent: Friday, September 09, 2016 1:28 PM
To: TSO-***@VM.MARIST.EDU
Subject: Re: [TSO-REXX] "Static" external functions

You could write your own REXX function package. This will give a very
natural feel to your EXECs.
i.e. address STRLIB "replace(buffer, 'abc', 'xyz')". While it will take more
effort you will have the ability (luxury?) to write the functions in
whichever language you choose. Assembler will give you the best performance
and is easier to implement but harder to write/maintain depending on your
level of knowledge. I've written several of these with the outer layer being
assembler which loads C/C++ routines to do the "real" work. Details are in
the TSO/E REXX Reference in the TSO/E REXX programming services section.

...David

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-***@VM.MARIST.EDU] On Behalf Of
Bob Bridges
Sent: Friday, September 09, 2016 11:54 AM
To: TSO-***@VM.MARIST.EDU
Subject: "Static" external functions

Ok, so I'm going to write that Replace function. In many cases I could make
it an external function and use it just once or twice in a program. But the
particular application I have in mind this time will call the function many
times in one run, maybe a few dozen, so I'll probably want to make it
internal.

But whatever version of Replace I write is going to be longish; I'd rather
not have it taking up a lot of space in my otherwise simple REXX routine.
Which brings me here: Isn't there some way to get REXX to load an external
function and ~keep~ it, rather than throw it away and then reload it with
each invocation?

The standard method is the latter, which makes it unacceptable to call an
external REXX routine inside a loop that's going to be executed (say) 1000
times; it makes the program run far too long. Nothing in the REXX manual
hints at the ability to have the interpreter keep an external routine around
between invocations, so I'll accept it if y'all agree it can't be done.

So what's the alternative? If I write the Replace function in a compiled
language, would REXX then load it and keep it around between invocations?
PL/1, perhaps? Or COBOL (although I'm not a fan of COBOL and especially not
for a string-handling routine)? What are my alternatives?

---
Bob Bridges
***@gmail.com, cell 336 382-7313
***@InfoSecInc.com

/* When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl. */

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Pedro Vera
2016-09-12 17:26:03 UTC
Permalink
Raw Message
Post by Baldon, David
You could write your own REXX function package. This will give a very
natural feel to your EXECs.
Post by Baldon, David
i.e. address STRLIB "replace(buffer, 'abc', 'xyz')".
Sorry to nitpick... You mention a function package, but the example is a
host command environment (it is not executed as a rexx function).

Host command environments are set up through a call to system routine
IRXSUBCM and it is fairly simple. The parameter list is different for a
host command handler than for external functions.

Regarding functions, in my implementation, I was satisfied by providing
functions without a function package. You just provide the load modules in
a steplib or TSOLIB!

fyi. I briefly discussed how to define the host command environment, in
the last two pages of my 'Automating Critical IMS Operations' presentation
at the REXX Symposium a few weeks ago. See rexxla.org


Pedro Vera
DB2 Admin Tool
http://www-01.ibm.com/software/data/db2imstools/db2tools/db2admin/

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Paul Gilmartin
2016-09-09 17:50:17 UTC
Permalink
Raw Message
Post by Bob Bridges
Ok, so I'm going to write that Replace function. In many cases I could make it an external function and use it just once or twice in a program. But the particular application I have in mind this time will call the function many times in one run, maybe a few dozen, so I'll probably want to make it internal.
But whatever version of Replace I write is going to be longish; I'd rather not have it taking up a lot of space in my otherwise simple REXX routine. Which brings me here: Isn't there some way to get REXX to load an external function and ~keep~ it, rather than throw it away and then reload it with each invocation?
CMS has something like this in EXECLOAD and NUCXLOAD which give the virtual
machine programmer control of something like a private dynamic LPA.

Modern (virtual) disks do a lot of caching. This might eliminate much of
the I/O but retain the interfacing overhead.

What about a Rexx interface to the LOAD and DELETE macros? (I suppose
only for compiled Rexx.)

Imagine a generalized LPA for not only program objects but also for
frequently used EXECs and data objects Locale descriptions and
TZDATA come to mind.

Use the interface to EXECs in storage and let paging deal with it?

Most UNIXen do aggressive caching of disk blocks. Mignt an EXEC
architecture such as you envision perform better under z/OS UNIX
Rexx than under TSO Rexx?

Decades ago I used a Rexx Exec with a large STEPLIB. Calls to
TIME() and DATE() were taking several hundred milliseconds (yes,
per call!). Went to SR. WAD. Required to search directory
and load locale. I suppose it supported dynamically updating
locale.. I got rid of the STEPLIB.

Most Rexxen on other platforms allow a REXXLIB to search for
functions rather than mixing them in STEPLIB/LNKLIST. Kinda like
SYSEXEC or CLASSPATH.

-- gil

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to ***@VM.MARIST.EDU with the message: INFO TSO-REXX
Aviatrexx
2016-09-09 22:45:12 UTC
Permalink
Raw Message
While learning to write an external function package in Assembler is a noble and andragogically valuable goal, do you have access to Netview or OMVS?

The job you wish to do is no more than a line or two in John Hartmann's Pipelines: publib.boulder.ibm.com/tividd/td/netview390/dqsl2mst/en_US/HTML/

Invoke it as a command from your Rexx program.

-Chip-
Post by Bob Bridges
Ok, so I'm going to write that Replace function. In many cases I could make it an external function and use it just once or twice in a program. But the particular application I have in mind this time will call the function many times in one run, maybe a few dozen, so I'll probably want to make it internal.
But whatever version of Replace I write is going to be longish; I'd rather not have it taking up a lot of space in my otherwise simple REXX routine. Which brings me here: Isn't there some way to get REXX to load an external function and ~keep~ it, rather than throw it away and then reload it with each invocation?
The standard method is the latter, which makes it unacceptable to call an external REXX routine inside a loop that's going to be executed (say) 1000 times; it makes the program run far too long. Nothing in the REXX manual hints at the ability to have the interpreter keep an external routine around between invocations, so I'll accept it if y'all agree it can't be done.
So what's the alternative? If I write the Replace function in a compiled language, would REXX then load it and keep it around between invocations? PL/1, perhaps? Or COBOL (although I'm not a fan of COBOL and especially not for a string-handling routine)? What are my alternatives?
---
Loading...