How to use API’s?

10 pts.
Tags:
API
REGCOMP
REGEXEC
REGFREE
RPGLE
I'm trying to use the regular expressions API's REGCOMP(), REGEXEC(), and REGFREE(). My text says handle them like a procedure, article seems missing info. Error examples are Prototyped call can't be used in an expression because it doesn't return a value, Types/Attributes of parm don't match the prototype, Parameter can't be passed by reference, etc. Need an example that covers all the bases. These are the lines in error: D REGCOMP         PR                  ExtPgm('REGCOMP')       D                               30a                           D                             3000    Const OPTIONS(*VARSIZE) D                               12a                                                                                         D  Reg                          30a                           D  Expr                       3000    Varying                 D  Flag                         12a                                                                                         D REGEXEC         PR                  Extpgm('REGEXEC')       D                               30a                           D                               50a                           D                                1S 0 Value                   D                               50a                           D                                1S 0 Value   D ParmE1                        30a                    D ParmE2                        50a                    D ParmE3                         1S 0                  D ParmE4                        50a                    D ParmE5                         1S 0                  D                                                      D REGFREE         PR                  Extpgm('REGFREE') D                               50a                    D                                                     

D ParmF1                        50a                                    

/free                                                                  rc = REGCOMP(myREG : regexpression : REG_EXTENDED);      if (rc = 0);                                               rc = REGEXEC(myREG : afpart : 1 : myMatch: 1);         endif;                                                    REGFREE(myREG);                                    /end-free                                              

  Thanks for your help.



Software/Hardware used:
RPGLE, /free, V6R1

Answer Wiki

Thanks. We'll let you know when a new response is added.

see article by Bob Cozzi <a href=”http://systeminetwork.com/node/26454″>Regular Expressions Revisited</a>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following