Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Itoolkit's iPgm - Library setup #45

Open
deepakpenjarla opened this issue Jan 22, 2020 · 17 comments
Open

Itoolkit's iPgm - Library setup #45

deepakpenjarla opened this issue Jan 22, 2020 · 17 comments
Labels
enhancement New feature or request

Comments

@deepakpenjarla
Copy link

iToolkit's iPgm is taking Library List from User's JOBD library list.
Any way to give the library list in run time.?

I tried submitting the job with a JOBD which has a set of libraries but no use. When I console the result after run( ). I see below XML.

\n \n XML Toolkit 1.9.9\n \n 1100016\n \n \n \n \n 10000 05\n \n \n \n \n 1100016\n \n \n \n \n *NA\n FFFFFFFF\n< jobname>QSQSRVR \n QUSER\n 266967\n *ACTIVE\n USER01\n 37\n 37\n 819\n ENU\n US\n QSYSWRK\n QSYS\n \n QSYS QSYS2 QHLPSYS QUSRSYS\n QTEMP LIBRARY1 LIBRARY2\n see log scan, not error list \n \n \nundefined
@deepakpenjarla
Copy link
Author

@ThePrez
Could you please help on this.?

@abmusse
Copy link
Member

abmusse commented Jan 22, 2020

@deepakpenjarla

What if you ran CHGLIBL prior to calling your program?

What version of itoolkit are you using?

@deepakpenjarla
Copy link
Author

@abmusse
We are using itoolkit v0.1.6.

Library List of submitted Job (Node Jobs) is having the library list properly.
Node Jobs :
QP0ZSPWT USER01 BATCHI ACTIVE PGM-sh
QP0ZSPWT USER01 BATCHI ACTIVE PGM-node
QZSHSH USER01 BATCHI ACTIVE PGM-QZSHSH

but it internally submitting another PRESTART job with QUSER

QSQSRVR QUSER 267369 PJ ACTIVE

This prestart job's library list is taken from Prestart JobD (QDFTSVR/QGPL ) which I can't change because the same prestart job might be using for different purpose.
Is there a way to configure to use a particular prestart job instead of using QSQSRVR always.?

@deepakpenjarla
Copy link
Author

One more question here,, If we do not specify library Name in iPGM options, from which library list it tries to find the program.? Is it from current library list.?

@abmusse
Copy link
Member

abmusse commented Jan 24, 2020

@deepakpenjarla

One more question here,, If we do not specify library Name in iPGM options, from which library list it tries to find the program.? Is it from current library list.?

Yes it should try to use your library list first.

Below is an example changing your library list using v0.1.6:

const { iConn, iCmd, xmlToJson } = require('itoolkit');

const conn = new iConn('*LOCAL', process.env.USER, process.env.PASSWORD);

conn.add(iCmd("RTVJOBA USRLIBL(?) SYSLIBL(?)"));
conn.add(iCmd("CHGLIBL LIBL(QXMLSERV)"));
conn.add(iCmd("RTVJOBA USRLIBL(?) SYSLIBL(?)"));

conn.run((xmlOut) => {
  const output = xmlToJson(xmlOut);
  for (let command of output) {
   console.log(command);
  }
});

Output:

{
  type: 'cmd',
  success: true,
  cmd: 'RTVJOBA USRLIBL(?) SYSLIBL(?)',
  data: [
    {
      name: 'USRLIBL',
      value: 'QGPL       QTEMP      QDEVELOP   QBLDSYS    QBLDSYSR'
    },
    {
      name: 'SYSLIBL',
      value: 'QSYS       QSYS2      QHLPSYS    QUSRSYS'
    }
  ]
}
{ type: 'cmd', success: true, cmd: 'CHGLIBL LIBL(QXMLSERV)' }
{
  type: 'cmd',
  success: true,
  cmd: 'RTVJOBA USRLIBL(?) SYSLIBL(?)',
  data: [
    { name: 'USRLIBL', value: 'QXMLSERV' },
    {
      name: 'SYSLIBL',
      value: 'QSYS       QSYS2      QHLPSYS    QUSRSYS'
    }
  ]
}

