From YiPs Wiki (i powered)

XMLSERVICE: XMLSERVICE Gem Changelog

(click to open)

Quick Page Table of Contents

Scanning…

Ruby XMLSERVICE gem …

Goto Main Page
Goto Documents
Goto Ruby Page

Tony no longer updating /PowerRuby xmlservice or ibm_db gem (see Andrea).

ChangeLog xmlservice

Date Zip Desc
2014–11–05 1.3.0-GA5 TESTS ONLY: Test change for Andrea (see README_IBM_i)//
=================
run tests (script)
=================
-- change values --
> cd xmlservice
> edit zztestdb2.sh zztestrest.sh
export TEST_URL=http://174.79.32.155/cgi-bin/xmlcgi.pgm (YIPS)
export TEST_USER=DB2
export TEST_PWD=PWD

-- run --
> cd xmlservice
> ./zztestdb2.sh    (test db2 driver)
> ./zztestrest.sh   (test rest driver)
2014–10–09 1.3.0-GA4 FIX: ‘vary=‘ to ‘varying=‘ lib/xmlservice.rb (Tony — fix also git xmlservice)
2014–04–29 1.3.0-GA3

YIPS: updated YIPS 1.9.3, 2.0.0, 2.1.0
FIX: ‘@’ name error message 2.0, 2.1 (Aaron)

