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


  • Subject: RE: regcomp/regexec problem
  • From: "Danny Rodius" <danny.rodius@xxxxxxxxx>
  • Date: Tue, 6 Feb 2018 11:53:03 +0100
  • Ironport-phdr: 9a23:bjZPwxHlKu2huYVi+y3zC51GYnF86YWxBRYc798ds5kLTJ7yosuwAkXT6L1XgUPTWs2DsrQY07OQ6/iocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmCexbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjDQhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VjO/4ad2Ux/okDkIOCIl8G/ZjcxwibhUoBOnpxdix4LZb4WYOP94c6jAf90VWHBBU95RWSJfDIOzbZYBAeQCM+lXs4bzqFwArQelCAmwBu7vxSNEimHq0aEk1ekqDAHI3BYnH9ILqHnYotv7O70UUeCzzKjD0CnNb/RL1jf89YjIaR4tquyLUL1ta8XRz08vFgPfglWKrozqIjKV1vkWs2WA9OpgVuKui2g5pAFtuDSg3dkjh5DPi4kIxF7E8iB5z5w0Jd2+UEN7ZN+kH4ZKty6AMYt2Td0tT3t0tyY9z70KoYS0fC0Qx5UmwB7fbeaLfJSP4hLmTOqRICx3hHd/dL2jgBay9FCsxff5Vsi11lZGtDZFkt7Ku3sQ1BLT8tCKRuZ580quwzqC1QPe5vtZLU00lqfXMZEsz7gtnZQJq0vDBDX5mEDuga+TcUUr5/an5vz8YrXjup+cL4h0ihziMqg2msywH+A4Mg8WUmaV4+u80rvj/E3jTrhUlvE2k6/Zv47GJckDu6K0BwBY3pwh5hu8FTuqzdQVkHodIF9KYB6HipLmO1DKIPD2F/e/hFGsnS92yP/cOL3hBJXMImLZkLfmYLl96lNcyBEowNBE5JJVCrcBL+zvWkPrr9PXEAc1MxaozOb/FNV9yoQeVHqVAq+BP6PfvkOE6v42L+mIf4IVvTf9JOU/5/H0i385lkEScbO10psQbXDrVslgOFiTNHrwns8aQyBNugslUPesjVyOSzdVaHv0VKU5oTQyCYajBIGEQoG2nL2H0iD8BIVZOjgeT1TfLXC9Pcq+Y9hEcDiVLdVolzkFU7fpTIlpyRGj/C7Q7vJmZt6U0xZf6cq7nNFz66XSrhwo9DFvO4XSmSnZVXl7wjtQAjse2aFzu0V7xVrF2q991a92D9tWsrllWwE8JNbmyOB7Fsu4ElbNd9GPWRC8RdmnHCoZVdEgxdISJUxwTYbxxivf1janVudG34eAA4Y5p/6N0g==
  • List-archive: <https://archive.midrange.com/rpg400-l/>
  • List-help: <mailto:rpg400-l-request@midrange.com?subject=help>
  • List-id: "RPG programming on the IBM i \(AS/400 and iSeries\)" <rpg400-l.midrange.com>
  • List-post: <mailto:rpg400-l@midrange.com>
  • List-subscribe: <https://lists.midrange.com/mailman/listinfo/rpg400-l>, <mailto:rpg400-l-request@midrange.com?subject=subscribe>
  • List-unsubscribe: <https://lists.midrange.com/mailman/options/rpg400-l>, <mailto:rpg400-l-request@midrange.com?subject=unsubscribe>

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.