01 - Programming (EN)

Visual Studio Code – Code for IBM i

Last Updated on 18 November 2021 by Roberto De Pedrini

Visual Studio Code is a free development editor that allows us to start programming in any programming language, without changing editors. It supports many languages, including Python, Java, C ++, JavaScript and others. Precisely in this regard, in the last period, together with all the contributors of the IBM i community, a Code for IBM i extension has been developed that allows the simplified development of native applications in RPGLE or COBOL.

IBM i installation and connection (with video tutorial… by now only in Italian)

Visual Studio Code is a cross-platform development IDE. It is available for Windows, Mac or Linux systems. Here are some steps, in order to start using Visual Studio Code, with the IBM i ecosystem.

We also have a video tutorial (by now only in Italian) made by Roberto De Pedrini:

  • But first let’s connect to our IBM i, and verify that the * SSHD service is active through the command STRTCPSVR * SSHD . Only then, through our IDE, we can click on the extension Code for IBM i and enter the connection parameters of our IBM server. In case of a successful connection, we would find ourselves in a similar situation, with the possibility to change our library list, consult our source members both under IFS and not, view and consult the IFS. If the component is installed db2util , available directly from the open source package management environment, it is also possible to consult the structure of our databases.

The first time you log into the MEMBER BROWSER tab we will only have QSYSINC / H available in the list. Let’s move with the mouse in the drop-down menu, on the button that will allow us to add other source files to that list of the type LIB / FILE.

Edit source files (with video tutorial)

Now, we should be able to open our sources directly from VS Code, modify them, and compile them. With this new development editor, you have the possibility, and should not be underestimated, to download load the sources directly on from the PC as a text file, perform the comparison etc.

Compilation

To run build commands, you need to navigate to the source member and run the command RUN ACTION (CTRL + E). This will show a drop-down menu with the available actions. Each action has a different command that will be executed.

After compiling, it will be possible directly from Visual Studio Code, to analyze the spool file and its output, similar to RDI operation. To do this, move to the bottom left, click on INFO, and in the output screen choose IBM I Output.

Settings menu (CTRL + ‘+’) -> Extension -> Code For IBM i.

Content assist and RPGLE code indentation

The functions of Rpgle Column Assist, Rpgle Content Assist and Rpgle Indentation but you need to enable them from the Code For IBM i plugin settings.

Also for this part of the connection, editing, and compilation of the RPG sources we have a video tutorial in Italian, also by Roberto De Pedrini:

Conclusions

Personally, I still prefer to use IBM’s official product, RDI, because it offers a far superior user experience, but especially for programmers who aren’t born with * totally free language, it’s much more driven. Nonetheless, a dutiful thanks to all the people who are committed to developing and improving a plugin at almost no cost! (Let’s remember). Surely, this is to be preferred over the traditional SEU. 😁

Note .

I had the pleasure of dealing with some components of this fabulous community, for a problem in opening the sources under a member file having CCSSID 65535 . 

In order to solve, it was necessary from the settings of the newly created connection, to disable the extension db2util and set a CCSSID for the source files with a parameter between 280 and 37. Only in this way was I able to edit members present under a PF with CCSSID 65535.

Conclusions shared also with Roberto De Pedrini:

Documentation

Related Posts
DB2 for i SQL – String Manipulation – POSSTR-LOCATE-LOCATE_IN_STRING (EN)

Introduction Often, in our applications, we need to work with text strings, and DB2 SQL can come in very useful Read more

DB2 for i – FAQ & Howtos (EN)

DB2 Database and SQL ... maybe the most important things on IBM i platform: here's a collection of FAQs, tips Read more

IBM i 7.4 Announcement (En)

Comes directly with the Easter egg this IBM announcement for the news of the IBM i 7.4 version, iNext version Read more

Generated Always Columns (EN)

Introduction "Generated Always Column": are columns, table fields, filled by DB2 engine: something like columns with a default value but Read more

About author

IT Specialist, IBM i passionate

Leave a Reply

Your email address will not be published. Required fields are marked *