2014–04–29 1.3.0-GA2 YIPS: updated YIPS 1.9.3, 2.0.0, 2.1.0
NEW: xmlservice DSL create and return aggregate(Aaron)
 # ---------------------
 # xmlservice call PGM or SRVPGM
 # mypgm = XMLService::I_SRVPGM.new("ZZLOTS","ZZMANY","ZZLIB",{'error'=>'on'})
 # ===================================
 # paramters input/output (io='both')
 # ===================================
 # mypgm.input_parms do
 #  bin "mybin", 4               # mypgm.input.mybin = 'DEADBEEF'         PARM0
 #  char "mychar", 32            # mypgm.input.mychar = 'Hi there'        PARM1
 #  varchar "myvchar", 64        # mypgm.input.myvchar = 'Hi variable'    PARM2
 #  varchar4 "myvchar4", 1024    # mypgm.input.myvchar4 = 'Hi variable 4' PARM3
 #  tiny "mytiny"                # mypgm.input.mytiny = 1                 PARM4
 #  short "myshort"              # mypgm.input.myshort = 11               PARM5
 #  long "mylong"                # mypgm.input.mylong = 1111              PARM6
 #  longlong "myll"              # mypgm.input.myll = 11111111            PARM7
 #  utiny "myutiny"              # mypgm.input.myutiny = 1                PARM8
 #  ushort "myushort"            # mypgm.input.myushort = 11              PARM9
 #  ulong "myulong"              # mypgm.input.myulong = 1111             PARM10
 #  ulonglong "myull"            # mypgm.input.myull = 11111111           PARM11
 #  real "myreal4", 2            # mypgm.input.myreal4 = 11.11            PARM12
 #  float4 "myfloat4", 2         # mypgm.input.myfloat4 = 11.11           PARM13
 #  double "mydouble8", 4        # mypgm.input.mydouble8 = 1111.1111      PARM14
 #  float8 "myfloat8", 4         # mypgm.input.myfloat8 = 1111.1111       PARM15
 #  dec "mypack", 12, 2          # mypgm.input.mypack = 11111.11          PARM16
 #  zone "myzone", 8, 4          # mypgm.input.myzone = 11111.1111        PARM17
 #  tiny_enddo "mytinye"         # mypgm.input.mytinye = 1                PARM18  (enddo='mytinye')
 #  short_enddo "myshorte"       # mypgm.input.myshorte = 1               PARM19  (enddo='myshorte')
 #  long_enddo "mylonge"         # mypgm.input.mylonge = 1                PARM20  (enddo='mylonge')
 #  longlong_enddo "mylle"       # mypgm.input.mylle = 1                  PARM21  (enddo='mylle')
 #  utiny_enddo "myutinye"       # mypgm.input.myutinye = 1               PARM22  (enddo='myutinye')
 #  ushort_enddo "myushorte"     # mypgm.input.myushorte = 1              PARM23  (enddo='myutinye')
 #  ulong_enddo "myulonge"       # mypgm.input.myulonge = 1               PARM24  (enddo='myushorte')
 #  ulonglong_enddo "myulle"     # mypgm.input.myulle = 1                 PARM25  (enddo='myulle')
 #  real_enddo "myreal4e", 2     # mypgm.input.myreale = 1                PARM26  (enddo='myreale')
 #  float4_enddo "myfloat4e", 2  # mypgm.input.myfloat4e = 1              PARM27  (enddo='myfloat4e')
 #  double_enddo "mydouble8e", 4 # mypgm.input.double8e = 1               PARM28  (enddo='mydouble8e')
 #  float8_enddo "myfloat8e", 4  # mypgm.input.myfloat8e = 1              PARM29  (enddo='myfloat8e')
 #  dec_enddo "mypacke", 12, 2   # mypgm.input.mypacke = 1                PARM30  (enddo='mypacke') <-------------
 #  zone_enddo "myzonee", 8, 4   # mypgm.input.myzonee = 1                PARM31  (enddo='myzonee')              |
 #  struct "myds1",42 do         # mypgm.input.myds1                      PARM32                                 |
 #    varchar "ds1varchar", 64   # mypgm.input.myds1[0].ds1varchar = 'hi'                                        |
 #    dec "ds1packe", 12, 2      # mypgm.input.myds1[1].ds1packe = 222.22                                        |
 #    struct "myds2",42 do       # mypgm.input.myds1[2].myds2                                                    |
 #      char "ds2char", 32       # mypgm.input.myds1[2].myds2[0].ds2char = 'hi hi'                               |
 #      zone "ds2zone", 8, 4     # mypgm.input.myds1[2].myds2[1].ds2zone = 33.3333                               |
 #      struct_dou "myds3",42,"mypacke" do  # mypgm.input.myds1[2].myds2[2].myds3           (dou='mypacke') <-----
 #        char "ds3char", 32                # mypgm.input.myds1[2].myds2[2].myds3[0].ds3char = 'hi hi hi'        |
 #        zone "ds3zone", 8, 4              # mypgm.input.myds1[2].myds2[2].myds3[1].ds3zone = 44.4444           |
 #      end                                                                                                      |
 #    end                                                                                                        |
 #  end                                                                                                          |
 # end                                                                                                           |
 # ====================                                                                                          |
 # output only (return)                                                                                          |
 # ====================                                                                                          |
 # mypgm.return_parms do                                                                                         |
 #  struct "rtds1",42 do                    # mypgm.returndata.rtds1                                             |
 #    varchar "rt1vchar", 64                # mypgm.returndata.rtds1[0..42].rt1vchar                             |
 #    dec "rt1packed", 12, 2                # mypgm.returndata.rtds1[0..42].rt1packed                            |
 #    struct "rtds2",42 do                  # mypgm.returndata.rtds1[0..42].rtds2                                |
 #      char "rt2char", 32                  # mypgm.returndata.rtds1[0..42].rtds2[0..42].rt2char                 |
 #      zone "rt2zoned", 8, 4               # mypgm.returndata.rtds1[0..42].rtds2[0..42].rt2zoned                |
 #      struct_dou "rtds3",42,"mypacke" do  # mypgm.returndata.rtds1[0..42].rtds2[0..42].rtds3 (dou='mypacke') <--
 #        char "rt3char", 32                # mypgm.returndata.rtds1[0..42].rtds2[0..42].rtds3[0..mypacke].rt3char
 #        zone "rt3zoned", 8, 4             # mypgm.returndata.rtds1[0..42].rtds2[0..42].rtds3[0..mypacke].rt3zoned
 #      end
 #    end
 #  end
 # end
 # ==================== 
 # output 
 # ====================
 # puts mypgm.response.mybin
 # puts mypgm.response.mychar
 # puts mypgm.response.myvchar
 # puts mypgm.response.myvchar4 
 # puts mypgm.response.mytiny
 # puts mypgm.response.myshort
 # puts mypgm.response.mylong
 # puts mypgm.response.myll
 # puts mypgm.response.myutiny
 # puts mypgm.response.myushort
 # puts mypgm.response.myulong
 # puts mypgm.response.myull
 # puts mypgm.response.myreal4
 # puts mypgm.response.myfloat4
 # puts mypgm.response.mydouble8
 # puts mypgm.response.myfloat8
 # puts mypgm.response.mypack
 # puts mypgm.response.myzone
 # puts mypgm.response.mytinye
 # puts mypgm.response.myshorte
 # puts mypgm.response.mylonge
 # puts mypgm.response.mylle
 # puts mypgm.response.myutinye
 # puts mypgm.response.myushorte
 # puts mypgm.response.myulonge
 # puts mypgm.response.myulle
 # puts mypgm.response.myreale
 # puts mypgm.response.myfloat4e
 # puts mypgm.response.double8e
 # puts mypgm.response.myfloat8e
 # puts mypgm.response.mypacke
 # puts mypgm.response.myzonee
 # puts mypgm.response.myds1
 # puts mypgm.response.myds1[0..42].ds1varchar
 # puts mypgm.response.myds1[0..42].ds1packe
 # puts mypgm.response.myds1[0..42].myds2
 # puts mypgm.response.myds1[0..42].myds2[0..42].ds2char
 # puts mypgm.response.myds1[0..42].myds2[0..42].ds2zone
 # puts mypgm.response.myds1[0..42].myds2[0..42].myds3
 # puts mypgm.response.myds1[0..42].myds2[0..42].myds3[0..mypacke].ds3char
 # puts mypgm.response.myds1[0..42].myds2[0..42].myds3[0..mypacke].ds3zone
 # puts mypgm.returndata.rtds1
 # puts mypgm.returndata.rtds1[0..42].rt1vchar
 # puts mypgm.returndata.rtds1[0..42].rt1packed
 # puts mypgm.returndata.rtds1[0..42].rtds2
 # puts mypgm.returndata.rtds1[0..42].rtds2[0..42].rt2char
 # puts mypgm.returndata.rtds1[0..42].rtds2[0..42].rt2zoned
 # puts mypgm.returndata.rtds1[0..42].rtds2[0..42].rtds3 (dou='mypacke')
 # puts mypgm.returndata.rtds1[0..42].rtds2[0..42].rtds3[0..mypacke].rt3char
 # puts mypgm.returndata.rtds1[0..42].rtds2[0..42].rtds3[0..mypacke].rt3zoned
 # ---------------------

