I need to write a function in REXX that can be called from a CLIST. On
the surface, no problem, except, according to the manuals, I can pass
back numeric return codes, but I need to pass a variable length string.
Has anyone ever done anything like this?
I have modified the CLIST to invoke the REXX routine, but I cannot come
up with a simple way to return the string from the REXX routine.
I have considered using ISPEXEC VPUT/VGET, but I cannot guarantee that
ISPF will be active when the CLIST/REXX combination runs. (It can run
under interactive TSO as well as batch TSO and I don't control the
ultimate execution environment.)
I've also considered something like:
CLIST calls REXX.
REXX does it's thing and prior to returning, break the return string
into 7 character chunks and create a dataset name, appending an alpha
character in front of each segment, then allocate the DSN using VIO.
In the CLIST, retrieve the DSN from the allocated file and then free the
file.
The CLIST can then reconstitute the return value from the DSN.
This, to me, is awkward at best, so I was hoping that someone may have
already "invented" a methodology.
Please, before you ask the whys and wherefores, this is a given and I
have no choice, so if anyone can help, many thanks.
Chuck
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX
Are you using the SAY verb in your REXX program? If not then use
&SYSOUTTRAP and &SYSOUTLINE like:
PROC 0
SET &SYSOUTTRAP=10
%REXXPROG
SET B=&SYSOUTLINE
SET &SYSOUTTRAP=0
WRITE &SYSOUTLINE1
/* rexx */
SAY REXXPROG
Be sure to set &SYSOUTTRAP large enough to trap all the lines being sent
back via the SAY verb.
Ref:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4B840/5.9
--
John McKown
Senior Systems Programmer
HealthMarkets
Keeping the Promise of Affordable Coverage
Administrative Services Group
Information Technology
The information contained in this e-mail message may be privileged
and/or confidential. It is for intended addressee(s) only. If you are
not the intended recipient, you are hereby notified that any disclosure,
reproduction, distribution or other use of this communication is
strictly prohibited and could, in certain circumstances, be a criminal
offense. If you have received this e-mail in error, please notify the
sender by reply and delete this message without copying or disclosing
it.
> REXX does it's thing and prior to returning, break the return string
> into 7 character chunks and create a dataset name, appending an alpha
> character in front of each segment, then allocate the DSN using VIO.
Ugh! That would only let you pass back strings of about 38 characters
maximum, and they'd have to be valid in dsnames, not spaces etc. And chances
are you'd accidentally create a dsname you're not permitted access to by
your security software.
I'd have the caller allocate a VIO file and pass its ddname to the rexx exec
which could then write result data to the file. On return the clist could
read and then delete the VIO file.
The outtrap solution that someone else suggested might not work if the data
being passed back is longer than the "terminal window width" and/or if the
data contains non-printable characters.
An advantage of using a (VIO) file as suggested is that if you have to debug
the whole process you can (with ispf) browse that file when it is returned
to the caller, easily.
--
Jeremy C B Nicoll - my opinions are my own.
/* If the pattern has wildcards, make them match */
pa=pos('*',haystack)
do while pa>0
needle=overlay('*',needle,pa)
pa=pos('*',haystack,pa+1); end
if abbrev(needle,haystack) then do
fmch.haystack=1 /* mark this as a match */
leave; end /* look no further */
So here's my question: Is there a faster way to overlay the asterisks from
the pattern to the other string? Am I overlooking something I can do with
TRANSLATE or VERIFY or something?
And just in case I'm missing a broader opportunity, if anyone sees a better
way to handle wildcard matching feel free to expound on that too.
---
Bob Bridges, rhb...@attglobal.net, cell 336 382-7313
Robert...@westfieldgrp.com, 330 791-6576
/* A leisure class exists at both ends of the economic spectrum. */
> Date: Fri, 7 Sep 2007 00:07:08 -0400
>
> I've written a utility for ACF2 that works pretty well, but I'm looking
> suspiciously at one part of my logic and wondering whether there's a more
> efficient way to do it. The overall purpose is to look for the appearance
> of any of a number of character strings -- call them "needles" -- in a
> haystack of pattern strings that may include wildcards. What I have at
>
Sounds like a classic regular expression problem. Someone should
write a regex function package for Rexx. Of course, the hard
part for the user is converting a collection of patterns to a
regular expression.
-- gil
--
StorageTek
INFORMATION made POWERFUL
The ISPF edit "FIND" and "CHANGE" commands are very good at pattern
matching. When an equals sign is used in a picture string it means "any
character"; e.g. FIND P'ABC==XYZ' would find 'ABCDEXYZ' and 'ABC12XYZ' and
'ABCGGXYZ' (and so on). This means you could put some or all of your REXX
code in an edit macro and in addition to the power of REXX you'd then have
all the power of the editor as well. For example, you could FIND ALL, CHANGE
ALL, SORT, EXCLUDE, DELETE (etc), and do it much more easily and efficiently
than processing individual records using EXECIO (or whatever).
HTH,
Dave Salt
See the new SimpList(tm) rollover image at:
http://www.mackinney.com/products/SIM/simplist.htm
_________________________________________________________________
Share More On Messenger with a Windows Live Space
http://spaces.live.com/?mkt=en-ca
>The overall purpose is to look for the appearance
>of any of a number of character strings -- call them
>"needles" -- in a
>haystack of pattern strings that may include
>wildcards. What I have at
>this point in my program is a single pattern from the
>haystack and a single
>character string from the needle list, and I must
>determine whether they
>match. An asterisk in the pattern is a single-position
>wild card, and to
>count as a match the two strings need be identical only to
>the pattern's
>length. So, for example, the pattern "AP***55" matches
>"APUSR55STC" and
>"APPRD55SYS" but not "ATUSR92BND".
<snip>
>And just in case I'm missing a broader opportunity, if
>anyone sees a better
>way to handle wildcard matching feel free to expound on
>that too.
There was a lot of discussion about wildcard matching
in January 2005. Search for subject "Wildcard Compare".
For your purposes, the best solution might be based
on Roy Gardiner's code. Here's my attempt at meshing your
problem with his solution. It hasn't been tested.
Done once at initialization time:
star = '*'
starno = c2d(star)
hzero = d2c(0)
ff = d2c(255)
tblout = copies(ff,256)
tblout = overlay(hzero,tblout,starno+1)
In your loop:
pattern = translate(needle,tblout)
needlep = bitand(needle,pattern)
haystackp = bitand(haystack,pattern)
if abbrev(needlep,haystack) then /* we've got a match */
Basically, PATTERN is all x'ff', except that it's
x'00' wherever NEEDLE has an asterisk. The BITANDs make
those star positions x'00', but leave everything else the
same.
Roy's message was:
Message-ID:
<43C11A8EF6EED51192F1...@rlgoodtacx6.server.rbsgrp.net>
(Note: Sent to list and directly to Bob. I've seen a
number of my attempts to post to the list just disappear.)
--
I cannot receive mail at the address this was sent from.
To reply directly, send to ar23hur "at" intergate "dot" com
All the C code is available freely from the Unix world. One would have
to of course create the Rexx to the C code interfaces. Would there be
any, a lot, or just a few EBCDIC problems?
Sounds like a fun project!
Lindy
> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On
Behalf
> Of Paul Gilmartin
> Sent: 7. syyskuuta 2007 7:39
> To: TSO-...@VM.MARIST.EDU
> Date: Fri, 7 Sep 2007 12:24:53 +0200
>
> All the C code is available freely from the Unix world. One would have
> to of course create the Rexx to the C code interfaces. Would there be
> any, a lot, or just a few EBCDIC problems?
>
I believe GNU grep has been ported to z/OS (and even works on
Classic data sets). So someone has solved that EBCDIC problem
in open source.
> Sounds like a fun project!
>
My fun project was to write an Edit macro that filters the
content of the Edit buffer through a POSIX pipe. So, with
the haystack in my edit buffer, I might do:
PUTPIPE grep "needle" | tee /tmp/whatever
z/OS 1.9 is reported to have improved support for UNIX files,
so I might then be able to COPY /tmp/whatever back into the
edit buffer.
> > -----Original Message-----
> > From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On
> Behalf
> > Of Paul Gilmartin
> > Sent: 7. syyskuuta 2007 7:39
> >
> > Sounds like a classic regular expression problem. Someone should
-- gil
SCRN350_&LYYMMDD
EZACFSM will change it to
SCRN350_070907
On SYSOUT
For example... You can also insert times and other data into the code in
SYSIN and the &L stuff will be interpreted based on a parmlib mbr.
Bobh
-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of Jeremy Nicoll - lstsrvs
Sent: Thursday, September 06, 2007 4:49 PM
To: TSO-...@VM.MARIST.EDU
>I've written a utility for ACF2 that works pretty well, but I'm looking
>suspiciously at one part of my logic and wondering whether there's a more
>efficient way to do it. The overall purpose is to look for the appearance
>of any of a number of character strings -- call them "needles" -- in a
>haystack of pattern strings that may include wildcards. What I have at
>this point in my program is a single pattern from the haystack and a single
>character string from the needle list, and I must determine whether they
>match. An asterisk in the pattern is a single-position wild card, and to
>count as a match the two strings need be identical only to the pattern's
>length. So, for example, the pattern "AP***55" matches "APUSR55STC" and
>"APPRD55SYS" but not "ATUSR92BND". The following logic first copies all
>the wildcard asterisks from my pattern over the needle string, then checks
>for a match:
>
> /* If the pattern has wildcards, make them match */
> pa=pos('*',haystack)
> do while pa>0
> needle=overlay('*',needle,pa)
> pa=pos('*',haystack,pa+1); end
>
> if abbrev(needle,haystack) then do
> fmch.haystack=1 /* mark this as a match */
> leave; end /* look no further */
>
>So here's my question: Is there a faster way to overlay the asterisks from
>the pattern to the other string? Am I overlooking something I can do with
>TRANSLATE or VERIFY or something?
Example:
memmask = Strip(memmask,"T","*")"*"
maskl = Length(memmask)
lomask = Translate(memmask, '00'x , "*")
himask = Translate(memmask, 'FF'x , "*")
do Words(mbrlist) /* each membername */
parse var mbrlist mbr mbrlist
if BitAnd(himask,Left(mbr,maskl)) = ,
BitOr(lomask,Left(mbr,maskl)) then,
mbrlist = mbrlist mbr
end /* words */
Translate all the *s to '00'x to form the "lomask". Translate all the *s to
'FF'x to form the "himask". When BITAND with the himask equals the BITOR with
the lomask, the strings match.
(change Arabic number to Roman numeral to email)