HB.js
The HostBridge JavaScript Engine (HB.js) VS Code extension modernizes the way you interact with HB.js and offers a friendly and convenient way to work with HB.js Primitives, with the COBOL CopyBook to JavaScript object generation tool, and with the Application Explorer.
How can we improve the HB.js VS Code Extension? Let us know on our Git repository
The VS Code extension includes the following features:
- Execution of HB.js Primitives (Make/Put/Run)
- Native generation of a JavaScript object from a COBOL copybook
- Access to the Integrated Application Explorer (AE) and the AE Playback
HB.js for VS Code is part of the Code4z experience from Broadcom, which offers a modern experience for mainframe application developers. To get started with Code4z, check out our foundational extension pack.
Table of Contents
Address Software Requirements
Before you use the HB.js VS Code extension, ensure that your site and workstation meet the following requirements:
Server
- HB.js on the mainframe
- A valid mainframe user ID
Getting Started
Specify a VS Code Workspace
The HB.js extension requires a VS Code Workspace for full functionality. To associate a folder with a workspace, open a folder in the Explorer view.

Add New Host Connection
To add a new host connection, click the + (plus) icon in the HB.JS: HOSTS window. A host connection requires the following information:
- HB.js Host URL, including the port number. For example: http://example.com:9000
- The CICS systems programmer responsible for the CICS regions that you are trying to access will provide the host URL, including the port number.
- A Host Name and a Region Name to help you identify the connection in the Hosts window.
- A Default User ID, which is a user ID already defined in CICS on the host. When you connect to the host, you'll be prompted to enter the password for this user ID.

Select a Default Repository
Host > Region > [Right - click] Chosen Repository > Set Default Repository

Next Steps
Execute Primitives
- Navigate to the HBJS Terminal, which shows HB.js command output and messages.
- Open a file in the explorer window ("right-click > Get" or double-click a Host file).
- Right-click in explorer window and select HB.js Commands > (Make|Put|Run) (there are also listed keyboard shortcuts for each).

Access the Integrated Application Explorer
To access the Application Explorer, perform the following steps:
- Click the Application Explorer icon next to the region where you want to run the Application Explorer.
- In the Application Explorer tab, enter the transaction ID for the initial transaction that you want to analyze.
For information about using the Application Explorer, see Analyzing Applications in the HB.js documentation.

Access the Integrated Application Explorer Settings
To access the settings for the Application Explorer, perform the following steps:
- Click the gear icon to the right of the Application Explorer Icon at the region level.
- Enter your values and then click submit to save your desired settings.

Generate a JavaScript Object from a COBOL Copybook
- Right-click on a COBOL file in the editor or in the Explorer window and select HB.js Commands > Generate JS Object.
Note: You can select either COBOL field names to use COBOL-style field names or JavaScript field names to use JavaScript-style field names in the generated file.
The generated HB.js JavaScript function is opened in the editor and saved to the workspace folder using a filename similar to filename_(COBOL|JavaScript)_JSOBJ.hbx
filename is the filename of the original COBOL file
(COBOL | JavaScript) indicates whether the HB.js function is created using COBOL-style or JavaScript-style field names for the object.
Make (HB.js Primitive) the file to your utility repository and use the following code to access the file from within your scripts
//COBOL Copybook Utilities
var copybookFactory = require('[filename_(COBOL|JavaScript)_JSOBJ]', '[utility repository]');
var demoCopybook = new copybookFactory.commareaBuffer();
var pgm = new CommareaProgram();
//Initialize
demoCopybook.initialize();
pgm.program = 'TRADERBL';
//Commands
demoCopybook.get()
demoCopybook.set()
pgm.run(demoCopybook.buffer);

Save an Application Explorer Session to JSON file
- In the Application Explorer, navigate to an active terminal session.
- Close the Application Explorer tab and choose 'save' in the pop-up to save.
- Note the saved session in the Folders tab under 'App Explorer Playback > today's date'.