2014–04–28 1.3.0-GA1 YIPS: updated YIPS 1.9.3, 2.0.0, 2.1.0
NEW: xmlservice DSL for create (Aaron)

    # call IBM i ZZCALL (default values)
    zzcall = XMLService::I_PGM.new("ZZCALL",$toolkit_test_lib,{'error'=>'fast'})
    zzcall.input_parms do
     char "inchara", 1
     char "incharb", 1
     dec "indec1", 7, 4
     dec "indec2", 12, 2
     struct("inds1", 1) do
       char "dschara", 1
       char "dscharb", 1
       dec "dsdec1", 7, 4
       dec "dsdec2", 12, 2
     end
    end

    parms = [ {'inchara'=>'1'},
              {'incharb'=>'1'},
              {'indec1'=>11.1111},
              {'indec2'=>111.11},
              {'inds1'=>[{'dschara'=>'2'},{'dscharb'=>'2'},{'dsdec1'=>22.2222},{'dsdec2'=>222.22}]} ]
    zzcall.call(parms)

 types include ... 
  struct, 
  bin, 
  char, varchar, varchar4, 
  tiny, short, long, longlong, 
  utiny, ulong, ulonglong, 
  dec, zone, 
  real, float4, 
  double, float8 ...

2014–03–18 1.2.0-GA3 YIPS: NOT update YIPS 1.9.3, 2.0.0, 2.1.0
NEW: xmlservice REST encode xml for special characters like % in query below (Bruno)
    likethis = 'Peaches%'
    query = XMLService::I_DB2.new("select * from DB2/animals where NAME LIKE ?",{'name'=>likethis},{'error'=>'on'})
    query.xmlservice
    rc = query.xmlservice_error
    if rc
      puts query.dump_all()
    end
    puts "\n+++++++++ dump_inspect ++++++++++++++++"
    puts query.dump_inspect
    puts "\n+++++++++ response output ++++++++++++++++"
    puts query.out_xml
2014–03–14 1.2.0-GA2 INCOMPATIBLE: 1.2.0 incompatible with previous 1.0.1 xmlservice gem
YIPS: update YIPS 1.9.3, 2.0.0, 2.1.0
NEW: xmlservice gem add response accessors
1.0.1: zzcall.xml_PARM0.xml_inchara
1.2.0: zzcall.response.inchara
NEW: xmlservice gem add input accessors
1.0.1: not available
1.2.0: zzcall.input.PARM0.inchara = 'a'
NEW: xmlservice gem add returndata accessors
1.0.1: zzarray.xml_aggregate.xml_dcRec_t[i].xml_dcMyName
1.2.0: zzarray.returndata.dcRec_t[i].dcMyName
NEW: Allow pass parameters on call
1.0.1: 
    Not Available

