IBM / zos-node-accessor

z/OS Node Accessor - A Node module to help Node.JS developers interacting with z/OS easily.
Eclipse Public License 1.0
35 stars 18 forks source link

Option to return object from getJobLog #6

Closed dogboydog closed 6 years ago

dogboydog commented 6 years ago

This might be more of a preference thing, but I was just wondering if the results of getJobLog could be put into an object somewhat similar to this

    [
    {
      "ddname": "JESJCL",
       "content": "//IEFBR14 JOB 123\n//STEP1 EXEC PGM=IEFBR14"
    }, 
    { 
      "ddname": "JESYSYSMG",
      "content": "ALLOCATED TO MY.DATA.SET" 
     }
    ]

(if there are any other values provided by FTP like procedure, procedure step etc. it would be cool to include them here too!)

For backwards compatibility, the object could be provided only if an optional boolean parameter is specified as true

This would allow users to easily select a certain DD from the output by name

polyrabbit commented 6 years ago

Yes, I also prefer this returned structure.

The problem is FTP does not provide a way to get the names of spool files - or I just didn't find it, I can only query it using <jobid>.1, <jobid>.2 ... to get the spool files sequentially. Do you have any suggestions how to implement this?

BTW, if you are interested, here is the doc I'm referring to: https://www-304.ibm.com/servers/resourcelink/svc00100.nsf/pages/zosv2r3sc273662/$file/halu001_v2r3.pdf

dogboydog commented 6 years ago

Thanks for the documentation link. That helps me to know what's possible when making enhancement requests 🔖

What about the LIST job54 command demonstrated on page 133? Seems to provide a little table with some of this info, though it would have to be parsed. The same command format might help with https://github.com/IBM/zos-node-accessor/issues/4

If it turns out to not be possible, even an option to return an array of strings rather than a joined string might help. Thanks for the prompt response on my issues

polyrabbit commented 6 years ago

Right, you found it!

We can combine the two, and return a well-formatted log response.

I'll try to implement it later this week, and keep you informed when ready.

dogboydog commented 6 years ago

Thanks very much! Great package

polyrabbit commented 6 years ago

Here is the new response, with all information(by LIST job54) included, any suggestion?

[{
  content: "1 J E S 2 J O B L O G...",
  id: 1,
  stepname: "JES2",
  procstep: "N/A",
  c: "H",
  ddname: "JESMSGLG",
  byteCount: 1584
},
{
  content: "1 //HRECALLW JOB...",
  id: 2,
  stepname: "JES2",
  procstep: "N/A",
  c: "H",
  ddname: "JESJCL",
  byteCount: 315
},
{
  content: "ICH70001I ",
  id: 3,
  stepname: "JES2",
  procstep: "N/A",
  c: "H",
  ddname: "JESYSMSG",
  byteCount: 980
},
{
  content: "AAA",
  id: 4,
  stepname: "AAA",
  procstep: "JAVAJVM",
  c: "H",
  ddname: "SYSOUT",
  byteCount: 759
}]
dogboydog commented 6 years ago

That looks awesome!! I wonder if we could change c to class? That's the only thing that I was thinking. Awesome work. Although maybe that would confuse people since I guess it means The SYSOUT class of the spool file. and not the job class. Up to you

polyrabbit commented 6 years ago

Those attributes are all parsed from the FTP response, I'd like to not interpreting too much.

JOBNAME  JOBID    OWNER    STATUS CLASS
HRECALLW JOB19142 VPADEV   OUTPUT A        RC=0000
--------
         ID  STEPNAME PROCSTEP C DDNAME   BYTE-COUNT
         001 JES2        N/A   H JESMSGLG      1584
         002 JES2        N/A   H JESJCL         315
         003 JES2        N/A   H JESYSMSG       980
3 spool files
dogboydog commented 6 years ago

Makes sense. Thank you

polyrabbit commented 6 years ago

BTW, can I know what kind of project you are doing using this library? I'd like to see more scenarios for it.

dogboydog commented 6 years ago

Let me get back to you, I'll be able to provide some materials in a week or so that will help explain what I'm working on. Thank you

dogboydog commented 6 years ago

Hi,

So I'm working on a new product called Brightside:

https://www.youtube.com/watch?v=6WL3p9Or2_4

It's a command line interface used as a way to interact with the mainframe easily, interactively, in Jenkins/other CICD scripts, build scripts in GitHub projects etc, and for easily building editor plugins for mainframe stuff. The CLI can have separately installed plugins and I'm working on a prototype ftp plugin using this package that tries to expose many of the same commands from the main product (downloading, uploading, creating data sets, submitting jobs etc.) from the FTP plugin, for internal users and customers that do not have z/OSMF set up and configured on their mainframes. The z/OSMF funtionality is faster and has more features but I think it'd be good to be able to expose a similar experience to people with more back-leveled z/OS. This package has been super useful for me for my prototype

polyrabbit commented 6 years ago

Wow! this is an amazing product! I'm impressed by the simplicity/easy way to interact with z/OS - especially the CLI part. Is it possible that I can give it a try? I think it will help a lot to automate our work on z/OS.

dogboydog commented 6 years ago