Open an Application Explorer Playback Session from JSON file
- In the VS Code Folders tab, navigate to the saved JSON file.
- Right-click on the file and choose 'HB.js Commands > Application Explorer Playback'. An Application Explorer Playback tab should open.
- You can directly access screens in the playback by clicking the screen icons.
- To progress through the screens sequentially, use Page Up and Page Down.

Generate a JavaScript Object from an OpenAPI JSON File
- In the editor or in the Explorer window, right-click on an OpenAPI JSON file and select HB.js Commands > Generate JS Object from OpenAPI.
Note: Not all formats are supported at this time. Any unsupported formats will flag as failed tests. All formats will be added in future releases.
The generated HB.js JavaScript function is opened in the editor and saved to the workspace folder using a filename similar to filename_OpenAPI_JSOBJ.hbx
filename is the filename of the original OpenAPI JSON file.
Use the HB.js command Make to store the file in your utility repository.
Use the following code to access the file from within your scripts:
//OpenAPI Utility
var openAPIUtil = require('filename_OpenAPI_JSOBJ', '[utility repository]');
//Retrieve the required schema from your utility file
var openAPIDefinition = new openAPIUtil.filename();
var openAPISchema = openAPIDefinition.['your files dot notation'].schema;
//Set your object or array of objects that you want to validate against your schema
var sampleData = "your object or array of objects here";
//Call the validate function from your generated JS Object
//This example will write out the output
writeln (JSON.stringify(openAPIUtil.validate(sampleData, openAPISchema)));
//Sample Output
{
"successes": {
"required": [
"Found property: amount",
"Found property: currency",
"Found property: callbackUrl"
],
"type": [
"Property 'callbackUrl' is type 'string'",
"Property 'amount' is type 'number'",
],
"maxLength": [
"Property 'callbackUrl' complies to max length '148'"
],
"format": [
"Property 'amount' is format 'int32"
]
},
"errors": {
"type": [
"Property 'currency' must be type 'number', found 'string'"
]
},
"summary": "7 validations have passed, 1 failed"
}

List of Limitations
The following features exist in the HB.js Eclipse plugin that have not yet been added to this extension.
- Hex dump view
- Worklog view
Privacy Notice
The extensions for Visual Studio Code developed by Broadcom Inc., including its corporate affiliates and subsidiaries, ("Broadcom") are provided free of charge, but in order to better understand and meet its users’ needs, Broadcom may collect, use, analyze and retain anonymous users’ metadata and interaction data, (collectively, “Usage Data”) and aggregate such Usage Data with similar Usage Data of other Broadcom customers. Please find more detailed information in License and Service Terms & Repository.
Technical Assistance and Support for HB.js
The HB.js extension is made available to customers on the Visual Studio Code Marketplace in accordance with the terms and conditions contained in the provided End-User License Agreement (EULA).
If you are on active support for HostBridge JavaScript Engine, you get technical assistance and support in accordance with the terms, guidelines, details, and parameters that are located within the Broadcom Working with Support guide.
This support generally includes:
- Telephone and online access to technical support
- Ability to submit new incidents 24x7x365
- 24x7x365 continuous support for Severity 1 incidents
- 24x7x365 access to Broadcom Support
- Interactive remote diagnostic support
Technical support cases must be submitted to Broadcom in accordance with guidance provided in “Working with Support”.
Note: To receive technical assistance and support, you must remain compliant with “Working with Support”, be current on all applicable licensing and maintenance requirements, and maintain an environment in which all computer hardware, operating systems, and third party software associated with the affected Broadcom software are on the releases and version levels from the manufacturer that Broadcom designates as compatible with the software. Changes you elect to make to your operating environment could detrimentally affect the performance of Broadcom software and Broadcom shall not be responsible for these effects or any resulting degradation in performance of the Broadcom software. Severity 1 cases must be opened via telephone and elevations of lower severity incidents to Severity 1 status must be requested via telephone.
Copyright © 2025 Broadcom. The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.