Quick CL Actions using Run SQL Scripts in IBM i ACS

Recently I was working with IBM support troubleshooting an issue with a few system tables/catalogs producing errors. They gave me a list of commands to execute on the system and rather than create a CL, compile it, and execute the program I decided to use Run SQL Scripts. One thing I really like about going this route is that you can save the “script” as a .sql file and you can develop a repository of files to use across different system or environments without having to create a save file and save/restore the objects. With the introduction of 1.1.8.3 you can very easier create your own examples as well. So what does this look like and how do I use it?

  1. Open Run SQL Scripts for the IBM i Java ACS client (if you haven’t installed this yet you should. Use this link for help)
  2. Copy or create the commands you need to execute
  3. Paste them into the window and format them in this way:
    NOTE: they need to start with CL: and end with ;
  1. You can execute them one at a time or hit Crtl + Shift + A to run them All
  2. You will see the results of the CL that is executing in the messages window below
  1. Now I can save this script and use it for next time (maybe this example is more specialized but you get the point)
    NOTE: you can add comments as well to explain what is happening. This interface is more pleasant to look at, it uses line wrap, and is quick!

If you need to access the job log for your files or to send to IBM, follow these steps:

  1. At the bottom of the Run SQL Scripts window you can see the job information
  1. You can add to your script above DSPJOBLOG OUTPUT(*PRINT) and execute it
  1. Go up to the menu bar and select Tools -> Printer Output
  1. Locate the printer output and Download it
  1. Locate where you saved the file and review it to make sure it’s the right job log
  1. It is! Save for your records or upload to IBM if needed.

I hope this helps and shows the power of these new tools that make life easier, work easily reproducible, and “modern” (I never even touched a green screen). Send me your thoughts and comments and thanks for reading.