Name: zos-node-accessor
Owner: International Business Machines
Description: z/OS Node Accessor - A Node module to help Node.JS developers interacting with z/OS easily.
Created: 2017-09-06 11:10:37.0
Updated: 2018-05-21 10:23:33.0
Pushed: 2018-05-24 15:34:36.0
Size: 28
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A Node module to help Node.JS developers interacting with z/OS easily, taking advantage of z/OS FTP service. It's recommended to be deployed on z/OS, to avoid transferring user account/password in clear-text over network. IBM SDK for Node.js - z/OS Beta is available at https://developer.ibm.com/node/sdk/ztp/.
install zos-node-accessor # Put latest version in your package.json
test # You'll need the dev dependencies to launch tests
This accessor leverages z/OS FTP server to interact with z/OS, it requires JESINTERFACELevel
set to 2
Before connecting to a z/OS server, you need to initialize an instance using the constructor new zosAccessor()
, then call the connect(config)
method, where:
tls.connect()
. Default: (none)A promise that resolves itself(the connection to z/OS), and rejects on any error.
Client = require('zosAccessor');
c = new Client();
onnect to localhost:21 as hansome using password
nnect({user: 'myname', password:'mypassword'})
hen(function(connection) {
// here connection equals to outer c
atch(function(err) {
// handle error
;
listDataset(dsnOrDir)
- List MVS datasets or USS files
A promise that resolves a list of
dataset entries. Each entry has the property of Volume
, Unit
, Referred
, Ext
, Used
, Recfm
, Lrecl
, BlkSz
, Dsorg
, and Dsname
.
USS file entries. Each entry has the property of name
, size
, owner
, group
, and permissions
.
ection.listDataset('HQL.*.JCL')
hen(function(list) {
for(var i=0; i<list.length; ++i) {
var entry = list[i];
console.log('name:', entry['Dsname'], 'dsorg', entry['Dsorg']);
}
atch(function(err) {
// handle error
;
s
ection.listDataset('/u/user1/')
hen(function(list) {
for(var i=0; i<list.length; ++i) {
var entry = list[i];
console.log(entry.name, entry.owner, entry.group, entry.size);
}
atch(function(err) {
// handle error
;
uploadDataset(input, destDataset, dataType)
- Upload a local file to MVS dataset or USS file.
/
this file will be uploaded to USS.\r\n
, otherwise the transfered file will get truncated.A promise that resolves on success, rejects on error.
fs = require('fs');
input = fs.readFileSync('/etc/hosts', 'utf8').replace(/\r?\n/g, '\r\n');
ection.uploadDataset(input, 'hosts')
hen(function() {
console.log('Success');
atch(function(err) {
// handle error
;
getDataset(dsn, dataType, stream)
- Get the contents of the MVS dataset or USS file.
binary
, ascii
, ascii_strip_eol
. When downloading an ascii dataset, dataType should be either ascii
or ascii_strip_eol
so that the FTP server converts EBCDIC
characters to ASCII
, ascii_strip_eol
tells FTP server not the append a CLRF to the end of each record.true
if you want to obtain a ReadableStream of the data set content, or false
to read a full dataset into memory (in Buffer).A promise that resolves content of the dataset or file in either Buffer
or ReadableStream
.
ection.getDataset('HQL.AA.JCL', 'ascii')
hen(function(jclBuffer) {
console.log('JCL is:');
console.log(jclBuffer.toString());
atch(function(err) {
// handle error
;
delete(dsn)
- Delete a dataset or USS file.
A promise that resolves on success, rejects on error.
ection.deleteDataset('HQL.AA.JCL')
hen(function() {
console.log('Deleted');
atch(function(err) {
// handle error
;
rename(oldDataset, newDataset)
- Renames oldDataset to newDataset.
A promise that resolves on success, rejects on error.
ection.rename('HQL.AA.JCL', 'HQL.BB.JCL')
hen(function() {
console.log('Renamed');
atch(function(err) {
// handle error
;
listJobs(jobName)
- List JES jobs under a certain job name.
A promise that resolves an array of jobs, each item in the array is a string separated by space, for JESINTERFACELEVEL=2, those fields are JOBNAME, JOBID, OWNER, STATUS, CLASS
ection.listJobs('HIS*')
hen(function(jobList) {
atch(function(err) {
// handle error
;
submitJCL(JCLText, cfg)
- Submit raw JCL text to JES server, or submitting built-in helper JCLs
JCLText - string - The raw JCL string to be submitted, or the name of built-in JCLs if cfg
is specified.
cfg - object - configurations to the JCL, if this parameter is specified, then JCLText should be a name of the built-in JCLs, and the cfg
should contain paramters for that JCL. Following is a list of built-in JCLs and their supported configurations:
name: ALLOC
supported configurations:
'abc'
name: COPY
supported configurations:
: 'abc',
'edf'
A promise that resolves the submitted job id.
fs = require('fs');
eadFile('./unpaxz.jcl', function(err, jclContent) {
nnection.submitJCL(jclContent)
.then(function(jobId) {
console.log('Job id is', jobId);
})
.catch(function(err) {
// handle error
});
ection.submitJCL('HRECALLW', {INPUT: 'AA.BB'})
hen(function(jobId) {
console.log('Job id is', jobId);
atch(function(err) {
// handle error
;
queryJob(jobName, jobId)
- Get job status identified by job name and job id.
A promise that resolves status of the job, it is one of the following values:
ection.queryJCL(jobName, jobId)
hen(function (status) {
switch(status) {
case connection.RC_SUCCESS:
console.log('Job succeeded');
break;
case connection.RC_FAIL:
console.log('Job failed');
break;
case connection.RC_ACTIVE:
console.log('Job running');
break;
case connection.RC_NOT_FOUND:
console.log('Job not found');
break;
default:
console.log('Unknown status');
}
;
getJobLog(jobName, jobId)
- Get jes spool files identified by jobName and jobId.
A promise that resolves spool files populated by the job.
ection.getJobLog(jobName, jobId)
hen(function(jobLog) {
console.log('Job id is:');
console.log(jobLog);
atch(function(err) {
// handle error
;