Visual Studio Code for IBM i - Developing on my local machine

Let's take this from the top!

Start by Connecting to your IBM i - System

Simply click the IBM i button in the primary sidebar on the left side and logon to your machine. If you have not yet added your system, click the + New Connection button and add your system info:

vs-code connect to ibm i system

Once connected you will see your OBJECT BROWSER and IFS BROWSER.

In my screen shot - you can see I have already added some filters to display specific libraries and folders:

vs-code object browser

Select our LOCAL working environment on our PC

This could be folder in our local Windows, Linux or even *shudder* Apple device. 

You can create a Folder that you want your IBM i Source code to be downloaded to - or clone an existing GIT repository to work with that. 

In my example, I will be working in a local folder called '\OneDrive\Documents\GitHub\nick.litten.public'. 

We will publish this to GitHub Later - you will also be able to clone my public source code and play with it - but more on that later.

vs-code ibmi select local folder

Once selected Project Explorer asks me to configure the project metadata

vs-code ibmi local project

So, let's keep it happy, and once we fill in the project description, Visual Studio Code will set everything up ready to go:

vs-code ibmi local project - ready to go

We are now ready to suck some source code down to our local folder, or to write our own new RPG code for example.

Select the IFS Location we will be deploying to

"What does that mean?" you may be thinking

Well.... we will be downloading source code to our local machine, a Windows 11 desktop in my case. This could be any Windows, Linux or even *shudder* an Apple. And when we work on this local source code, we will ultimately need to compile it. Since we cannot compile locally on the PC, Code for IBM i will deploy the code (think synch) to the IFS location you choose and compile into the library that you choose.

DANGER WILL ROBINSON!

Synching into an existing folder may REPLACE your IFS Folder contents!

I had this exact situation while recording the screen shots for this page!

I strongly recommend choosing a fresh new folder to use for deployment. Of course, you could choose an existing IFS folder but will need to download this to your PC location before running the deploy/sync

My recommendation is to create a folder called 'builds' off your personal /home/yourname folder. Then every project you work on will be a subfolder off the /home/yourname/builds folder.

So, in my case I use a folder called /home/nicklitten/builds

To select your IFS location - simply right click the IFS folder and select Set Deploy Workspace

vs-code-ibmi-local-project-set-personal-deploy-workspace

This will ask you to do a simple deploy now - running the first deployment (sync) of your local workspace to your IFS location. 

I vote you click Deploy Now to test it out

vs-code ibmi local project - deploy now

How do you want VS Code for IBM i to determine which files to sync to your deployment location?

I normally always use Compare but this is up to you:

vs-code ibmi local project - deploy now compare type

A few seconds later you will a deployment completed message:

deployment completed message

Now you can switch back to your IFS BROWSER under the IBM i TAB to see what you synced to your IFS location.

Test the Deploy works

In my local workspace I have created a folder for code samples called sample-code:

new source test folder

Now we place our helloworld.rpgle program into the "sample-code" folder:

**free
dsply 'Hello World';
return;
rpgle hello world

rpgle hello world

We want to test that this deploys up to our IFS location. 

Simply click the DEPLOY PROJECT button on the Project Explorer:

deploy hello world rpgle example to our IFS

And of course, if we switch into our IFS EXPLORER view we will see this new folder, with the hello world rpgle sample, living in our deploy folder:

hello world rpgle deployed successfully

Shazzam!

Next - let's compile this shall we?

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>