Results 1 to 9 of 9

Thread: Using Regular Expressions (regex) in a BSFN

  1. #1
    Senior Member
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas
    Posts
    1,534

    Using Regular Expressions (regex) in a BSFN

    Anyone ever use regular expressions in a BSFN?

    I found the header file uregex.h (and the libs/dll) in ..system\includev\unicode but it doesn't appear to be referenced by jde.h and ..system\includev\unicode doesn't appear to be listed as a header file directory by busbuild and it it doesn't include the libs file when linking. I can work around both of those (dynamic linking, etc.). I am just wondering if JDE has somehow exposed this (or different) regex library some other way.
    Brian Oster
    Application Development Manager
    E1: 9.0 (TR9.1.5.1) / 9.2 (TR9.2.2.2)
    JAS/BSSV: Weblogic 12.1.2 / Weblogic 12.2
    ES: Win2008 / Win2016
    DB: MSSQL 2014 / 2016
    WebDev Client: Win7Pro / Win10Pro

  2. #2
    Member
    Join Date
    Mar 2002
    Location
    Minneapolis, MN
    Posts
    778
    Hey Brian,
    Never used any of that stuff in that folder. However, you should be able to avoid the hassle of dynamic linking by using something like the following:

    #pragma comment( lib, "icui18n" )

    You may have to qualify the library name with a path if the libv32 folder is not part of the library path in BUSBUILD (probably similar to what you needed to do when you #included uregex.h).
    Jeremy
    E1 Consultant
    Minneapolis, MN

  3. #3
    Senior Member
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas
    Posts
    1,534
    Jeremy, Good suggestion. Following works (at least on local web dev) - quickly tested by compiling some code that declared a variable and called uregex_close. Compiled and linked.

    Code:
    #include "../includev/unicode/uregex.h"
    #ifdef _MSC_VER
    	#pragma comment(lib, "icui18n")
    #endif
    No relative path needed for the library for some reason, but I needed it for the #include to the header file.

    Only downside might be if we move to Linux (which is a possibility). There doesn't appear to be an equivalent for GCC. But I guess we have more control over compiler and linker options on the Enterprise Server so we could specify this in the ES jde.ini???
    Brian Oster
    Application Development Manager
    E1: 9.0 (TR9.1.5.1) / 9.2 (TR9.2.2.2)
    JAS/BSSV: Weblogic 12.1.2 / Weblogic 12.2
    ES: Win2008 / Win2016
    DB: MSSQL 2014 / 2016
    WebDev Client: Win7Pro / Win10Pro

  4. #4
    Member
    Join Date
    Mar 2002
    Location
    Minneapolis, MN
    Posts
    778
    I'm not exactly sure where busbuild gets its INCLUDE and LIB paths from when functions are built.

    It may be worth a test to see if the jde.ini (JDE_CG section) is the ticket. It makes sense just by eyeballing it as the libv32 folder is present:

    INCLUDES=$(COMP)\VC\include;$(SYSTEM)\include;$(SY STEM)\cg;$(APP)\include;$(SYSTEM)\includev
    LIBS=$(COMP)\VC\lib;$(SYSTEM)\lib32;$(APP)\lib32;$ (SYSTEM)\libv32


    You could add a $(SYSTEM)\includev\unicode to yours and see if the build works without the relative path qualifier on your #include.
    Jeremy
    E1 Consultant
    Minneapolis, MN

  5. #5
    Senior Member
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas
    Posts
    1,534
    Old thread but this project is finally moving into testing and I have now encountered another problem.

    The code in the previous posts works fine locally (compiles, links, executes). However, when doing a FULL build on the Enterprise server the build ends in error. It appears there is an error during the link process.

    Mon Apr 18 19:08:45 - Executing: 'link @link_cmd >> CCUST.log'.
    Mon Apr 18 19:08:46 - builddll.c:2373 BUILDDLL0082 ERROR: Exiting DoTheLink with failure

    When we do an update package we don't get error but I did notice that ccust.dll is NOT in the bin32 directory in the package folder. We are not deploying at this point, just trying to troubleshoot the build process.

    The library I am trying to link to is ..\system\lib32v\icui18n.lib

    This is what is on the enterprise server in the jde.ini:

    [JDE_CG]
    LIBS=...;$(SYSTEM)\LIB32;$(SYSTEM)\LIBV32;$(APP)\L IB32
    ...

    [BSFN BUILD]
    ...
    LinkLibraries=jdekrnl.lib jdel.lib jdenet.lib jdeipc.lib owver.lib jdeunicode.lib v_verify.lib xerceswrapper.lib xmlpublisher.lib

    [SVR]
    ...
    LibVPath=libv32


    Do I simply add the icui18n.lib library to the list in LinkLibraries in the jde.ini on the ES server? Any ideas?
    Last edited by BOster; 04-21-2016 at 02:25 PM.
    Brian Oster
    Application Development Manager
    E1: 9.0 (TR9.1.5.1) / 9.2 (TR9.2.2.2)
    JAS/BSSV: Weblogic 12.1.2 / Weblogic 12.2
    ES: Win2008 / Win2016
    DB: MSSQL 2014 / 2016
    WebDev Client: Win7Pro / Win10Pro

  6. #6
    Brian,

    The libv32 folder exists only in the system folder. The lib32 folder in the package only has the libraries for the business functions (i..e no system libraries). Review the .sts and .txt files for errors. Hopefully, it will tell you which function was "unlinkable".
    Regards,

    Hari Sharma
    Aellius
    EnterpriseOne: Integration (.Net, Web Services) | Output Management | Monitoring

  7. #7
    Senior Member
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas
    Posts
    1,534
    Thanks for the info on the libv32 folder. I saw the lib32 folder and incorrectly assumed it was some sort of copy from the system directory (guess I should actually look at the contents before posting). Edit my post to take that stuff out.
    Brian Oster
    Application Development Manager
    E1: 9.0 (TR9.1.5.1) / 9.2 (TR9.2.2.2)
    JAS/BSSV: Weblogic 12.1.2 / Weblogic 12.2
    ES: Win2008 / Win2016
    DB: MSSQL 2014 / 2016
    WebDev Client: Win7Pro / Win10Pro

  8. #8
    Hi Brian,

    resurrecting this old thread to see if you ever managed to get this working?


    To extend a bit on the information shared in this thread so far:
    1. The linker does receive the instruction to use "/DEFAULTLIB:icui18n" from the #pragma, but either cannot find or open the file icui18n.lib, as indicated by the following error message:
      LINK : fatal error LNK1104: cannot open file 'icui18n.lib'
      (The linker log can be found in the "BuildArea", under <PackageName>\obj\CCUSTOM ).
    2. Both the include path to the header file (uregex.h) and the library path to the library file (icui18n.lib) are part of the default configuration in JDE.ini.
    Flurin Rupp
    Consulting Software Engineer

    E1: 9.2 (TR9.2.2.4)
    JAS/BSSV: Weblogic 12.1.3.0.0
    ES: Win2012 R2
    DB: MSSQL 2014
    WebDev Client: Win2012 R2 (virtual)

  9. #9

    Lightbulb How I got it working

    Building on this thread's inputs I managed to build a BSFN to use RegEx within JDE - thanks for Jeremy and Brian for setting the foundation!

    I wanted to briefly share what I did to provide a starting point for others seeking such functionality.

    Following are the core parts of the BSFN written as a proof of concept:

    Header
    Code:
    #include "unicode/uregex.h"
    
    
    #ifdef _MSC_VER
    #pragma comment(lib, "../libv32/icui18n.lib")
    #endif
    Source
    This code can be used to extract a particular grouped match. Calling with nGroupNumber=0 will return the entire match, nGroupNumber=1 will return the first group, and so forth.
    Code:
        /************************************************************************ 
        *  Variable declarations 
        ************************************************************************/ 
        URegularExpression*     uRegEx  = (URegularExpression*) NULL;
        UParseError             pe      = { 0 };
        UErrorCode              status  = 0;
        UChar                   matching_string[31] = { 0 };
     
       /************************************************************************ 
        * Main Processing 
        ************************************************************************/ 
       if ((!IsStringNull(lpDS->szSearchText) || !IsStringNull(lpDS->szRegEx))
           && !IsStringBlank(lpDS->szRegEx))
       {
           /* compile regex */
           uRegEx = uregex_open((const UChar*)lpDS->szRegEx,
               -1,
               0,
               &pe,
               &status);
    
    
           /* load text */
           uregex_setText(uRegEx,
               (const UChar*)lpDS->szSearchText,
               -1,
               &status);
    
    
           /* find match */
           if (uregex_find(uRegEx, -1, &status))
           {
               /* extract matching group */
               uregex_group(uRegEx,
                   lpDS->nGroupNumber,
                   matching_string,
                   30,
                   &status);
    
    
               jdeStrncpy(lpDS->szResult, (JCHAR*)matching_string, DIM(lpDS->szResult) - 1);
           }
           else
           {
               jdeStrcpy(lpDS->szResult, _J("NO MATCH"));
           }
       }
       
    
    
       /************************************************************************ 
        * Function Clean Up 
        ************************************************************************/ 
       if (uRegEx != (URegularExpression*)NULL)
       {
           uregex_close(uRegEx);
       }

    NOTES:
    • UChar corresponds to JCHAR - they (currently) both map to wchar_t
    • It appears that the linker doesn't get the path to "$(SYSTEM)\LIBV32", as defined in JDE.INI. Maybe it can't resolve the variable $(SYSTEM) or the paths are not set in the environment used by the linker. The workaround works because the path to the lib32 is explicitly passed to the linker and libv32 is located in the same folder.
    • This approach only works for Windows environments, as the "#pragma comment(lib, xxx)" is specific to the Visual Studio toolchain. For other environments you will likely have to change the JDE.INI to tell the linker about the library "icui18n" (e.g. via LinkLibraries ) and where to find it.
    • uregex.h is a C Wrapper to a C++ library. The functions are documented within the header file. For more information on the library/regex: http://userguide.icu-project.org/strings/regexp


    Hope this helps!
    Flurin Rupp
    Consulting Software Engineer

    E1: 9.2 (TR9.2.2.4)
    JAS/BSSV: Weblogic 12.1.3.0.0
    ES: Win2012 R2
    DB: MSSQL 2014
    WebDev Client: Win2012 R2 (virtual)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
The legal restrictions and terms of use applicable to this site are available here.
Use of this site signifies your agreement to the terms of use.
JDELIST is NOT affiliated with JD Edwards® & Company, Oracle or Peoplesoft. Contents of this site are neither endorsed nor approved by JD Edwards® & Company and, or Oracle.