× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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) 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.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.