openibm
v0.1.7
Published
Syntax highlighting, formatting, completions, and client code generation for .ibmi schema files
Downloads
27
Readme
OpenIBM
Syntax highlighting, formatting, IntelliSense, schema explorer, and client code generation for .ibmi schema files.
Features
Syntax Highlighting
Full grammar support for all .ibmi schema constructs — datasource, generator, program, serviceprogram, table, procedure, ds, dataq, and outbound blocks (including nested request / response sub-blocks).
IntelliSense & Completions
- Block keyword snippets at the top level — including
outboundwith a full starter template - Context-aware attribute completions inside each block:
library,transport,system,function,resultSet,timeout, …- Inside
outbound:library,timeout,request { },response { } - Inside
request/response: all IBM i types with argument snippets
- All IBM i types with argument snippets:
PackedDecimal(15, 0),Char(10),VarChar(255), etc. - Parameter direction directives:
@in,@out,@inout - Table column directives:
@id,@map("COLNAME"),@default(...),@relation(...)
Auto-formatting
Format your .ibmi file with Shift+Alt+F (or right-click → Format Document). Aligns columns and attributes for readability.
Schema Explorer (Sidebar)
Click the OpenIBM icon in the Activity Bar to open the Schema Explorer.
- Lists all
.ibmifiles in your workspace - Expands each file into Programs, Service Programs, Tables, Procedures, Data Queues, and Outbound handlers
- Click any declaration to jump directly to it in the editor
- Refresh button (↺) to rescan the workspace
- Auto-refreshes when
.ibmifiles are created, changed, or deleted
Generate Client Code
Generate a fully-typed TypeScript client from your .ibmi schema:
- Click the ▶ Generate Client Code lens at the top of any open
.ibmifile, or - Click the ▶ play button next to a file node in the Schema Explorer
Output is written to the path set in your generator block, or ./generated/ by default.
generator client {
output = "./src/generated/ibmi"
}File Icon (Material Icon Theme)
If you use the Material Icon Theme, this extension automatically configures .ibmi files to use the database icon.
If the icon doesn't appear, add this to your settings.json manually:
"material-icon-theme.files.associations": {
"*.ibmi": "database"
}Example Schema
datasource ibmi {
transport = env("IBMI_TRANSPORT")
system = env("IBMI_SYSTEM")
}
generator client {
output = "./src/generated/ibmi"
}
// DB2 table with relations and defaults
table Customer @map("MYLIB.CUSTMST") {
id Int @id @map("CUSTID")
name Char(25) @map("CUSTNAME")
balance PackedDecimal(11, 2) @map("BALANCE")
created Timestamp @default(now())
}
// IBM i *PGM call
program GetCustomer @map("GETCUST") {
library = "MYLIB"
custId Int @in
custName Char(25) @out
}
// DB2 stored procedure
procedure ListCustomers {
library = "MYLIB"
resultSet = "Customer"
state Char(2) @in
}
// Outbound: lets an RPG program call a JavaScript function
outbound ValidateOrder {
library = "JSBRIDGE"
timeout = 30
request {
orderId Int
custNum Char(6)
amount Decimal(9, 2)
}
response {
valid Bool
message Char(100)
code Int
}
}outbound Block
The outbound block enables RPG → JavaScript calls via IBM i data queues. It is the reverse of a normal program call: your RPG code calls a JS function and waits for the response.
How it works
RPG job Node.js process
────────────────────────────────────────────────
CALL_VALIDATEORDER(req)
serialize + send → JSBRIDGE/VALIDATERQ ──────► receiveDataQueue()
call your handler(req, resolve, reject)
◄── JSBRIDGE/VALIDATERS ← sendDataQueue() ─────── resolve({ valid: true, ... })
deserialize response
return to RPG callerWhat gets generated
outbound/
ValidateOrder.ts ← JS listener (TypeScript)
rpg/
ValidateOrder/
VALIDATEORDER.rpgle ← RPG service program source (compile this)
VALIDATEORDER_H.rpgleinc ← copybook (/COPY this in caller programs)
VALIDATEORDER_SAMPLE.rpgle ← complete example caller program
VALIDATEORDER_SETUP.clp ← CL: creates DTAQs + compiles SRVPGMSnippet
Typing outbound at the top level inserts:
outbound Name {
library = "MYLIB"
timeout = 30
request {
field Int
}
response {
field Bool
}
}Inside request and response blocks, type completions offer all IBM i scalar types with argument snippets.
Requirements
- VS Code
^1.80.0 - An IBM i system accessible via HTTP, SSH, or ODBC transport
@openibm/clientin your project for runtime usage
