Before you begin
CICS TS V5.5 introduced support to run Node.js applications and is required by this tutorial. If you do not have a CICS TS V5.5 (or higher) region, use the steps in Provisioning a CICS region using z/OS® PT to provision one, or speak to your CICS system administrator.
Procedure
-
Install the Zowe CLI and plug-ins by following the steps in Installing.
-
Create Zowe CLI profiles by following the steps in Creating Zowe CLI profiles.
-
Create a Node.js application using the Express Application Generator:
npm install -g express-generator express myExpressApp cd myExpressApp npm install npm start
The Node.js application will start. You can call the application from a browser by using URL http://localhost:3000/. To stop the application in the console press CTRL+C.
-
Package the Node.js application into a CICS bundle.
Make sure that you are in the root directory of the application.
Replace the value for
--port
with one that is available for use by the CICS region on z/OS. This sets the PORT environment variable in the generated.profile
file. Additional variables can be set by editing this file.zowe cics-deploy generate bundle --port 3000 --overwrite
The output indicates the directories and files that are created to form a CICS bundle. For example:
-
Confirm that the Node.js version installed on z/OS is suitable for your application.
zowe zos-uss issue ssh "node --version"
The output should indicate the installed version of Node.js.
-
Deploy the CICS bundle into CICS.
zowe cics-deploy push bundle --name Express --overwrite
A progress bar is shown with status messages as the CICS bundle is deployed and the application is started. This can take a few minutes. The command will summarize the deployment, including the Node.js runtime
.stdout
and.stderr
file names that the application will write output to:This results in a CICS BUNDLE resource named
Express
being defined, installed, and enabled in CICS. If the BUNDLEExpress
was already defined or installed in CICS, it is undeployed first. As the BUNDLE is enabled, the application is started. If there are errors, retry with the--verbose
option for more detailed output, or refer to Troubleshooting. -
Test the application.
You can call the application from a browser by using URL http://myzos:3000/, replacing myzos with the host name of the z/OS system, and 3000 with the port specified in step 4.
If you make changes to the application, you can redeploy it by repeating step 5.
-
View the application output files.
Use the Zowe extension for Visual Studio Code or Zowe CLI commands to view the application output files. For example:
zowe zos-uss issue ssh "tail -f /u/cicprov/mnt/CICPY000/workdir/CICPY000/myexpressapp/Express/D20190612.T144609.stdout"
Results
The Node.js application is packaged into a CICS bundle on the workstation, uploaded to a directory on z/OS, and is running in CICS.