Rexx regualr expresison with rexxre

Ask/Clarify the questions on TSO, CLIST & REXX

Moderators: Veera, Moderator Group

Post Reply
simo78
Member
Posts: 35
Joined: Tue Aug 11, 2009 12:20 am
Location: Munich

Rexx regualr expresison with rexxre

Post by simo78 » Wed Aug 19, 2009 4:00 pm

Hello,

can someone tell me why this code doesn't work?

Code: Select all

/*rexx*/

rcc = rxfuncadd('reloadfuncs', 'rexxre', 'reloadfuncs')
if rcc then fail('load' rxfuncerrmsg())
call reloadfuncs


data = 'Apr 29 11:55:17 su: ptjm to root on /dev/ttyp2'
re = '[^:]+ ([0-9]{2}) : ([0-9]{2}) : ([0-9]{2}) +([^:]+): (.+)'
call reParse re, data, 'xs', 'hh', 'mi', 'ss', 'component', 'msg'
say "component" component
The variable component is empty.
Another question: what should I do to use regular expression on z/OS?

Thanks in advance.

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Wed Aug 19, 2009 5:15 pm

This is an IBM-supported REXX language?

simo78
Member
Posts: 35
Joined: Tue Aug 11, 2009 12:20 am
Location: Munich

Post by simo78 » Thu Aug 20, 2009 7:37 pm

I really don't know that.
I use rexxre on Windows with Regina REXX and for example the above code works good:

Code: Select all

somestring = ' Chemical:, "1,2-Dichlorobenzene Value","1,2-Dichlorobenzene QA Flag",,,1.2345,'

fieldre = '("[^"]*"|[^,"]*)'
  delimre = ' *, *'
  re = fieldre
  /* 6 is one less than the number of fields expected */
  do 6
    re = re || delimre || fieldre
    end
       
  /* reComp that if it will be used repeatedly ... */
  rere = reComp(re, 'x')

if left(rere,1) then say 'oh, poo'


  if reParse(rere, somestring, 'stx', 'FIELDS') then   
     say "NUMBER=" fields.6

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Thu Aug 20, 2009 8:26 pm

when you load functions in regina, the functions are available in the environment.
these functions (on your pc) are supported by code that you had to download and install on your pc and register.

don't believe that the functions that you have 'loaded' on the pc are available on the mf.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others