Thank you! I am one of the co-inventors of the product (I also made that video : ) ) so I appreciate your kind words. You can absolutely try it. It's free to use but support is paid.

Someone should come and give you a link here soon.

Your package has helped a lot as I experiment with a potential FTP plugin. My plan is that the FTP plugin could have almost identical syntax to commands from the rest of Brightside so that it could be used on older systems by people who are used to using Brightside, or as a first step to using Brightside before z/OSMF is set up. I hope I can share more info with you on the plugin in the future

Tell your friends! Thank you

dogboydog commented 6 years ago

Hi,

Here you go, try out Brightside!

https://www.ca.com/us/trials/ca-brightside.html

polyrabbit commented 6 years ago

Many thanks for the info, I installed the bright CLI tool, but failed to invoke it and I don't have z/OSMF set up. Anyway, I'm looking very much forward to your FTP plugin, which shouldn't require the z/OSMF dependence right?

BTW, we just published a new version (0.1.4) to npm. The new getJobLog accepts an additional parameter - logFormat, setting it to 'metaInfo' results well structured job logs, otherwise it only returns the raw string for compatibility reason.

dogboydog commented 6 years ago

Awesome, glad you were able to get it installed but too bad you can't use it yet since you don't have z/OSMF. Yes the FTP plugin wouldn't require z/OSMF but I'd have to get back to you on when I'd be able to share it with you since it hasn't been approved as an external project yet. But I'll try my best to get automated tests and such working for it so that we're comfortable with sharing it externally.

Did the install work well for you? If you do "bright" do you see the help text? Or did the install not work?

Thanks for publishing the new version! I appreciate it. I will try that out soon

One other thing that would be very useful is https://github.com/IBM/zos-node-accessor/issues/4 that would reuse the API you just used. So I could say connection.getJobInfo("j123") and get back something like { jobname: "MYJOB", jobid: "JOB00123", retcode: "CC 0000"} without needing to know the job name up front. No problem if you don't have time though

Also just curious but do you work at IBM or do you just contribute to this project?

polyrabbit commented 6 years ago

I don't know why, but the profile with user entry is already created beforehand using:

bright profiles create zosmf-profile test-bright -H pok.ibm.com
dogboydog commented 6 years ago

Ah I see. Thanks for your reply

We forgot to make user and password required on create zosmf-profile even though they are required. We will fix this but for now you'll need to create profile with user name and password.

bright profiles create zosmf-profile test-bright -H pok.ibm.com -u youruserid -p yourpassword --ow

If your zosmf instance uses self-signed certificates, you will also want to add --ru false to your create profile command. If when issuing that command you get the "keytar not installed" message again, make sure you performed the step to install native build tools (on Windows, the command to install windows-build-tools via npm). If you forgot that step, npm uninstall -g @brightside/core, install the native build tools, and try to install Brightside again so that keytar will be downloaded and compiled. Sorry for the trouble

If you don't have z/OSMF still and you're just testing, the functionality of the commands won't work without a valid z/OSMF instance :( But you can check out what's available and maybe get z/OSMF set up

polyrabbit commented 6 years ago

Thanks for the explanation, here is the result after running bright profiles create zosmf-profile test-bright -H pok.ibm.com -u youruserid -p yourpassword --ow

Command Error:
Unable to store the secure field "user" associated with the profile "test-bright" of type "zosmf".
Error Details:
Keytar not Installed

I'm afraid the root cause is bright fails to find Keytar, so I install keytar using npm install keytar, but the problem persists. Do you require a specific version of keytar? I'm using Mac FYI.

dogboydog commented 6 years ago

You would have to get keytar to install into the brightside installation folder which is why uninstalling and reinstalling is the safest bet. I'm on my phone right now but check out the installation doc for node-gyp and keytar. I think on Mac you don't need libsecret but maybe there's some other prerequisite we missed. If you reinstall and see the native build occurring (you'll see references to .cc files and node-gyp) and it still doesn't work let me know. I want to get this working for you

On Wed, Jun 6, 2018, 7:34 AM Chang Xin Miao notifications@github.com wrote:

Thanks for the explanation, here is the result after running bright profiles create zosmf-profile test-bright -H pok.ibm.com -u youruserid -p yourpassword --ow

Command Error: Unable to store the secure field "user" associated with the profile "test-bright" of type "zosmf". Error Details: Keytar not Installed

I'm afraid the root cause is bright fails to find Keytar, so I install keytar using npm install keytar, but the problem persists. Do you require a specific version of keytar? I'm using Mac FYI.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/IBM/zos-node-accessor/issues/6#issuecomment-395037578, or mute the thread https://github.com/notifications/unsubscribe-auth/AJdhw10HN2pMPmVH4jZiQZAHCGq58mIyks5t575agaJpZM4UF2RV .

dogboydog commented 6 years ago

You can contact me at Christopher.Boehm@ca.com if you want to debug your install further

dogboydog commented 6 years ago

This issue was resolved by your changes. Feel free to contact me about your install

dogboydog commented 6 years ago

If you want to install the FTP plugin, send me an email with your email address and we can get you signed up for a site where we can host the FTP plugin for you