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



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

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

Postby zatlas1 » Mon Aug 12, 2013 7:09 am

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
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time

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

 

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

Postby zatlas1 » Wed Aug 14, 2013 10:26 am

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
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby prino » Wed Aug 14, 2013 3:25 pm

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:
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 536
Joined: Wed Mar 11, 2009 12:22 am
Location: Oostende, Belgium
Has thanked: 3 times
Been thanked: 21 times

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

Postby zatlas1 » Wed Aug 14, 2013 3:36 pm

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
zatlas1
 
Posts: 61
Joined: Mon Mar 15, 2010 9:19 am
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post