1.2.0:
    # call IBM i ZZCALL (default values)
    zzcall = XMLService::I_PGM.new("ZZCALL",$toolkit_test_lib,{'error'=>'fast'}) 
    zzcall << XMLService::I_a.new('inchara',1,'s')
    zzcall << XMLService::I_a.new('incharb',1,'r') 
    zzcall << XMLService::I_p.new('indec1',7,4,55.1111) 
    zzcall << XMLService::I_p.new('indec2',12,2,333.22)
    zzcall << XMLService::I_DS.new('inds1',1,
                                   [{
                                     'fred'=>XMLService::I_a.new('dschara',1,'t'),
                                     'wilma'=>XMLService::I_a.new('dscharb',1,'f'),
                                     'betty'=>XMLService::I_p.new('dsdec1',7,4,77.6666),
                                     'bambam'=>XMLService::I_p.new('dsdec2',12,2,88888.77)
                                    }])

    parms = [ 'inchara'=>'2', 'incharb'=>'2', 'indec1'=>22.2222, 'indec2'=>22.22, 
              'inds1'=>[{
                'wilma'=>{'dscharb'=>'2'},
                'betty'=>{'dsdec1'=>222.2222}}]
            ]
    zzcall.call(parms)
NEW: Also affects CMDs
cmd = XMLService::I_CMD.new("RTVJOBA USRLIBL(?) SYSLIBL(?) CCSID(?N) OUTQ(?)")
1.0.1:
      # output
      output = cmd.xml_output
      puts output
      puts "USRLIBL #{cmd.xml_USRLIBL}"
      puts "SYSLIBL #{cmd.xml_SYSLIBL}"
      puts "CCSID #{cmd.xml_CCSID}"
      puts "OUTQ #{cmd.xml_OUTQ}"

1.2.0:
      puts "\n+++++++++ response output ++++++++++++++++"
      output = cmd.response.output
      puts output
      puts "\n+++++++++ returndata output ++++++++++++++++"
      puts "USRLIBL... #{cmd.returndata.USRLIBL}"
      puts "SYSLIBL... #{cmd.returndata.SYSLIBL}"
      puts "CCSID..... #{cmd.returndata.CCSID}"
      puts "OUTQ...... #{cmd.returndata.OUTQ}"

New: Also effects SH (PASE)
dsplibl = XMLService::I_SH.new("system -i 'dsplibl OUTPUT(*PRINT)'", {'rows'=>'on'})
1.0.1:
      # puts dsplibl.xml_output.class.name
      output = dsplibl.xml_output
      for i in 0..output.count-1
        puts "line #{i}: #{output[i]}"
      end
1.2.0:
      puts "\n+++++++++ response output ++++++++++++++++"
      output = dsplibl.response.output
      for i in 0..output.count-1
        puts "line #{i}: #{output[i]}"
      end
NEW: Also effects DB2
1.0.1:
    in_name1 = 'Peaches'
    in_name2 = 'Rickety Ride'
    in_weight = 22.22
    query = XMLService::I_DB2.new("call #{$toolkit_test_db2_lib}/MATCH_ANIMAL(?, ?, ?)",
      {'name1'=>in_name1,"name2"=>in_name2,"weight"=>in_weight})
    # call IBM i
    query.xmlservice
    # xmlservice error occurred?
    rc = query.xmlservice_error
    if rc
      puts query.dump_all()
      self.match_value(__method__,__LINE__,'error' ,false,rc)
    end
    # output
    puts "name1 = #{query.xml_name1.strip}"
    puts "name2 = #{query.xml_name2.strip}"
    puts "weight = #{query.xml_weight.strip}"
    query.xml_output.each do |row|
      all = ""
      row.each do |n,v|
        all << "#{n}=#{v} "
      end
      puts all
    end
1.2.0:
    in_name1 = 'Peaches'
    in_name2 = 'Rickety Ride'
    in_weight = 22.22
    query = XMLService::I_DB2.new("call #{$toolkit_test_db2_lib}/MATCH_ANIMAL(?, ?, ?)",
      {'name1'=>in_name1,"name2"=>in_name2,"weight"=>in_weight})
    # call IBM i
    query.xmlservice
    # xmlservice error occurred?
    rc = query.xmlservice_error
    if rc
      puts query.dump_all()
      self.match_value(__method__,__LINE__,'error' ,false,rc)
    end
    # output
    puts "\n+++++++++ response output ++++++++++++++++"
    puts "name1 = #{query.returndata.name1.strip}"
    puts "name2 = #{query.returndata.name2.strip}"
    puts "weight = #{query.returndata.weight.strip}"
    query.response.output.each do |row|
      all = ""
      row.each do |n,v|
        all << "#{n}=#{v} "
      end
      puts all
    end
