ZOWE App for Job submissions

Venkat Avinash
2 min readJul 12, 2021

Following process describes a simple app built using nodeJS and ZOWE sdk to accept input from the user and then generate the JCL and submit it to mainframe back-end.

Parameters like HOST name, PORT, user id and password are passed in as environment variables. Create a simple web front end to accept values needed to be substituted in the JCL and accept them from the user (not going into creation of web page etc .).

Sample JCL:

//XXXXXXXJ JOB 1,"Test SUB",CLASS=S,NOTIFY=&SYSUID
//*
// JCLLIB ORDER=(XXXXXXXJ.TEST.PROCLIB)
//*
// EXPORT SYMLIST=*
// SET VAL=VAL1
//PROC1 EXEC PROCTST,VAL=&VAL

Sample router to accept the data and request job execution:

const express = require("express")
const fs = require("fs")
const path = require("path")
const { submitJobFromFile } = require('../zowe/submit')
const { createSession } = require('../zowe/connectToMF')
const router = express.Router()
const extractJcl = 'extract.jcl' //jcl file shown above, saved in JCLS folder
const jclPath = path.join(__dirname,'../JCLs',extractJcl);
router.put('/submit',async function(req,res){
let val = req.query.val;
//use the value from user input and replace it in the JCL.
let data = fs.readFileSync(jclPath,'utf8');
dataJcl = data.replace('VAL1',val);
//now, create session with the mainframe.
const session = CreateSession();
//use the session variable to submit jcl to mainframe.
const response = await submitJobFromFile(session,dataJcl);
res.send({
jobname: response.jobname,
jobid : response.jobid,
status : response.retcode
});
});

Functions used above are detailed here for reference…

Create Session:

import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk";
const tempProfile = {
host: process.env.HOST,
port: process.env.PORT,
user: process.env.USER,
password: process.env.PASSWORD,
rejectUnauthorized:false
}
funtion CreateSession(){
const session = ZosmfSession.createBasicZosmfSessionFromArguments(tempProfile);
return session;
}
module.exports= {
CreateSession: CreateSession
}

Submit Jobs:

import { SubmitJobs, MonitorJobs } from "@zowe/zos-jobs-for-zowe-sdk";const submitJobFromFile = async (session, dataJcl)=> {
parms = {
jcl: dataJcl,
internalReaderLrecl: '80',
internalReadeRecfm: 'F',
waitForOutput: true,
}
const response = await submitJobs.submitJclString(session,dataJcl,parms);
return response;
}
module.exports = {
submitJobFromFile:submitJobFromFile
}

With these functions in place, we can now successfully run a simple app, to accept input, change our JCL and submit it to mainframe. Along with that, we can also get the job output and log that out to the user.

There are still more use cases to use download file options and allow the front end app to provide an option to download them directly.

--

--