regular expression



Support for C, C++, COBOL, PL/I, Fortran and assembler applications' runtime Environment LE.

regular expression

Postby zatlas1 » Mon Jun 25, 2012 10:17 pm

Is regular expression available through LE in z/OS?
Thanks
ZA
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: regular expression

Postby Robert Sample » Mon Jun 25, 2012 10:50 pm

The XL C/C++ Run-Time Library Reference manual indicates regular expressions can be compiled. Since this compiler is LE-compliant, that's probably as close as you can get.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: regular expression

Postby zatlas1 » Tue Jun 26, 2012 3:51 am

So if I understand correctly, there are no LE 'intrinsic' functions and if I want regexp in COBOL or REXX I have to code some C++ functions that would be callable (whatever that means) from COBOL or REXX?!
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: regular expression

Postby Robert Sample » Tue Jun 26, 2012 5:00 am

You've pretty much got it. The Language Environment Programming Reference manual has no references to regular expressions nor to regex -- which is a good indication that LE has nothing to process them.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: regular expression

Postby enrico-sorichetti » Tue Jun 26, 2012 7:06 pm

the problem is NOT LE related
Regular Expressions are not generally part of any vanilla environment
there are quite a few libraries who process them, You will have to ask You support to find and install one
( lurk around the PCRE stuff )

compiling regular expressions has nothing to do with the C compiler or the LE environment

in general You apply a regular expression to more than one string
( searching a file for some regexp , for example )
the original regular expression string is compiled ==> preprocessed
in a sequence of <statements> so that when a string is matched against the regexp
the process will be faster

to match for an integer
[0-9]+

the regexp processor mus use a loop to check each char for a digit
<compiling> the regexp will make things run faster
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: regular expression

Postby zatlas1 » Tue Jun 26, 2012 10:34 pm

Thanks
I was looking for doing Regexp in Rexx and eventually in good ol' COBOL because once one begins to do regular expressions in depth, PARSE and UNSTRING just do not cut it any more :)
My original idea was to port an existing library like RexxRe (http://www.interlog.com/ptjm/) or indeed, PCRE to native z/OS (LE is fine but I did not want to rely on USS) and thus enable z/OS Rexx to do regexp. Once I began to compile RexxRe (smaller and less intimidating then PCRE on first glance) in order to see what I have, I realized that the standard header libraries contain a regex.h and a deeper look into that one revealed that it derives from the same code family as RexxRe (I am not yet sure about the exact derivation relations.) Now, I'd rather use whatever is available on the system libraries instead of what comes with the external package, so I am exploring all available pieces on z/OS before introducing any external code.
BTW, please let me know if any such port is available as open source; If not and if I ever finish this project, I will put the result as open source myself.
ZA
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: regular expression

Postby enrico-sorichetti » Tue Jun 26, 2012 11:48 pm

If not and if I ever finish this project, I will put the result as open source myself.


I find that pretty unbelievable, even if told in good faith ;)

You are doing it on Your employer' s equipment and on Your employer' s time,
so most probably the IP ( Intellectual Property ) of the things You develop will belong to Your employer!

there are quite a few solutions depending on Your requirements
look for example at
http://www.sillysot.com/mvs/
the example
http://www.sillysot.com/ftp/findrx.txt
invokes sed under the covers

or You might want to implement it as a REXX external function written in C
see compile() and friends starting from here
http://publib.boulder.ibm.com/infocente ... rcompl.htm
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: regular expression

Postby zatlas1 » Wed Jun 27, 2012 12:41 am

I am doing it neither on my employer time (working on it at nights and between projects), nor on my employer equipment (I use Fan Dezhi and a friend's rented IBM shared time). The source developed would belong to me and if I base it on a known open source, the only other person who might have ownership is the developer of the original code. I am not the only one who does open source in the world (including on Maiframes - see //www.cbttape.org) and I do not understand why it should be unbelivable.

I know about http://www.sillysot.com/mvs/ but I do not want to rely on USS.

I do intend to use the C API as you've mentioned (compile(), etc.), now that I know about that API
ZA
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time

Re: regular expression

Postby enrico-sorichetti » Wed Jun 27, 2012 7:27 pm

and I do not understand why it should be unbelivable.

because generally on these forums the questions are asked for business reasons
and my comment was based on that assumption.

but I see You did not appreciate my concern

quoting the Fan Dezhi system on these forums is out of place,
it uses against IBM license the ADCD package,
and these forums do NOT condone software piracy
( nor do the hercules developers )


The source developed would belong to me and if I base it on a known open source,

You should be concerned about the implications of the open source license under which THAT software was released
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3006
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 165 times

Re: regular expression

Postby zatlas1 » Thu Jun 28, 2012 1:18 am

Thank you Enrico
but I see You did not appreciate my concern

I misunderstood your concern!

I was not aware about the issue with Fan Dezhi. If that is indeed the case, I will remove all my stuff from there and cease to use it. But could you please give me any reference proving that the situation is as you present it. It is not that I do not believe you, but unauthorised use of software (piracy) is a very serious wrong and I hesitate to ascribe it to anybody. I also do software for living and would not want to be a victim of or partner in that behavior - unauthorized use.

However, I will continue to use the [absolutely legal] rented machine with full permission from my friend who is fully aware of my intent. So there would not be any IP issue.

The project is more complicated then what I've thought originally, so I need time to study the two possible code bases (RexxRe and PCRE) and either chose one of them as is, modify it, and/or create an appropriate wrapper. I contact the author of PCRE and he noted that there is (presumably) EBCDIC support of sort, but he did not know about any port to z/OS

ZA
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time

Next

Return to Language Environment