|
Hi Danny,dim(1);
That is exactly what I am faced with. regcomp() works, but regexec()
fails and I still have no idea why.
Thomas.
Am 07.02.2018 um 13:50 schrieb Danny Rodius:
Hi Thomas,
thanks for this info.
Have included this and now the regcomp is working, but still the
regexec is not working.
We the program with a valid ordernbr and still the regexex returns a 1.
Program source as attachment
Any other ideas.
Already copied a number of examples but none of them seems to work.
Is there something special about this That I'm overlooking?
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Tools/400
Sent: dinsdag 6 februari 2018 22:43
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: regcomp/regexec problem
It is correct that LOCALETYPE is specific to C/CPP. I assume that I
actually wanted to add the following URL, which describes the usage
of
setLocale():
http://www-01.ibm.com/support/docview.wss?uid=nas8N1012446
Thomas.
Am 06.02.2018 um 11:53 schrieb Danny Rodius:
Hi all,
Taken some of your remarks into account and this is the followup:
To Carsten,
Have checked this locale stuff and settings QLOCALE =
/QSYS.LIB/EN_BE.LOCALE Job CCSID = 1148 Seems a valid combination.
To David,
Like to follow the regcomp/regexec path instead of the SQL.
But have tried your expression and got now a return code 11. Even
with the extended flag on.
To Thomas,
Maybe I'm missing something but LOCALETYPE(...) seems only to exist
on the compiler command for C/CPP.
General, I'm still searching
Any other ideas
BR+
Danny
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Flensburg, Carsten
Sent: maandag 5 februari 2018 15:04
To: RPG programming on the IBM i (AS/400 and iSeries)
<rpg400-l@xxxxxxxxxxxx>
Subject: RE: regcomp/regexec problem
Hi Danny,
A possible explanation can be found here (regcomp() and regexec()
functions are Locale Sensitive):
http://www-01.ibm.com/support/docview.wss?uid=nas8N1010877
Cheers,
Carsten
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Danny Rodius
Sent: 5. februar 2018 11:42
To: rpg400-l@xxxxxxxxxxxx
Subject: regcomp/regexec problem
Hi,
Want to validate a field with the regular expression support.
Took a look at the example in "Who Knew You Could Do That with RPG IV"
redbook and wrote the following code:
ctl-opt main(main) dftactgrp(*no);
/copy cregexpr
dcl-proc main;
dcl-pi main extpgm('STL9120P');
PxOrderNbr char(8);
PxOK char(1);
end-pi;
dcl-s RegPattern varchar(50);
dcl-ds preg likeds(C_regex_t);
dcl-ds pmatch likeds(C_regmatch_t)
equal).
dcl-s rc int(10) inz(9);
dcl-s cflags int(10);
cflags = REG_EXTENDED + REG_ICASE;
RegPattern = '^[A-Z0-9-_]$';
rc = regcomp(preg: RegPattern: cflags);
if ( rc = 0);
rc = regexec( preg: %trim(PxOrderNbr): %elem(pmatch): pmatch:
0);
PxOK = %char(rc);
endif;
regfree(preg);
return;
end-proc;
When calling with first parm = '12345678' it return allways 1 (not
questions.failed?
The regexec seems not to work. So what I'm doing wrong, where I have
questions.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related
Help support midrange.com by shopping at amazon.com with ourlink:
affiliate
http://amzn.to/2dEadiD--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email:
RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related
link:
Help support midrange.com by shopping at amazon.com with our affiliate
http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.