@deepakpenjarla
Copy link
Author

@abmusse Thanks for your answer.
Yes, I agree we can use Retrieve and Change but if partiular JOBD is having 15-20 libraries then I need to retrieve and set the library list before every call of program.
And, if I use the calling of a program in a POST request then I might be doing the same for every POST request.
Is there a way to set the Node to always refer to a particular JOBD libraries.? may be in the current versions of itoolkit (I might be using older version).?

@kadler
Copy link
Member

kadler commented Jan 27, 2020

Why do you need to retrieve it? Just set it exactly how you want it.

@deepakpenjarla
Copy link
Author

@kadler I would like to use Library list from a JOBD, so to get the library list, I need to retrieve the library list from a particular JOBD and set it.

@kadler
Copy link
Member

kadler commented Jan 30, 2020

Ok, gotcha.

@ThePrez
Copy link
Member

ThePrez commented Jan 31, 2020

You may also be able to specify the ctl transport option like so: *sbmjob(LIBNAME/JOBD/JOBNAME)

I believe this will result in the XMLService jobs being submitted to batch under the given *JOBD.
https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20i%20Technology%20Updates/page/Toolkit%20for%20i%20APIs

Of course, there will be more overhead associated with submitting those batch jobs, but you can mitigate some of that with prestarted jobs and/or using the ipc parameter.
http://yips.idevcloud.com/wiki/index.php/XMLService/XMLSERVICEQuick

@deepakpenjarla
Copy link
Author

Hi @ThePrez
I tried to use the iConn option as below

var conn = new xt.iConn("*LOCAL","USER01","XXXXX",ctl:'*sbmjob(QGPL/NEWUIJOBD/NODE_JB)',ipc:'/tmp/pdeepak/'});

I see it is submitting a job with NODE_JB with specified JOBD (NEWUIJOBD) but still library list for the job is User's JOBD library list.
Am I missing something here.? or is it because of XMLSERVICE version or itoolkit version we are using.?

@kadler
Copy link
Member

kadler commented Feb 4, 2020

I found this old doc on library list in XMLSERVICE: http://yips.idevcloud.com/wiki/index.php/XMLService/XMLSERVICELibl

It generates the SBMJOB command like this:

xmlservice/src/plugipc.rpgle

Lines 1410 to 1445 in 491b0d3

// execute command
// SBMJOB CMD(CALL PGM(PLUGSBMLIB/PLUGSBMPGM)
// PARM('/tmp/ranger')) JOBD(ZENDSVR/ZSVR_JOBD)
// PRTDEV(*JOBD) OUTQ(*JOBD) INLLIBL(*JOBD)
// INLASPGRP(*JOBD) SPLFACN(*JOBD)
mylib = confSBMLIB();
mypgm = confSBMPGM();
cmdstr = 'SBMJOB CMD(CALL PGM('
+ %trim(mylib)
+ '/'
+ %trim(mypgm)
+ ')'
+ ' PARM('
+ ''''
+ %trim(ipcPathBlk)
+ ''''
+ '))'
+ ' JOB('
+ %trim(ipcDoFlags.doSbmNam)
+ ')'
+ ' JOBD('
+ %trim(ipcDoFlags.doSbmLib)
+ '/'
+ %trim(ipcDoFlags.doSbmJobd)
+ ')';
// INLASPGRP(ASP1) (1.6.5)
if ipcDoFlags.doSbmAsp <> *BLANKS;
cmdstr = %trim(cmdstr)
+ ' INLASPGRP('
+ %trim(ipcDoFlags.doSbmAsp)
+ ')';
endif;
// add options for SBMJOB
for i = 1 to SBMNBR;
cmdstr = %trim(cmdstr) + ' ' + %trim(SBMARRAY(i));
endfor;