2014–02–11 GA18 YIPS: updated YIPS 1.9.3, 2.0.0, 2.1.0
NEW: xmlservice gem errors for bad object create (Aaron)
srvpgm1.setReturn("passback", XMLService::I_p.new('my_out',9,3) )
RuntimeError: XMLService::I_p.new(my_out,9,3) invalid number of parameters
... this case missing value ...
XMLService::I_p.new('my_out',9,3,0.0)

Additional checks also added for parms validation. 
2014–02–10 GA17 YIPS: updated YIPS 1.9.3, 2.0.0, 2.1.0
NEW: xmlservice gem ‘best practice’ Rails default DB2 connection ‘ActiveRecord’ (Aaron)
Rails xmlservice gem  will auto-magically default to 'ActiveRecord'
ActiveXMLService::Base.establish_connection("connection" => "ActiveRecord")
therefore establish_connection will NOT need to appear in Rails code.
2014–01–27 GA16 YIPS: updated YIPS 1.9.3, 2.0.0, 2.1.0
Fix: thread safe xmlservice
require 'xmlservice'
require 'thread'

ActiveXMLService::Base.establish_connection(
  :test_yaml => "../test_authorization/xmlservice.yml",
  :test_env  => "sqlpublic"
)

def foo1(n)
  puts "run #{n}\n"
  cmd = XMLService::I_SH.new("system -i 'WRKSYSVAL OUTPUT(*PRINT)'")
  cmd.xmlservice
  output = cmd.out_xml
  if output.include? "User part of the library list"
    puts "good #{n}\n"
  else
    puts output
    puts "bad #{n}\n"
  end
end

def foo2(n)
  puts "run #{n}\n"
  cmd = XMLService::I_CMD.new("RTVJOBA USRLIBL(?) SYSLIBL(?) CCSID(?N) OUTQ(?)")
  cmd.xmlservice
  output = cmd.out_xml
  if output.include? "desc='OUTQ'"
    puts "good #{n}\n"
  else
    puts output
    puts "bad #{n}\n"
  end
end


def foo3(n)
  puts "run #{n}\n"
  mybin = 0xA1A2A3A4A5A6A7A8A9AAA1A2A3A4A5A6A7A8A9AA
  zzbinary = XMLService::I_SRVPGM.new("ZZSRV","ZZBINARY",$toolkit_test_lib)
  zzbinary.inputParameter("parm","io",XMLService::I_Binary.new('myIn',20,mybin))
  zzbinary.setReturn("binary", XMLService::I_Binary.new('myOut',20,0x00))
  # call IBM i
  zzbinary.xmlservice
  if mybin.to_s(16).upcase == zzbinary.xml_binary.xml_myOut.to_s
    puts "good #{n}\n"
  else
    puts output
    puts "bad #{n}\n"
  end
end


begin
  threads = []
  [1,2,3,4,5,6,7,8,9,10,11,12].each do |i|
    threads << Thread.new do
      puts "loop #{i}\n"
      foo1(i)
    end
  end
  [101,102,103,104,105,106,107,108,109,1010,1011,1012].each do |i|
    threads << Thread.new do
      puts "loop #{i}\n"
      foo2(i)
    end
  end
  [201,202,203,204,205,206,207,208,209,2010,2011,2012].each do |i|
    threads << Thread.new do
      puts "loop #{i}\n"
      foo2(i)
    end
  end
  threads.each(&:join)
rescue Exception => e
  puts "EXCEPTION: #{e.inspect}"
  puts "MESSAGE: #{e.message}"
end

2013–12–04 GA15

YIPS: updated both 1.9.3 and 2.0.0

