ibmruntimes / vsam.js

Reading and writing vsam files using NodeJS
Apache License 2.0
10 stars 5 forks source link

could not access VSAM dataset with only read permission #7

Open tangthth opened 6 years ago

tangthth commented 6 years ago

Issue Description:

For VSAM data sets with only read permission but without write permission:

Reproduce Steps:

  1. as USRB, prepare a vsam data set, and permit USRA with only read access <=== on z/OS, when USERA edits the data set, it will reports: File Manager command in error:
    +++ File Manager DSE 'USRB.NODEJSD.VSAMDS01'
    ssssssssssssssssssss No access authority
  2. as USRA, write nodejs script 1 to judge if the vsam data set exists or not, execute script 1
  3. as USRA, write nodejs script 2 to open the vsam data set, execute script 2

Logs:

For Step 2: /u/usra/myscripts:>node test_vsam.js
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts/test_vsam.j s:28
vsamObj = vsam.allocSync(dsname, JSON.parse(fs.readFileSync('schema.jso ')))
¬
TypeError: Invalid dataset format
at TypeError (native)
at vsamOpen (/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/s ripts/test_vsam.js:28:17)
at Object. (/u/usra/workdir/nodejs/nodejs.test.vs m_1.0.0/scripts/test_vsam.js:324:1)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)

For step 3: /u/usra/myscripts:>node test_vsam.js
/u/usra/workdir/nodejs/nodejs.test.vsam_1.0.0/scripts/test_vsam.j s:325
vsamObj = vsam.openSync(dsname, JSON.parse(fs.readFileSync('schema.json')))
¬
TypeError: Invalid dataset name
at TypeError (native)
at Object. (/u/usra/workdir/nodejs/nodejs.test.vsa m_1.0.0/scripts/test_vsam.js:325:16)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)

Reference:

Script 1:

if (vsam.exist(dsname)) {
    vsamObj = vsam.openSync(dsname, JSON.parse(fs.readFileSync('schema.json')))
    console.log("Open the vsam dataset: " + dsname)
}
else {
    vsamObj = vsam.allocSync(dsname, JSON.parse(fs.readFileSync('schema.json')))
    console.log("New vsam dataset allocated: " + dsname)
}

Script 2:

    vsamObj = vsam.openSync(dsname, JSON.parse(fs.readFileSync('schema.json')))
    console.log("Open the vsam dataset: " + dsname)
mkhouse8 commented 4 years ago

I'm curious to know if read-only is possible as well. We have many VSAM files loaded in CICS regions that can not be accessed for I/O, but it is possible to access the file in a read-only mode.