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) dim(1);
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 equal).
The regexec seems not to work. So what I'm doing wrong, where I have failed?
--
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 questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.