New: enable XMLSERVICE I_DB2 class programming
== query ===
    id = 5
    weight = 0.20
    query = XMLService::I_DB2.new("select * from #{$toolkit_test_db2_lib}/animals where ID < ? and WEIGHT > ?",{'id'=>id,"weight"=>weight})
    # call IBM i
    puts query.to_xml
    query.xmlservice
	# xmlservice error occurred?
    rc = query.xmlservice_error
	if rc
	  puts query.dump_all()
      self.match_value(__method__,__LINE__,'error' ,false,rc)
    end
    # inspect
    puts query.dump_inspect
    # output
    # puts query.out_xml
    # rows
    puts "id < #{query.xml_id.strip}"
    puts "weight > #{query.xml_weight.strip}"
    query.xml_output.each do |row|
      all = ""
      row.each do |n,v|
        all << "#{n}=#{v} "
      end
      puts all
    end
 == stored proc call ===
    in_name1 = 'Peaches'
    in_name2 = 'Rickety Ride'
    in_weight = 22.22
    query = XMLService::I_DB2.new("call #{$toolkit_test_db2_lib}/MATCH_ANIMAL(?, ?, ?)",
      {'name1'=>in_name1,"name2"=>in_name2,"weight"=>in_weight})
    # call IBM i
    puts query.to_xml
    query.xmlservice
	# xmlservice error occurred?
    rc = query.xmlservice_error
	if rc
	  puts query.dump_all()
      self.match_value(__method__,__LINE__,'error' ,false,rc)
    end
    # inspect
    puts query.dump_inspect
    # output
    # puts query.out_xml
    # rows
    puts "name1 = #{query.xml_name1.strip}"
    puts "name2 = #{query.xml_name2.strip}"
    puts "weight = #{query.xml_weight.strip}"
    query.xml_output.each do |row|
      all = ""
      row.each do |n,v|
        all << "#{n}=#{v} "
      end
      puts all
    end

2013–12–03 GA14

New: enable inherit XMLSERVICE class programming

class ZZARRAY < XMLService::I_SRVPGM
  attr_accessor :myName
  attr_accessor :myMax
  attr_accessor :myCount
  attr_accessor :aggregate
  def initialize(myName='Missing',myMax=1,options=nil)
    super("ZZSRV","ZZARRAY",$toolkit_test_lib,options)
    self.set_parms(myName,myMax)
  end
  def set_parms(myName='Missing',myMax=1,myCount=0,dcRec_t=nil)
    @myName = XMLService::I_Char.new('myName',10,myName) 
    @myMax = XMLService::I_Int32.new('myMax',myMax)
    @myCount = XMLService::I_Int32.new('myCount',myCount,'mycount')
    @aggregate = Array.new
  end
  def set_return()
    self.setReturn("aggregate", 
            XMLService::I_DS.new("dcRec_t",999,'mycount',
            [ 
              XMLService::I_Char.new('dcMyName',10,'na'),
              XMLService::I_Char.new('dcMyJob',4096,'na'),
              XMLService::I_Int32.new('dcMyRank',0),
              XMLService::I_PackedDecimal.new('dcMyPay',12,2,0.0)
            ]))
  end
  def xmlservice()
    # create/reset parameters
    self.reset
    self << @myName
    self << @myMax
    self << @myCount
    self.set_return()
    super()
  end
  def output_attr()
    super()
    rc = self.xmlservice_error
    if !rc
      # move xmlservice output to input
      self.set_parms(
        self.xml_PARM0.xml_myName,
        self.xml_PARM1.xml_myMax,
        self.xml_PARM2.xml_myCount)
    end
  end
  def return_attr()
    super()
    rc = self.xmlservice_error
    if !rc
      # move xmlservice return aggregate
      @aggregate = Array.new
      for i in 0..self.xml_aggregate.xml_dcRec_t.count-1
        @aggregate[aggregate.count] = {
        'dcMyName' => self.xml_aggregate.xml_dcRec_t[i].xml_dcMyName,
        'dcMyJob' => self.xml_aggregate.xml_dcRec_t[i].xml_dcMyJob,
        'dcMyRank' => self.xml_aggregate.xml_dcRec_t[i].xml_dcMyRank,
        'dcMyPay' => self.xml_aggregate.xml_dcRec_t[i].xml_dcMyPay
        }
      end
    end
  end
  def report()
    # output
    s = "#{self.name}.#{self.func}:\n"
    @aggregate.each do |r|
      s << " dcRec_t ["
      s << "  Name...#{r['dcMyName']}"
      s << "  Job....#{r['dcMyJob']}"
      s << "  Rank...#{r['dcMyRank']}"
      s << "  Pay....#{r['dcMyPay']}"
      s << " ]\n"
    end
    s
  end
end

2013–11–27 GA13

FIX: part 2 “better errors” changes to dump, dump_all, dump_inspect

