On my z/OS 1.12 system (I'm the senior z/OS sysprog), perl in is /usr/lpp/perl/bin. This is where the CBPDO placed it. Perhaps you have this, but just not on your PATH?
-- John McKown Systems Engineer IV IT Administrative Services Group HealthMarkets(r) 9151 Boulevard 26 * N. Richland Hills * TX 76010 (817) 255-3225 phone * [email protected] * www.HealthMarkets.com Confidentiality Notice: This e-mail message may contain confidential or proprietary information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. HealthMarkets(r) is the brand name for products underwritten and issued by the insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance Company(r), Mid-West National Life Insurance Company of TennesseeSM and The MEGA Life and Health Insurance Company.SM > -----Original Message----- > From: IBM Mainframe Discussion List > [mailto:[email protected]] On Behalf Of Ken MacKenzie > Sent: Monday, February 06, 2012 9:48 AM > To: [email protected] > Subject: Re: Regular Expressions (OMVS) > > :-( > > Xxxxxxx:/u/xxxxxxx: >perl -np -e 's/CD.*?QR/junkt/' fxdata > perl: FSUM7351 not found > Xxxxxxx:/u/xxxxxxx: > > > > > > From: > "McKown, John" <[email protected]> > To: > [email protected] > Date: > 06/02/2012 15:44 > Subject: > Re: Regular Expressions (OMVS) > Sent by: > IBM Mainframe Discussion List <[email protected]> > > > > Remember that a regex, by default, is "greedy". IOW, it > matches as much as > is possible. So with the "CD.*QR" pattern, you match from the > first CD > until the __last__ QR it can find. Not the first QR it can > find. You would > need the "non greedy" regex "CD.*?QR" . However, it is > unfortunate that > IBM, in its POSIX-inspired blindness, does not implement "non greedy" > regular expressions. I can't get this to work in either awk > or sed. But, > if you have the Ported Tools available, then you have a older > version of > perl. It can do what you want. > > example: > $cat test.txt > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > $perl -np -e 's/CD.*?QR/junkt/' test.txt > QQQQABjunktXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > QQQQABjunktXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > QQQQABjunktXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > QQQQABjunktXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > QQQQABjunktXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > QQQQABjunktXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > > Where the leading "$" is my shell prompt character. > > I crossposted this replay to MVS-OE for their viewing pleasure. <grin> > > -- > John McKown > Systems Engineer IV > IT > > Administrative Services Group > > HealthMarkets(r) > > 9151 Boulevard 26 * N. Richland Hills * TX 76010 > (817) 255-3225 phone * > [email protected] * www.HealthMarkets.com > > Confidentiality Notice: This e-mail message may contain > confidential or > proprietary information. If you are not the intended > recipient, please > contact the sender by reply e-mail and destroy all copies of > the original > message. HealthMarkets(r) is the brand name for products > underwritten and > issued by the insurance subsidiaries of HealthMarkets, Inc. -The > Chesapeake Life Insurance Company(r), Mid-West National Life > Insurance > Company of TennesseeSM and The MEGA Life and Health Insurance > Company.SM > > > > > -----Original Message----- > > From: IBM Mainframe Discussion List > > [mailto:[email protected]] On Behalf Of Ken MacKenzie > > Sent: Monday, February 06, 2012 8:44 AM > > To: [email protected] > > Subject: Regular Expressions (OMVS) > > > > Hi All, > > > > I'm not sure if this is the appropriate forum, please point > > me to the correct one if it's not. > > > > I'm playing around with regular expressions and I want to > > achieve the following. I spoke to a Unix geek but he didn't > > really understand what I was asking. > > > > Given the following sample data, I want discover only the > > first occurrence of any string which matches my regexp. > > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > > QQQQABCDEFGNOPQRXXXPPPPABCDEFGNOPQRYYYOOOOABCDEFGNOPQRZZZ > > > > I tried: awk 'sub(/CD.*QR/,"junkt")' fxdata in an attempt to > > change QQQQABCDEFGNOPQRXXX to QQQQABjunktXXX but instead, it > > takes the final occurrence of QR, and returns QQQQABjunktZZZ. > > Notice the ZZZ on the end instead of XXX. > > > > This is being driven from a REXX exec in ISPF, if any of the > > above is not clear, I will try to explain further. > > > > > ---------------------------------------------------------------------- > > For IBM-MAIN subscribe / signoff / archive access instructions, > > send email to [email protected] with the message: INFO IBM-MAIN > > > > > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN

