Is there a way to execute free Package statements using REXX?

324 views Asked by At

I am able to write a REXX code that generates FREE PACKAGE statements. After generation I use that file in a JCL to execute the FREE PACKAGE statements. Is there a way to execute the FREE PACKAGE statements directly via rexx? I tried executing it like a normal query in REXX, but it throws -104 error. I believe I should not try executing it like a query. Any help would be appreciated.

1

There are 1 answers

0
Patrick Bossman On BEST ANSWER

Since it appears you have SQL working with REXX, you could use SYSPROC.ADMIN_COMMAND_DSN to perform BIND/REBIND/FREE operations. You could call this from REXX.

Here is an example CALL I used via Db2 Command Line Processor to rebind all the packages in a collection: CALL SYSPROC.ADMIN_COMMAND_DSN ('REBIND PACKAGE (DSNESPCS..())',?) #

So you would replace the 'REBIND PACKAGE...' with your BIND/REBIND/FREE commands.

There are administrative procedures delivered with Db2 for z/OS enable you to run commands, and many other administrative operations: https://www.ibm.com/support/knowledgecenter/en/SSEPEK_12.0.0/sqlref/src/tpc/db2z_suppliedstoredprocedures.html

It's mentioned above not running on the same LPAR could be a challenge. An alternate approach if you need to run commands remotely would be to create Db2 for z/OS Native Rest Services for Db2 stored procedures. So another viable option would be creating a rest service on SYSPROC.ADMIN_COMMAND_DSN, pass in the bind parameter, and execute BIND/REBIND/FREE via REST API. Then you could run the commands remotely using Java, Python, Node, etc.