[1/1] Test_60910_DriverCallPgmZZMISS#test_0030_pgm_zzmiss_error
PARMS
.@xml_output
.@xml_PARM
..@xml_fail
..@xml_version
..@xml_jobinfo
...@xml_jobipc
...@xml_jobipcskey
...@xml_jobname
...@xml_jobuser
...@xml_jobnbr
...@xml_jobsts
...@xml_curuser
...@xml_ccsid
...@xml_dftccsid
...@xml_paseccsid
...@xml_langid
...@xml_cntryid
...@xml_sbsname
...@xml_sbslib
...@xml_curlib
...@xml_syslibl
...@xml_usrlibl
...@xml_jobcpffind
..@xml_joblogscan
...@xml_joblogrec[]
....@xml_jobcpf
....@xml_jobtime
....@xml_jobtext
..@xml_joblog
...@xml_joblogdata
..@xml_error[]
...@xml_errnoxml
...@xml_xmlerrmsg
...@xml_xmlhint
2013–11–27 GA12

FIX: part 1 “better errors” changes to dump, dump_all, dump_inspect

2013–11–26 GA11 NEW: allow CMD with ‘?’ output RTVJOBA (Tony) …
FIX: dump_inspect for I_CMD (Tony) …
    cmd = XMLService::I_CMD.new("RTVJOBA USRLIBL(?) SYSLIBL(?)")
    # call IBM i
    cmd.xmlservice
    # output
    puts "USRLIBL #{cmd.xml_USRLIBL}"
    puts "SYSLIBL #{cmd.xml_SYSLIBL}"
FIX: allow PASE sh rows for xml_output line-by-line array (Tony) …
FIX: fix dump_inspect for I_SH (Tony) …
    dsplibl = XMLService::I_SH.new("system -i 'dsplibl OUTPUT(*PRINT)'", {'rows'=>'on'})
    # call IBM i
    dsplibl.xmlservice
    # output
    # puts dsplibl.xml_output.class.name
    output = dsplibl.xml_output
    for i in 0..output.count-1
      puts "line #{i}: #{output[i]}"
    end
2013–11–26 GA10 FIX: dump_inspect deep complex nested slightly better ‘.’ (Don) …
[1/1] Test_60010_DriverCallPgmTestOnly#test_0040_pgm_zztest_short_hand_input_array_index_output
PARMS
@xml_PARM0
.@xml_inchara
@xml_PARM1
.@xml_incharb
@xml_PARM2
.@xml_indec1
@xml_PARM3
.@xml_indec2
@xml_PARM4
.@xml_inds1[]
..@xml_ds1chara
..@xml_ds1charb
..@xml_ds1dec1
..@xml_ds1dec2
..@xml_inds2[]
...@xml_ds2chara
...@xml_ds2charb
...@xml_ds2dec1
...@xml_ds2dec2
...@xml_inds3[]
....@xml_ds3chara
....@xml_ds3charb
....@xml_ds3dec1
....@xml_ds3dec2
...@xml_ds5chara
...@xml_ds5charb
...@xml_ds5dec1
...@xml_ds5dec2
..@xml_ds4chara
..@xml_ds4charb
..@xml_ds4dec1
..@xml_ds4dec2

[1/1] Test_60110_DriverCallSrvPgmZZARRAY#test_0020_pgm_zzarray
PARMS
@xml_PARM0
.@xml_myName
@xml_PARM1
.@xml_myMax
@xml_PARM2
.@xml_myCount

RETURN
@xml_aggregate
.@xml_dcRec_t[]
..@xml_dcMyName
..@xml_dcMyJob
..@xml_dcMyRank
..@xml_dcMyPay
2013–11–26 GA9 FIX: dump_inspect deep complex nested structures using ‘.’ (Don) …
FIX: may still need a few more pretty indents (will look)
[1/1] Test_60010_DriverCallPgmTestOnly#test_0040_pgm_zztest_short_hand_input_array_index_output
PARMS
.@xml_PARM0
.@xml_inchara
.@xml_PARM1
.@xml_incharb
.@xml_PARM2
.@xml_indec1
.@xml_PARM3
.@xml_indec2
.@xml_PARM4
.@xml_inds1[]
..@xml_ds1chara
..@xml_ds1charb
..@xml_ds1dec1
..@xml_ds1dec2
..@xml_inds2[]
...@xml_ds2chara
...@xml_ds2charb
...@xml_ds2dec1
...@xml_ds2dec2
...@xml_inds3[]
....@xml_ds3chara
....@xml_ds3charb
....@xml_ds3dec1
....@xml_ds3dec2
...@xml_ds5chara
...@xml_ds5charb
...@xml_ds5dec1
...@xml_ds5dec2
..@xml_ds4chara
..@xml_ds4charb
..@xml_ds4dec1
..@xml_ds4dec2
2013–11–25 GA8

