Page 1 of 1

Please have a look at PCRE for z/OS 8.33 V2

PostPosted: Mon Aug 12, 2013 7:09 am
by zatlas1
I've just announced in the C/C++ forum the availability of PCRE for z/OS 8.33 V2, but the real audience that should use this package is you, the COBOL programmers.

PCRE is a library that provides Perl Compatible Regular Expressions. This port allows all LE languages (COBOL, PL/I) to use regular expressions Perl style. This is a powerful and useful functionality.

The original library and the port are both Open Source and are published under the BSD license.

ZA

Re: Please have a look at PCRE for z/OS 8.33 V2

PostPosted: Wed Aug 14, 2013 10:26 am
by zatlas1
To illustrate what it could do, let's say you want to find in a source library all programs that have an IF statement associated with ACCOUNT-RECIEVABLE. Doing 3.14 won't work, because if you concentrate on the string ACCOUNTS-RECIEVABLE, you won't find the IF and vice versa. Solution:

// EXEC PGM=PCREGREP,PARM='/\\bIF\\b.*ACCOUNTS-RECIEVABLE PDSNAME'

This will find easily:
IF A > ACCOUNTS-RECIEVABLE
IF ACCOUNTS-RECIEVABLE < B
IF WS-SOMETHING = 5 AND (WS-SOMETHINGELSE < 5 OR ACCOUNTS-RECIEVABLE = 0)

Now try to do that with 3.14

ZA

Re: Please have a look at PCRE for z/OS 8.33 V2

PostPosted: Wed Aug 14, 2013 3:25 pm
by prino
Sorry, Ze'ev, but the above (simple multiple word) search can be done using 3.13:

//PRINOSUP JOB (PRINO),'SUPERC/SEARCH-FOR',
//             CLASS=A,
//             MSGCLASS=H,MSGLEVEL=(2,0),
//             NOTIFY=&SYSUID
//SEARCH  EXEC PGM=ISRSUPC,
//            PARM=(SRCHCMP,
//            'SEQ CKPACKL ANYC NOPRTCC')
//NEWDD  DD DSN=PRINO.RAHP.VEXT,
//          DISP=SHR
//OUTDD  DD SYSOUT=H
//SYSIN  DD *
SRCHFOR  'TAXI'
SRCHFORC 'GB'
SELECT TR001,TR002,TR003,TR004,TR005,TR006,TR007,TR008

The key is the use of the "SRCHFORC" keyword.

Of course I'm sure you can easily come up with something that cannot be done with SuperC's SRCHFOR :mrgreen:

Re: Please have a look at PCRE for z/OS 8.33 V2

PostPosted: Wed Aug 14, 2013 3:36 pm
by zatlas1
OK, I over simplified, but then I came up with a realistic example.
My point was to show the power of regular expressions which are now available to COBOL users, as well as in grep like utility on PDS.
ZA