Code for IBM i | Part 6: IBM i Notebooks
By Makoto Ogawa, T&Trust K.K.
When developing with VSCode+Code for IBM i, you may want to execute commands and SQL within VSCode, and the IBM i Notebooks extension makes this possible.
After installing the IBM i Notebooks extension, create a file with the extension inb (either remotely or locally). The following notebook is then created (Figure 59).
Now let’s look at the procedure for executing the command DSPFFD, which displays the field information of the table. First, click on the + code at the top of the created notebook, and a block with a blue border will be inserted into the notebook (Figure 60).
At the bottom right of the block is the word SQL, so this state can be executed by entering the SQL command, but this time we want to execute the command DSPFFD, so we click on the word SQL. Then the choices shown in Figure 61 will appear at the top.
If you select CL here, the lower right corner will also change to CL. Now, let’s enter a command. Clicking the play button on the left executes the command (Figure 62, Figure 63).
To clear the execution result, click on … to the left of the cell whose result is displayed. and select Clear cell output.
Next, let’s look at the contents of the data using an SQL SELECT statement. First, click on the + code in the upper left corner to insert another block. Next, change the lower right to SQL and enter and execute a SELECT statement (Figure 64).
The expected display was not achieved in this environment, as DBCS fields were concatenated internally when adjacent. Still, it could be used for simple data checking and maintenance purposes.
In addition, a block for writing Markdown can be added to this note (Figure 65).
Add a Markdown block like this, fill in the title and text in Markdown notation, and click the check mark with an arrow to display the formatted version (Figure 66).
Like the source code, this note can be saved remotely or locally, so it can be opened at any time to execute commands or SQL statements. If you register the ones you use frequently, you can work on them.
You can use it as a notepad for development using Markdown notation or share it with Git to create test procedures or store simple program specifications. This extension is handy, and we hope you will make use of it.
Author
Makoto Ogawa
President and CTO,CIO
T&Trust K.K.
https://www.tat.co.jp/
Since 1989, he has been responsible for system development and programming training on AS/400. He learned how IFS works on OS/400 V3R1 through Linux, and since then, he has been deeply interested in open source in IBM i. His theory is that developer needs knowledge of Linux to understand IBM i. He has also written many articles for i Magazine.
Contents of Code for IBM i: The whole picture
Part1 About Code for IBM i
Part2 Basic Usage
Part3 Maintenance of source code
Part4 Can it replace SEU/PDM?
Part5 Useful extensions other than Code for IBM i I
Part6 Useful extensions other than Code for IBM i II
Part7 Creation and execution of translation programs using DeepL API
Part8 Special Contribution 1
Part9 Special Contribution 2
[i Magazine・IS magazine] https://www.imagazine.co.jp/