FIX: broke diag with dump_inspect fix …

Missed an override method in diag ... please try again.
 class I_Diag  < I_BaseMulti
  def initialize_doc(element)
    @var = "diag"
    @elem = self.elemParse(element)
  end
 end
2013–11–25 GA7

NEW: mypgm.dump_inspect dump object.variables created by xmlservice call (Don)
FIX: should be working much better now

1/1] Test_60110_DriverCallSrvPgmZZARRAY#test_0020_pgm_zzarray
Parms:
@xml_PARM0
 @xml_myName
@xml_PARM1
 @xml_myMax
@xml_PARM2
 @xml_myCount
Return:
@xml_aggregate
  @xml_dcRec_t[]
   @xml_dcMyName
   @xml_dcMyJob
   @xml_dcMyRank
   @xml_dcMyPay
2013–11–22 GA6

NEW: mypgm.dump_inspect dump object.variables created by xmlservice call (Don)
NEW: not working 100%, but reasonable start on inspect

    # call IBM i ZZCALL
    zzcall.xmlservice
    # list vars 
    puts zzcall.dump_inspect

OUTPUT:

ruby test_60010_DriverCallPgmZZCALL.rb 
 @xml_PARM0 
  @xml_inchara 
 @xml_PARM1 
  @xml_incharb 
 @xml_PARM2 
  @xml_indec1 
 @xml_PARM3 
  @xml_indec2 
 @xml_PARM4 

2013–11–22 GA5 NEW: Nil class data set/get xmlservice (Don)
xmlservice-1.0.1/lib/xmlservice.rb:209:in `initialize': can't convert nil into String (TypeError)

Changed get/set to check for nil
  def setValue(data)
    if data == nil
      data = 0
      case @type
      when "a"
        data = ""
      when "b"
        data = "00"
      end
    end
    case @type
:


  def value
    if @data == nil
      @data = 0
      case @type
      when "a"
        @data = ""
      when "b"
        @data = "00"
      end
    end
    case @type
:
2013–11–22 GA4 NEW: default settings “ActiveRecord” out-of-box (Don)
NEW: default assumes XMLSERVICE compiled into POWER_RUBY library (Andrea needs to do)
require 'active_record'
require 'xmlservice'
ActiveRecord::Base.establish_connection(
  :adapter => 'ibm_db',
  :database => 'LP0364D',
  :username => 'DB2',
  :pwd_enc => 'YiYNfodSh5MGZVX7TXktEPSrnVlrAPjoyzzn48SdC/k=%0A'
)
ActiveXMLService::Base.establish_connection(
  :connection => "ActiveRecord"
)
wrksysval = XMLService::I_SH.new("system -i 'WRKSYSVAL OUTPUT(*PRINT)'")
# call IBM i
wrksysval.xmlservice
# output
puts wrksysval.xml_output

defaults are:
module ActiveXMLService
 XINSTALL = "POWER_RUBY"
 XCTL = "*here"
 XIPC = "*none"
 XSIZE = 15000000
 XHEAD = "<?xml version='1.0'?>"
 XDATABASE = "*LOCAL"
 XUSERNAME = "*NONE"
 XPASSWORD = "*NONE"

2013–11–22 GA3 NEW: xmlservice.dump formatted error message dump (Don)
Note: xmlservice.dump(parms are optional for verbose capabilities)
    # call missing PGM
    # 'error' => 'on' -- slow large joblog (development)
    # 'error' => 'off' -- slow subset joblog (development)
    # 'error' => 'fast' -- high speed errors (production)
    options = {'error'=>'off'} 
    zzcall = XMLService::I_PGM.new("ZZMISS",$toolkit_test_lib,options)
    # call IBM i ZZCALL
    zzcall.xmlservice
    # xmlservice error occurred?
    if zzcall.xmlservice_error
      puts zzcall.dump(xmlversion=true,xmlerror=true,jobinfo=true,jobscan=true,joblog=true)
    end
2013–11–20 GA2 initial download
Retrieved from http://youngiprofessionals.com/wiki/index.php/XMLSERVICE/XMLSERVICEGemChangelog
Page last modified on November 05, 2014, at 03:02 PM EST