Zillion IBM i Utilities (system400 swiss army knife)

Issue #2 closed
Former user created an issue

I had a brain storm last night ... "i got me an idea!" (Kevin Bacon, Tremors 1990).

We could build a whole bunch of little utilities to include with system400. Install them all in /QOpenSys/usr/bin. Simply call little 'wrapper' scripts same name as IBM i command for PASE 'anywhere', crtrpgmod, crtcmod, crtpgm, crtsrvpgm ... endless. They all will be chroot friendly, so everything would just work. That is, work anywhere, command line, makefile, scripting, project builder, etc.

Example:

> crtrpgmod --root /QOpenSys/mychroot --lib TONYLIB --rpgle mycool.rpgle

In litmis/system400 project a directory per 'utility' with a README.md to explain the parameter mapping.

system400/crtrpgmod
README.md
crtrpgmod

People could add there own utility just add a directory with a IBM i command wrapper to the system400 project.

What say you?

Comments (55)

  1. Former user Account Deleted reporter

    I am going to slightly change system400 utility for -key "value parameters".

    ==> qsh with *OUTPUT
    system400 -qshout "wrkactjob" -root /QOpenSys/mychroot
    ==> *cmd with no output
    system400 -cmd "CRTUSRPRF USRPRF(BOB) PASSWORD(iambob)"  -root /QOpenSys/mychroot
    ==> db2 (maybe output)
    system400 -db2 "select * from QIWS/QCUSTCDT" 
    

    BTW -- Yes, sort of like db2util, but really intended to be 'system400 plumbing' to build other IBM i utility 'wrappers'.

  2. Former user Account Deleted reporter

    art of error reporting

    Not all IBM i commands report 'OUTPUT'. However, I suspect we can use db2 new service APIs collect joblog for IBM i utilities that will not cooperate with 'OUTPUT'.

    > crtpgm --pgm mypgm --mods "mycool1 mycool2" --error joblog --root /QOpenSys/mychroot
    

    The system 400 utility add -error [ouput|joblog], where *output is default.

    system400 -cmd "crtpgm ... so on" -error joblog  -root /QOpenSys/mychroot
    
  3. Former user Account Deleted reporter

    Aaron, Can you offer a little help/advice? Do you like system400 + utilities in the IBM i community? Did you walk me into a political hornet nest with 'bob community' (Lamb to slaughter)??

    Reminder:

    You asked me to demonstrate easy pattern Makefile. Well, system400 + utilities is easiest solution. Very flexible. Completely user expandable. Chroot friendly. Our world is politics, art, and opinion, so ... shall i will continue ... shall i not???

    There was a general choice:

    1) Map command with -key "value" (simple shell parsing -- for anybody).

    $ crtrpgmod -r /QOpenSys/db2sock -s xmlmain.rpgle -l xmlservice
    ==> xmlservice/xmlmain -- 00 highest severity
    

    2) Look more like QCMD (lot more shell parsing - for shell experts).

    $ crtrpgmod "MODULE(xmlservice/xmlmain) SRCSTMF('/QOpenSys/db2sock/home/db2sock/xmlservice-rpg/xmlmain.rpgle') DBGVIEW(*SOURCE) OUTPUT(*PRINT) REPLACE(*YES) TGTCCSID(37)"
    ==> xmlservice/xmlmain -- 00 highest severity
    
  4. Aaron Bartell

    I am now subscribed (wish they would subscribe repo creators by default, bleh).

    I do like this idea. They key is to find the best syntax. Best approach is probably "how would most people expect it to work". The smoothest transition for existing RPG devs would be to keep true to how the commands are composed on 5250 telnet.

    Part of me wonders if the following would work fine, and then crtrpgmod would combine everything after the crtrpgmod command into a single string and run it. I forget what rules bash has for what needs to be in double quotes.

    crtrpgmod MODULE(xmlservice/xmlmain) SRCSTMF('/QOpenSys/db2sock/home/db2sock/xmlservice-rpg/xmlmain.rpgle') DBGVIEW(*SOURCE) OUTPUT(*PRINT) REPLACE(*YES) TGTCCSID(37)
    

    Ok, the above was me thinking out loud. Now I am thinking it wouldn't be worth it to create crtrpgmod unless it actually made things better from a PASE standpoint, like being able to do things like the following:

    crtrpgmod -s $SRCMBR -l $LIB
    

    On final note, how hard is it for devs to just do your previous example with string interpolation? I am trying to justify if it's worth the time to even do it.

    system400 -cmd "crtpgm MODULE($LIB/$SRCMBR)"
    

    As you can see, I am of no help because I am perfectly straddling a fence :-)

  5. Jeff Berman Account Deactivated

    I think that's a great idea, to make PASE-friendly versions of IBM i-native commands. As for the syntax, my thoughts (FWIW) is to make them feel more like Unix commands and not try to emulate native syntax. If an i developer is using PASE, it is reasonable to expect them to learn to be PASEy. Nothing wrong with

    crtrpgmod --module myMod --srcstmf 'path/to/source/file' --text 'Some description'
    

    That shouldn't be that foreign to i developers.

    Any thoughts on how to handle unsupported command parameters?

  6. Jeff Berman Account Deactivated

    Tony Cairns said:

    Did you walk me into a political hornet nest with 'bob community' (Lamb to slaughter)??

    I think I can speak for the 'Bob community', but I don't understand your concern. 😃 Your proposal doesn't obviate Bob, but it would simplify the object compile recipes. Tell me if I'm wrong, here. Bob adds value by making it easy to set compile attributes for classes of objects, collecting compile listings, managing logical file attachment, generating GENCSRC 'include' files on files for C code, collecting and managing header file and object file dependencies, and RDi integration. The goal was to create a system that would be easy for existing IBM i developers to use without having to learn a bunch of extra stuff, and I think we did that. To use Bob you basically just have to add each object and its dependencies to a text file.

    I sent you (@rangercairns) an email a few days ago, maybe you didn't see it? I had noticed your comments about Bob and was hoping to pick your brain to make it stronger (Bob, I mean, not your brain).

  7. Former user Account Deleted reporter

    I am perfectly straddling a fence :-)

    Me too. I suspect system400 can 'do' any parameter syntax. So, absence of epiphany, just do something PASE(ish) with mapping -key/value?

    Any thoughts on how to handle unsupported command parameters?

    Popular demand? New versions (crtrpgmod 'next one')?

    BTW -- Observationally, i never used all options of crtrpgmod. QCMD F4 prompt and F10 expand ... and ... my eyes roll back into my head overwhelmed.

  8. Aaron Bartell

    So, absence of epiphany, just do something PASE(ish) with mapping -key/value?

    Yeah, I think that's the best place to start.

  9. Former user Account Deleted reporter

    I sent you (Tony Cairns) an email a few days ago, maybe you didn't see it? I had noticed your comments about Bob and was hoping to pick your brain to make it stronger (Bob, I mean, not your brain).

    Do not recall an email (i am old guy).

    Anyway, first, and perhaps fatal, i am not a Bob user (opinion worth 2 cents).

    To play along, Bob reminds me of 'superman'. Obviously a lot of work and insight spent in the project. In fact, Bob seems an entire project manager IDE that 'does everything'. I suspect Bob(all) is great for folks desiring cradle to grave project environments (IDEs). However, personally, geek me, does not use IDE(s). Perhaps why Bob(ing) seems overwhelming to me (QCMD F4 prompt).

    system400 + utilities

    I like simple. IBM i IFS chroot sandbox. Makefile + utilities (crtrpgmod). If/when i do 'project edit source' things on my PC (Linux), scp transfer whole thing to IFS.

    laptop:
    > cd system400
    > gedit file.rpgle
    > scp -r * ut28p63:/QOpenSys/db2sock/home/db2sock/system400
    
    ssh -X db2sock@ut28p63 (chroot /QOpenSys/db2sock):
    > cd system400 
    > make
    

    Bob + system400 == good?

    Maybe? I just don't know. Worse, me, never use IDE person, perhaps worst person to ask.

  10. Former user Account Deleted reporter

    Ok, I updated system400 to allow db2 operations (similar to db2util). Please read the overview to see if i am clear on how to pass db2 parameters (?,?,?).

    $ system400 -d "select LSTNAM,CITY,STREET,ZIPCOD,BALDUE from QIWS/QCUSTCDT where LSTNAM=? or LSTNAM=?" -? Jones Vine
     -LSTNAM Jones -CITY Clay -STREET "21B NW 135 St" -ZIPCOD 13041 -BALDUE 100.00
     -LSTNAM Vine -CITY Broton -STREET "PO Box 79" -ZIPCOD 5046 -BALDUE 439.00
    

    BTW - Also system400 db2 option works with xmlservice. So, if you do not mind 'xml', you can call anything now with system400.

    ===
    ===
    call qxmlserv.iplugr512k(?,?,?)
    ? - ipc - /path/route private connection (xtoolkit job)
    ? - ctl - *here (no ipc) or *sbmjob (ipc)
    ? - xml - xml request (all one line)
    Note:
        qxmlserv - Apache DG0 product PTF (use any compiled xmlservice lib, ZENDSVR6, XMLSERVICE, etc.)
        xmlservice - ZZVLAD test download xmlservice yips (call crttest)
        xml input (-?) and output (-OUT151) below all one line for shell scripting (line feed visual only)
    ===
    system400 -d "call qxmlserv.iplugr512k(?,?,?)" -? "na" "*here" 
    "<?xml version='1.0'?><script><cmd exec='rexx'>RTVJOBA CCSID(?N) USRLIBL(?)</cmd></script>"
     -OUT151 
    "<?xml version='1.0'?>
    <script>
    <cmd exec='rexx'><success>+++ success RTVJOBA CCSID(?N) USRLIBL(?)</success> 
    <row> <data desc='CCSID'>37</data> </row> 
    <row> <data desc='USRLIBL'>QGPL       QTEMP      QDEVELOP   QBLDSYS    QBLDSYSR</data> </row> 
    </cmd> 
    </script>"
    
  11. Former user Account Deleted reporter

    Guys, i am less a salesmen. However, sales speaking, system -d iplugr512(?,?,?), ability to call xmlservice means we can call anything on IBM i machine. To wit, like crtrpgmod (project), we can now build little utilities calling xmlservice for anything (RTVJOBA, myownpgm, mysrvpgm, etc.). That is, my opinion, fills stated goal 'system400 swiss army knife'.

    Do you understand? Do you agree? Is it pretty?

  12. Aaron Bartell

    Is this a new output** format and is there a reason you went with it? Just trying to wrap my head around what you've created. I was expecting something like JSON, though maybe this hyphenated output has command line benefits.

    **

    $ system400 -d "select LSTNAM,CITY,STREET,ZIPCOD,BALDUE from QIWS/QCUSTCDT where LSTNAM=? or LSTNAM=?" -? Jones Vine
     -LSTNAM Jones -CITY Clay -STREET "21B NW 135 St" -ZIPCOD 13041 -BALDUE 100.00
     -LSTNAM Vine -CITY Broton -STREET "PO Box 79" -ZIPCOD 5046 -BALDUE 439.00
    
  13. Former user Account Deleted reporter

    I was expecting something like JSON, though maybe this hyphenated output has command line benefits.

    My belief of 'system400' is shell scripting and/or command line tool. Shell scripting is generally parsed as space separated values. That is, all shells like to 'tokenize" (for thing in $thinglist), so the 'hyphenated output' plays ball with this idea. Specific in example -LSTNAM Jones does not need quotes, but -STREET "21B NW 135 St" requires quotes. The only deviation is the rows are 'tokenized' by 'new line', which is also a convention for shell scripting files, etc.

    So, I have no objection to many different formats 'popping' output of 'system400', but things like JSON are not directly parse-able by shell scripts as "parameters".

  14. Former user Account Deleted reporter

    Easier to see an example ...

    In example below system400 data piped to awk, then awk "cherry picks" LASTNAM (key/value) and BALDUE (key/value). Very easy to script with system400 (i think). However, JSON output would be significant work in shell, and/or, require a high level language like python, php, ruby, node, etc.

    bash-4.3$ system400 -d "select LSTNAM,CITY,STREET,ZIPCOD,BALDUE from QIWS/QCUSTCDT where LSTNAM=? or LSTNAM=?" -? Jones Vine |  awk -F- '{print $2 $NF}'
    
    LSTNAM Jones BALDUE 100.00
    LSTNAM Vine BALDUE 439.00
    
  15. Former user Account Deleted reporter

    I added a rtvjoba utility to system400. Simple scripting example using system400 and xmlservice to enable 'unique' IBM i command rtvjoba with input/output parameters.

    Syntax:
      rtvjoba CURUSER TYPE SUBTYPE SYSLIBL CURLIB USRLIBL ASPGRP LOGLVL ...
    
    bash-4.3$ rtvjoba CURUSER CCSID USRLIBL 
    -CURUSER DB2SOCK -CCSID 37 -USRLIBL "QGPL QTEMP QDEVELOP QBLDSYS QBLDSYSR"
    
  16. Former user Account Deleted reporter

    I added/fixed multiple utilities crtrpgmod, crtpgm, crtsqlrpgi, dsplib, dsplibl, rtvjoba, wrkactjob ...

    Any thoughts on how to handle unsupported command parameters?

    We have a -o or -option mechanism built into utilities to enable less common options.

    bash-4.3$ crtsqlrpgi -h                                                          
    Syntax:
      crtsqlrpgi
        -h|--help
        -r|--root /rootpath/mychroot (1)
        -s|--src mycool.rpgle
        -l|--lib mylib
        -g|--debug
        -o|--option "TEXT('my module')"
    Note:
     (1) -r|--root alternative
         > export CHROOT=/rootpath/mychroot
    
    bash-4.3$ crtsqlrpgi -s xmlstoredp.rpgle -l xmlservice -o "text('tony was here')"
    system400 -qsh 'CRTSQLRPGI OBJ(xmlservice/xmlstoredp) OBJTYPE(*MODULE) 
      REPLACE(*YES) SRCSTMF('/QOpenSys/db2sock/home/db2sock/xmlservice-rpg/xmlstoredp.rpgle')
       COMPILEOPT('TGTCCSID(37) INCDIR(''/QOpenSys/db2sock/home/db2sock/xmlservice-rpg'')') 
       text('tony was here')' -r /QOpenSys/db2sock
    ==> xmlservice/xmlstoredp -- 00 highest severity
    
  17. Former user Account Deleted reporter

    Aaron, I almost have enough utilities to build all of xmlservice.

    Happily, I fixed crtpgm to return errors using db2 service mechanism for joblog. This is a BIG improvement for chroot people that never see the errors of the non-output commands (default for any system400 -cmd).

    $ crtpgm -h
    Syntax:
      crtpgm
        -h|--help
        -r|--root /rootpath/mychroot (1)
        -p|--pgm mycool
        -l|--lib mylib
        -m|--mod mycool mycool2 ...
        -o|--option "BNDSRVPGM(QHTTPSVR/QZSRCORE)"
    Note:
     (1) -r|--root alternative
         > export CHROOT=/rootpath/mychroot
    
    bash-4.3$ crtpgm -p xmlmain -l xmlservice -m xmlmain plugbug plugipc plugrun plugperf plugcach plugerr plugsql plugdb2 plugconf1 plugpase pluglic plugsig plugconv plugxml        
    system400 -cmd 'CRTPGM PGM(xmlservice/xmlmain) MODULE( xmlservice/xmlmain xmlservice/plugbug xmlservice/plugipc xmlservice/plugrun xmlservice/plugperf xmlservice/plugcach xmlservice/plugerr xmlservice/plugsql xmlservice/plugdb2 xmlservice/plugconf1 xmlservice/plugpase xmlservice/pluglic xmlservice/plugsig xmlservice/plugconv xmlservice/plugxml )' -r /QOpenSys/db2sock
    ====================================
    *** ERROR xmlservice/xmlmain
    ====================================
    -msgid SQL0443 -msgtype DIAGNOSTIC -msgsub *NULL -msgsev 30 -msgstamp 2017-06-20-15.57.44.951779 -msgtolib QSYS -msgtopgm QSQRUN4 -msgtomod QSQCALLSP -msgtoproc CLEANUP -msgtoinst 42334 -msgtxt "Trigger program or external routine detected an error."
    -msgid CPF3C50 -msgtype ESCAPE -msgsub EXCEPTION HANDLED -msgsev 40 -msgstamp 2017-06-20-15.57.44.949745 -msgtolib QSYS -msgtopgm QSQRUN4 -msgtomod QSQCALLSP -msgtoproc CALLPROGRAM -msgtoinst 43225 -msgtxt "Program XMLMAIN not created."
    -msgid CPD5D02 -msgtype DIAGNOSTIC -msgsub *NULL -msgsev 30 -msgstamp 2017-06-20-15.57.44.949703 -msgtolib QSYS -msgtopgm QBNBIND -msgtomod QBNBSYMR -msgtoproc QBNBSYMR__SignalUnresolvedReferences -msgtoinst 8 -msgtxt "Definition not found for symbol 'LILASSIST'."
    -msgid CPD5D02 -msgtype DIAGNOSTIC -msgsub *NULL -msgsev 30 -msgstamp 2017-06-20-15.57.44.949683 -msgtolib QSYS -msgtopgm QBNBIND -msgtomod QBNBSYMR -msgtoproc QBNBSYMR__SignalUnresolvedReferences -msgtoinst 8 -msgtxt "Definition not found for symbol 'ILESZRET'."
    -msgid CPD5D02 -msgtype DIAGNOSTIC -msgsub *NULL -msgsev 30 -msgstamp 2017-06-20-15.57.44.949666 -msgtolib QSYS -msgtopgm QBNBIND -msgtomod QBNBSYMR -msgtoproc QBNBSYMR__SignalUnresolvedReferences -msgtoinst 8 -msgtxt "Definition not found for symbol 'ILESZPARM'."
    
    
    bash-4.3$ crtpgm -p xmlmain -l xmlservice -m xmlmain plugbug plugipc plugrun plugperf plugcach plugerr plugsql plugdb2 plugconf1 plugpase pluglic plugsig plugconv plugxml plugile
    system400 -cmd 'CRTPGM PGM(xmlservice/xmlmain) MODULE( xmlservice/xmlmain xmlservice/plugbug xmlservice/plugipc xmlservice/plugrun xmlservice/plugperf xmlservice/plugcach xmlservice/plugerr xmlservice/plugsql xmlservice/plugdb2 xmlservice/plugconf1 xmlservice/plugpase xmlservice/pluglic xmlservice/plugsig xmlservice/plugconv xmlservice/plugxml xmlservice/plugile )' -r /QOpenSys/db2sock
    ==> xmlservice/xmlmain -- ok
    
  18. Aaron Bartell

    I fixed crtpgm to return errors using db2 service mechanism for joblog.

    Very cool!

    @ataylorkt and @WorksOfBarry, thought this new feature might interest you.

  19. Former user Account Deleted reporter

    Ok, Makefile seems to create xmlservice (different libraries). Not fully tested, but seems to work.

    ### gmake TGT=YIPS
    ### gmake TGT=ZS5
    ### gmake TGT=ZS6
    ### gmake TGT=ZS7
    ### gmake TGT=IBM
    ### gmake TGT=RUBY
    ###
    ### Assumes system400 command for chroot
    ### https://bitbucket.org/litmis/system400
    ###
    
    ### ILE compile scripts
    CCRPG       = crtrpgmod
    CCRPGSQL    = crtsqlrpgi
    CCPGM       = crtpgm
    CCSRVPGM    = crtsrvpgm
    CCSQL       = db2script
    
    ### *PGM - $(INILIB)/xmlmain.pgm
    ### xmlmain.rpgle xmlthis.rpgle xmlthat.rpgle ...
    XMLLIB      = XMLSERVICE
    XMLCONF     = plugconf1.mod
    XMLSQLTPL   = crtsql.cmd
    ifeq ($(TGT), YIPS)
    XMLLIB      = XMLSERVICE
    XMLCONF     = plugconf3.mod
    endif
    ifeq ($(TGT), ZS5)
    XMLLIB      = ZENDSVR
    XMLCONF     = plugconf2.mod
    endif
    ifeq ($(TGT), ZS6)
    XMLLIB      = ZENDSVR6
    XMLCONF     = plugconf6.mod
    endif
    ifeq ($(TGT), ZS7)
    XMLLIB      = ZENDPHP7
    XMLCONF     = plugconf7.mod
    endif
    ifeq ($(TGT), IBM)
    XMLLIB      = QXMLSERV
    XMLCONF     = plugconfq.mod
    endif
    ifeq ($(TGT), RUBY)
    XMLLIB      = POWER_RUBY
    XMLCONF     = plugconfr.mod
    endif
    XMLSQLRPL   = XMLSERVICE $(XMLLIB)
    XMLMAIN     = xmlmain.pgm
    XMLSERVICE  = xmlservice.pgm
    XMLSTOREDP  = xmlstoredp.srvpgm
    XMLCOMMOBJS = $(XMLCONF) plugbug.mod plugipc.mod plugrun.mod plugperf.mod \
                    plugcach.mod plugerr.mod plugsql.mod plugdb2.mod \
                    plugpase.mod pluglic.mod plugsig.mod plugconv.mod plugxml.mod \
                    plugile.mod
    XMLMAINOBJS = xmlmain.mod $(XMLCOMMOBJS)
    XMLSERVOBJS = xmlservice.mod $(XMLCOMMOBJS)
    XMLSTOROBJS = xmlstoredp.modsql $(XMLCOMMOBJS)
    
    ### tells make all things to do (order)
    all: $(XMLMAIN) $(XMLSERVICE) $(XMLSTOREDP) crtsqlproc
    
    ### CRTRPGMOD
    .SUFFIXES: .mod .rpgle .modsql .rpglesql
    .rpgle.mod:
        $(CCRPG) --root $(CHROOT) --lib $(XMLLIB) --src $<
    .rpglesql.modsql:
        $(CCRPGSQL) --root $(CHROOT) --lib $(XMLLIB) --src $<
    
    ### -- CRTPGM
    $(XMLMAIN): $(XMLMAINOBJS)
        $(CCPGM) --root $(CHROOT) --pgm $(XMLMAIN) --lib $(XMLLIB) --mod $(XMLMAINOBJS)
    $(XMLSERVICE): $(XMLSERVOBJS)
        $(CCPGM) --root $(CHROOT) --pgm $(XMLSERVICE) --lib $(XMLLIB) --mod $(XMLSERVOBJS)
    ### -- CRTSRVPGM
    $(XMLSTOREDP): $(XMLSTOROBJS)
        $(CCSRVPGM) --root $(CHROOT) --pgm $(XMLSTOREDP) --lib $(XMLLIB) --mod $(XMLSTOROBJS) --option "EXPORT(*ALL) ACTGRP(*CALLER)"
    
    ### -- create stored procedures (iPLUG512K, etc.)
    crtsqlproc:
        $(CCSQL) -f $(XMLSQLTPL) -r $(XMLSQLRPL)
    ### -- housekeeping(optional)
    clean:
        rm -f $(XMLMAIN)
        rm -f $(XMLSERVICE)
        rm -f $(XMLSTOREDP)
        rm -f *.mod
    
  20. Former user Account Deleted reporter

    Ok, works fine.

    ### gmake TGT=YIPS
    ### gmake TGT=ZS5
    ### gmake TGT=ZS6
    ### gmake TGT=ZS7
    ### gmake TGT=IBM
    ### gmake TGT=RUBY
    ###
    ### Assumes system400 command for chroot
    ### https://bitbucket.org/litmis/system400
    ###
    
    ### ILE compile scripts
    CCRPG       = crtrpgmod
    CCRPGSQL    = crtsqlrpgi
    CCPGM       = crtpgm
    CCSRVPGM    = crtsrvpgm
    CCSQL       = db2script
    
    ### *PGM - $(INILIB)/xmlmain.pgm
    ### xmlmain.rpgle xmlthis.rpgle xmlthat.rpgle ...
    XMLLIB      = XMLSERVICE
    XMLCONF     = plugconf1.mod
    XMLSQLTPL   = crtsql.cmd
    ifeq ($(TGT), YIPS)
    XMLLIB      = XMLSERVICE
    XMLCONF     = plugconf3.mod
    endif
    ifeq ($(TGT), ZS5)
    XMLLIB      = ZENDSVR
    XMLCONF     = plugconf2.mod
    endif
    ifeq ($(TGT), ZS6)
    XMLLIB      = ZENDSVR6
    XMLCONF     = plugconf6.mod
    endif
    ifeq ($(TGT), ZS7)
    XMLLIB      = ZENDPHP7
    XMLCONF     = plugconf7.mod
    endif
    ifeq ($(TGT), IBM)
    XMLLIB      = QXMLSERV
    XMLCONF     = plugconfq.mod
    endif
    ifeq ($(TGT), RUBY)
    XMLLIB      = POWER_RUBY
    XMLCONF     = plugconfr.mod
    endif
    XMLSQLRPL   = XMLSERVICE $(XMLLIB)
    XMLMAIN     = xmlmain.pgm
    XMLSERVICE  = xmlservice.pgm
    XMLSTOREDP  = xmlstoredp.srvpgm
    XMLCGI      = xmlcgi.pgm
    XMLCOMMOBJS = $(XMLCONF) plugbug.mod plugipc.mod plugrun.mod plugperf.mod \
                    plugcach.mod plugerr.mod plugsql.mod plugdb2.mod \
                    plugpase.mod pluglic.mod plugsig.mod plugconv.mod plugxml.mod \
                    plugile.mod
    XMLMAINOBJS = xmlmain.mod $(XMLCOMMOBJS)
    XMLSERVOBJS = xmlservice.mod $(XMLCOMMOBJS)
    XMLCGIOBJS  = xmlcgi.mod $(XMLCOMMOBJS)
    XMLSTOROBJS = xmlstoredp.modsql $(XMLCOMMOBJS)
    
    ### tells make all things to do (order)
    all: $(XMLMAIN) $(XMLSERVICE) $(XMLSTOREDP) $(XMLCGI) crtsqlproc
    
    ### CRTRPGMOD
    .SUFFIXES: .mod .rpgle .modsql .rpglesql
    .rpgle.mod:
        $(CCRPG) --root $(CHROOT) --lib $(XMLLIB) --src $<
    .rpglesql.modsql:
        $(CCRPGSQL) --root $(CHROOT) --lib $(XMLLIB) --src $<
    
    ### -- CRTPGM
    $(XMLMAIN): $(XMLMAINOBJS)
        $(CCPGM) --root $(CHROOT) --pgm $(XMLMAIN) --lib $(XMLLIB) --mod $(XMLMAINOBJS)
    $(XMLSERVICE): $(XMLSERVOBJS)
        $(CCPGM) --root $(CHROOT) --pgm $(XMLSERVICE) --lib $(XMLLIB) --mod $(XMLSERVOBJS)
    $(XMLCGI): $(XMLCGIOBJS)
        $(CCPGM) --root $(CHROOT) --pgm $(XMLCGI) --lib $(XMLLIB) --mod $(XMLCGIOBJS) --option "BNDSRVPGM(QHTTPSVR/QZSRCORE)"
    ### -- CRTSRVPGM
    $(XMLSTOREDP): $(XMLSTOROBJS)
        $(CCSRVPGM) --root $(CHROOT) --pgm $(XMLSTOREDP) --lib $(XMLLIB) --mod $(XMLSTOROBJS) --option "EXPORT(*ALL) ACTGRP(*CALLER)"
    
    ### -- create stored procedures (iPLUG512K, etc.)
    crtsqlproc:
        $(CCSQL) -f $(XMLSQLTPL) -r $(XMLSQLRPL)
    ### -- housekeeping(optional)
    clean:
        rm -f $(XMLMAIN)
        rm -f $(XMLSERVICE)
        rm -f $(XMLSTOREDP)
        rm -f *.mod
    
  21. Former user Account Deleted reporter

    Aaron,

    Makefile works naturally, aka, only compiles what changes via timestamps with IFS proxies (.mod, .pgm, .srvpgm, etc.).

    For example: The system400 utility dltmod deletes both ILE library plugipc.module and IFS plugipc.mod, so you can force a recompile of only one module, and, all affected .pgm, .srvpgm will create (normal Makefile processing).

    Yada, blah, blah ... fancy Makefile works without much work ... just like a real Makefile in Linux.

    Anyway, what do you think, before update xmlservice project???

    bash-4.3$ ls xmlservice.*
    xmlservice.mod     xmlservice.pgm     xmlservice.rpgle   xmlservice.srvpgm
    bash-4.3$ ls xmlcgi.*    
    xmlcgi.mod    xmlcgi.pgm    xmlcgi.rpgle
    bash-4.3$ ls xmlmain.*
    xmlmain.mod    xmlmain.pgm    xmlmain.rpgle
    bash-4.3$ ls xmlstoredp.*
    xmlstoredp.mod       xmlstoredp.rpglesql  xmlstoredp.srvpgm
    bash-4.3$ ls plugxml.* 
    plugxml.mod    plugxml.rpgle
    bash-4.3$ ls -l xmlcgi.* 
    -rw-r--r--    1 db2sock  0                 0 Jun 21 15:25 xmlcgi.mod
    -rw-r--r--    1 db2sock  0                 0 Jun 21 15:25 xmlcgi.pgm
    -rwxr-xr-x    1 adc      0             48084 Jun 21 15:09 xmlcgi.rpgle
    bash-4.3$ ls -l plugxml.*
    -rw-r--r--    1 db2sock  0                 0 Jun 21 15:09 plugxml.mod
    -rwxr-xr-x    1 adc      0            377386 Jun 21 15:09 plugxml.rpgle
    bash-4.3$ 
    
  22. Aaron Bartell

    Anyway, what do you think, before update xmlservice project???

    I like it. I vote to do the update to xmlservice-rpg.

  23. Former user Account Deleted reporter

    Will you be adding instructions on how to git clone + make to xmlservice-rpg README.md? I can do a test run on spaces.litmis.com (chroot).

    Oh man. The dreaded 'fool proof' instructions'. Ok. I will attempt to add 'how' inext/xmlservice-rpg project. Although speaking of save time of programmer asked to document 'clearly' (me) ...

    1) Please paste favourite git clone 'litmis spaces' for inext/xmlservice-rpg project??

    2) Also, can we assume wget400 'litmis spaces' to get system400 and utilities compiled from yips???

    That is, we need both system400 and xmlservice-rpg ... save time ... i will copy your git command and wget400 as seen in a real 'litmis space' (cheat)???

  24. Aaron Bartell

    Although speaking of save time of programmer asked to document 'clearly' (me) ...

    I can put together the instructions and add them to xmlservice-rpg. Give me a bit and I will come back with any questions I have.

  25. Former user Account Deleted reporter

    We may have to play around a bit. To wit, i am using a chroot with gcc, gmake, bash, all the fun tools. Therefore, i am starting to work through things for a 'plain' litmis space ... but ... i don't know what that means for tools.

    ### gmake TGT=YIPS
    ### gmake TGT=ZS5
    ### gmake TGT=ZS6
    ### gmake TGT=ZS7
    ### gmake TGT=IBM
    ### gmake TGT=RUBY
    ###
    ### Dependencies:
    ### Assumes minimum bash (perzl?)
    ###
    ### Assumes system400 command and utilities
    ### https://bitbucket.org/litmis/system400
    ###
    ### Assumes updated yips gmake (4.2)
    ### http://www.youngiprofessionals.com/wiki/index.php/PASE/OpenSourceBinaries
    ###
    
  26. Former user Account Deleted reporter

    Hey mate, I am tired today, so not staying late. I should say that i had to change the name of 1 file in xmlservice-rpg to make everything work.

    mv xmlstoredp.rpgle xmlstoredp.rpglesql
    
    
    bash-4.3$ ls xmlstoredp.*
    xmlstoredp.mod       xmlstoredp.rpglesql  xmlstoredp.srvpgm
    bash-4.3$ ls xmlcgi.*    
    xmlcgi.mod    xmlcgi.pgm    xmlcgi.rpgle
    bash-4.3$ 
    

    Allows Makefile crtsqlrpgi to differentiate between regular RPG files and SQL pre-compile files.

    .SUFFIXES: .mod .rpgle .modsql .rpglesql
    ### CRTRPGMOD
    .rpgle.mod:
        $(CCRPG) --root $(CHROOT) --lib $(XMLLIB) --src $<
    ### CRTSQLRPGI
    .rpglesql.modsql:
        $(CCRPGSQL) --root $(CHROOT) --lib $(XMLLIB) --src $<
    

    Seems perfectly reasonable in my opinion because crtrpgmod and crtsqlrpgi are different commands.

  27. Former user Account Deleted reporter

    Opps just noticed a bug in little crtsqlrpgi utility not touching xmlstoredp.modsql (will fix).

  28. Former user Account Deleted reporter

    Ok, fixed the problem. Specifically, xmlstoredp.rpglesql was compiling every time because crtsqlrpgi was never touching xmlstoredp.modsql. Works now.

    bash-4.3$ ls -l xmlstoredp.*
    -rw-r--r--    1 db2sock  0                 0 Jun 21 16:30 xmlstoredp.modsql
    -rwxr-xr-x    1 adc      0             25770 Jun 21 15:09 xmlstoredp.rpglesql
    -rw-r--r--    1 db2sock  0                 0 Jun 21 16:30 xmlstoredp.srvpgm
    
  29. Aaron Bartell

    I am quickly finding that the rpm package management solution can't come soon enough (the one JesseG announced at COMMON). Spent the better part of an hour yesterday trying to work through documenting this setup and kept running into issues of "manual-ness" (i.e. had to upgrade gmake, had to get latest version of cURL so certs would work with https Git, etc, etc).

    I will continue working through it, but I have some pressing Node.js issues to work through at the moment so this will have to take a back seat to that.

  30. Former user Account Deleted reporter

    I am quickly finding that the rpm package management solution can't come soon enough (the one JesseG announced at COMMON).

    Yes. IBM i administrator community resistance to rpm 'managers' is futile. Anyway, you/i know that rpm, rpmbuild, createrepo works from our ibmichroot prototype. Now we wait (internal politics).

    This project big news is probably the system400 utilities. If we continue to expand the set, we may never need to touch another 5250 green screen. I, I, I feel a song coming on ...

    Home, home, home in ssh.

    Where crtpgm, wrkactjob, all play.

    Where seldom is heard, green screen words.

    And shell geeks are happy all day.

  31. Former user Account Deleted reporter

    Speaking of system400 utilities, i smell a LIBL storm coming ... Hopefully, everyone understands the nature of 'scripting' (cough, i doubt it!). Especially when comes to impossible job setting the LIBL.

    Specifically, system400 uses a QSQSRVR proxy job for each command 'stateless'. That is, each command runs in current profile (your profile LIBL), then releases QSQSRVR job. This 'extra job idea' is exactly what happens in any Linux/PASE script, aka, works perfect (long live QSQSRVR jobs). However, also means you cannot 'script' a system400 addlible command, then call crtrpgmod and expect LIBL to 'stay' changed. My experience, IBM i folks are driven to near LIBL madness by this normal 'stateless' scripting idea. Perhaps we should acknowledge the role that LIBL plays in 'everything' and get out in front with system400 utilities??

    Proposal: We already have one 'global' env var to handle 'hiding in a chroot'' that system400 utilities 'understand'. Why not add a few for a little IBM i respect for the LIBL??

    The idea is system400 opens connection to QSQSRVR job (db2 connect), then run CHGLIBL, and CHGCURLIB, before running your other utility. This way each command will be sure the correct LIBL is set for any operation.

    export CHROOT=/rootpath/mychroot
    
    export LIBL="MYLIB YOURLIB BOBLIB"
    export CURLIB=MYLIB
    

    I like LIBL idea for system400. Any objection??

  32. Former user Account Deleted reporter

    Something like this ...

    $ system400 -h    
    Syntax (Version 1.0.11):
      system400 -q|-qsh -c|-cmd -d|-db2 command/sql [-root /path/mychroot | -? db2parm1 'db2 parm 2' ...]
        -q|-qsh    - qsh system '*CMD' with *OUTPUT expected
        -c|-cmd    - *CMD no *OUTPUT expected
        -d|-db2    - DB2 SQL
        -r|-root   - chroot root /path/mychroot (CHROOT)
                     $export CHROOT=/path/mychroot
       -ll|-libl   - *LIBL CHGLIBL before command execution (LIBL)
                     $export LIBL="MYLIB YOURLIB BOBLIB"
       -al|-addlib - *LIBL ADDLIBLE before command execution (ADDLIB)
                     $export ADDLIB=MYLIB
       -cl|-curlib - *LIBL CHGCURLIB before command execution (CURLIB)
                     $export CURLIB=MYLIB
    Syntax(alternative positional obsolete, but works):
      system400 command/sql [/path/mychroot | db2parm1 'db2 parm 2' ...]
    
  33. Former user Account Deleted reporter

    Bingo. Works like a charm. Goodbye sweet QCMD and STRSQL, was nice to know you.

    bash-4.3$ dsplib -l db2 | grep -i stock            
        STOCKPRICE  *FILE     PF                   49152
    bash-4.3$ export ADDLIB=DB2                        
    bash-4.3$ system400 -db2 "select * from STOCKPRICE"
     -ID 10 -COMPANY Megadeth -STOCKSHARE 100.00 -STOCKPRICE 990.3567364883884
     -ID 20 -COMPANY Zaral -STOCKSHARE 102.20 -STOCKPRICE 100.234
     -ID 30 -COMPANY Megabyte -STOCKSHARE 98.65 -STOCKPRICE 1002.112
     -ID 40 -COMPANY Visarsoft -STOCKSHARE 123.34 -STOCKPRICE 1652.345
     -ID 50 -COMPANY Mailersoft -STOCKSHARE 134.22 -STOCKPRICE 1643.126
     -ID 60 -COMPANY Kaerci -STOCKSHARE 100.97 -STOCKPRICE 9876.765
     -ID 70 -COMPANY Nirvana -STOCKSHARE 100.12 -STOCKPRICE 100.567
    bash-4.3$ unset ADDLIB
    bash-4.3$ system400 -db2 "select * from STOCKPRICE"
    Error STOCKPRICE in *LIBL type *FILE not found. SQLCODE=-204
    
  34. Jeff Berman Account Deactivated

    Looks good. I like the -addlib option to quickly add a library to whatever default ones are in the list.

  35. Former user Account Deleted reporter

    Spent the better part of an hour yesterday trying to work through documenting this setup and kept running into issues of "manual-ness" (i.e. had to upgrade gmake, had to get latest version of cURL so certs would work with https Git, etc, etc).

    So, implied politics in this statement. Summary, if i may, attempting to demonstrate end-2-end development tools. That is, git, curl, gmake, and so on. If i may be bold, not baby step working with Makefile for ILE compiles. So, may i suggest a less ambitious activity. I am thinking baby steps system400.

    The system400 project has two sections...

    1) system400 - backbone of running commands outside the chroot (or root).

    2) system400/utils - short cut tools named same as IBM i commands (QCMD in a box).

    I suggest we add a third section

    3) system400/samples - demonstrate how to use system400 and utilities in a chroot.

    This samples section could have a small Makefile example for building RPG, etc. Perhaps demonstrate a progressive adding of tools ...

    a) system400/samples/step1-hello - set-up a minimal chroot understand using system400 command line to compile RPG HelloWorld.pgm and RPG HelloWorldService.srvpgm

    b) system400/samples/step2-make - use PASE make Makefile to compile RPG HelloWorld.pgm and RPG HelloWorldService.srvpgm

    c) system400/samples/step3-gmake - use perzl/yips gmake Makefile to compile RPG HelloWorld.pgm and RPG HelloWorldService.srvpgm

    d) system400/samples/step4-git - add git functions to environment

    e) ... so on ...

    Is this what is really needed?

    There is significant IBM i community politics of good/bad binaries with 'downloads' Pezl/aix toolbox/IBM i OPS (cough, nonsense, but i am only geek). To wit, I am largely doing this activity at your request, so, what 'binary color pencil' Makefile tooling do you want samples to follow??

  36. Former user Account Deleted reporter

    FYI -- I like most utilities minimal parameter approach with -o|--option to add 'exotic' parms. The --options is essentially a cut/paste of QCMD F4 additions. Of course, any user interface is eye of the beholder, so, well, you may have to weigh in on 'reasonably functional'.

    Warning - crtclpgm (QCMD side), does not take IFS files as input, therefore, system400 crtclpgm needs to copy to lib/qclsrc(mbr). I have this working, but i am NOT satisfied with this interface. I will look at it later this morning.

    option read

    Why adding IBM i system400 and utility commands???

    First, PASE shipped 'system' command does not work well in chroot. In fact, print(OUTPUT) is missing from commands with PASE 'system'. Second, PASE 'system' did read the errors joblog of CMDs not supporting print(OUTPUT). Third, PASE 'system' never intended to handle DB2 requests like STRSQL. All in all, PASE 'system' is not much help for us chroot shell geeks.

    So ... Open Source system400. The system400 tool is a clean DB2 style escape of chroot to do all things PASE 'system'. Also, we can add common tasks mentioned above. Feel free to contribute, there are a lot of IBM i commands to wrapper.

  37. Former user Account Deleted reporter

    Ok fixed crtclpgm. Well, at least works with QCMD crtclpgm (lib/src.mbr).

  38. Aaron Bartell

    Is this what is really needed?

    That's a tough one to answer. I've written oodles of articles in the past 3 years and, at the time, they were needed for those on the bleeding edge (i.e. showing how to install git from perzl, showing how to install/configure nginx from perzl, etc). Now those same un-editable articles are relics of confusion because IBM's Git and Nginx deliverables are better than Perzl's.

    All that to say, if someone has time to author the (editable) install instructions in this repo I'd say have at it... as long as there is a plan to update the editable instructions once IBM's package manager is released.

  39. Former user Account Deleted reporter

    I've written oodles of articles in the past 3 years ... un-editable articles are relics of confusion because IBM

    Thanks for your work. Every movement begins somewhere. In this case, IBM i has 'slowly' realized some value in 'Linux stuff' (node, python, php, etc.). Thanks again.

  40. Former user Account Deleted reporter

    All that to say, if someone has time to author the (editable) install instructions in this repo I'd say have at it... as long as there is a plan to update the editable instructions once IBM's package manager is released.

    Ok. Absent "IBM's package manager", we can demonstrate download, unzip, ftp/copy to IBM i location.

  41. Former user Account Deleted reporter

    un-editable articles are relics of confusion

    The system400 tool does not need anything beyond PASE shipped code. The compiled program NOT require anything gcc, Perzl, AIX toolbox, OPS (after compile). The shells are simple '/usr/bin/sh', nothing 'additional' to install. I believe staying IBM PASE/AIX shipped 'make' chroot demonstration will eliminate any 'additional tool' confusion using system400 for compiling ILE RPG code, etc.

    BTW -- I only use gmake because i like it personally.

  42. Aaron Bartell

    Ok. Absent "IBM's package manager", we can demonstrate download, unzip, ftp/copy to IBM i location.

    Yep, that sounds like the best path at this point until we have the package manager. That's an approach everyone currently understands.

  43. Former user Account Deleted reporter

    Ok, two more questions.

    1) Are you currently still using ibmichroot project?

    2) Are you using Perzl rpm manger (absent IBM full strategy package manger)??

    I only ask, so i can setup the chroot in the example.

  44. Former user Account Deleted reporter

    BTW -- There is more than likely chance that both system400 and db2sock project will be part of the new IBM 'packages' (forest for the trees).

  45. Aaron Bartell

    1) Are you currently still using ibmichroot project?

    Yes, we are using it for both Litmis Spaces and customer implementations.

    2) Are you using Perzl rpm manger (absent IBM full strategy package manger)??

    We are using pkg_setup.sh and the corresponding .lst config files as the primary means to automate the install of open source.

    BTW -- There is more than likely chance that both system400 and db2sock project will be part of the new IBM 'packages'. (Just in case you have lost the forest from the trees).

    I was hoping this would be the case.

  46. Aaron Bartell

    Project rename!

    In an effort to "move on" from "400" (old name with old technology) we've renamed this project to borgi. Let the fun of naming open source projects with fanciful names commence :-)

    New project is housed here. Please follow that repo for all future updates.

    borgi.png

  47. Jeff Berman Account Deactivated

    Well that was whimsical! :-)

    Any reason it's a separate project from this one? Does BitBucket allow renaming projects?

  48. Aaron Bartell

    Any reason it's a separate project from this one? Does BitBucket allow renaming projects?

    They do allow renames. The benefit to creating a new one is then this one can be made to redirect to the new one vs. it coming up with a 404. At least that's what I believe I've read.

  49. Jeff Berman Account Deactivated

    They do allow renames. The benefit to creating a new one is then this one can be made to redirect to the new one vs. it coming up with a 404. At least that's what I believe I've read.

    That's interesting. I haven't used BitBucket, but GitHub remembers the old name and automatically redirects to the new one.

  50. Log in to comment