There is a way to alter it, but it's a compile-time option:

DSBMOPTS ds
D sbm1 50 inz('CURLIB(*CURRENT)')
D 50 inz('INLLIBL(*CURRENT)')
D 50 inz('SRTSEQ(*CURRENT)')
D 50 inz('LANGID(*CURRENT)')
D 50 inz('CNTRYID(*CURRENT)')
D 50 inz('CCSID(*CURRENT)')
D SBMNBR c %div(%size(SBMOPTS):%size(sbm1))
D pSBMOPTS s * inz(%addr(SBMOPTS))
D SBMARRAY s 50 dim(SBMNBR) based(pSBMOPTS)
and its hard-coded to use the current job's library list.

@ThePrez
Copy link
Member

ThePrez commented Feb 4, 2020

This sounds like a reasonable enhancement request to be routed to XMLService team for consideration.

According to this comment:

* INLLIBL *JOBD changed to *CURRENT via Alan (1.7.3)

Version 1.7.3 predates git control, so tracing history with certainty is impossible. However, I strongly suspect the "Alan" is @alanseiden. I will reach out to him to see if he remembers the reasoning behind that change (besides some obvious ones).

@ThePrez ThePrez transferred this issue from IBM/nodejs-itoolkit Feb 4, 2020
@kadler kadler added the enhancement New feature or request label Feb 4, 2020
@alanseiden
Copy link
Collaborator

@ThePrez With the PHP toolkit, most users did not hand-craft a *SBMJOB string. To do so was rare, perhaps not even possible at first, and definitely more obscure than with the Node toolkit instantiation code I see discussed here. Users typically accepted the defaults (the Zend JOBD) and expected their user profile's library list to hold sway. They complained when their user profile's library list seemed to have no effect.

@deepakpenjarla
Copy link
Author

@alanseiden
I understand, usually we do not do *SBMJOB with a JOBD name but I believe setting up library list from User JOBD should happen when we do not use *SBMJOB (default way).
If we specify a particular JOBD, it should use that JOBDs library list.

@jimoibm
Copy link
Contributor

jimoibm commented Dec 8, 2020

Listed some examples below.. if none is the case, can I get detailed explanation on the usage to get clear about what xmlservice expected to do?

  • ipc mode
  1. Use setting from *sbmjob() call program(by default it's XMLSERVICE pgm) with IPC key.. SBMJOB is only called when IPC "server" is not up. If this is the case, plugconf_h is designed to be customized by user in compile phase. I don't think the default values should be changed for minorities.
call qxmlserv.iPlug32k('/tmp/mykey',
'*sbmjob(JIMO/XSTESTJOBD/XSTEST)',
'<?xml version=''1.0''?>',
'?');
  1. Use from user input. Your SBMJOB will be called. describe your libl in the command
call qxmlserv.iPlug32k('/tmp/mykey',
'*sbmjob',
'<?xml version=''1.0''?>
  <sbmjob>SBMJOB CMD(CHGDTAARA DTAARA(JIMO/ADTAARA *ALL) VALUE(''2'')) JOB(XSSBMJOB) JOBD(JIMO/XSSBMJOBD) INLLIBL(*JOBD)</sbmjob>
',
'?');
  • stateless mode:

Just a command to write as you wish.. describe your libl in the command

call qxmlserv.iPlug32k('*NA',
'*here',
'<?xml version=''1.0''?>
    <cmd>SBMJOB CMD(CHGDTAARA DTAARA(JIMO/ADTAARA *ALL) VALUE(''2'')) JOB(XSSBMJOB) JOBD(JIMO/XSSBMJOBD) INLLIBL(*JOBD)</cmd>
',
'?');

@brandonp42
Copy link

FWIW I always control my library list with the ODBC connection string DBQ parameter and don't try to have a JOBD manage it. It appears that the *SBMJOB inherits it in my quick and dirty testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants