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
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!