import com.ibm.as400.access.*; public class hmc { public static void main(String[] args) { byte[] inst_inx = { // ubin(2) instruction index, hex 0001 MATMATR 0x00, 0x01 }; byte[] tmpl = new byte[1052]; // bin(4) bytes-in, bin(4) bytes-out, bin(4) entries-returned, // char(4) reserved, ubin(2) HMC info length, char(1034) HMC info tmpl[2] = 0x04; tmpl[3] = 0x1C; // byte-in = 1052 byte[] opt = {0x02, 0x04}; AS400 i = new AS400(); ProgramParameter[] plist_matmatr = new ProgramParameter[] { new ProgramParameter(inst_inx), // input, ubin(2) instruction index new ProgramParameter(tmpl, 1052), // inout, instruction template new ProgramParameter(opt) // input, instruction template of RSLVSP }; ProgramCall portal = new ProgramCall(i, "/qsys.lib/i5toolkit.lib/miportal.pgm", plist_matmatr); try { if(!portal.run()) System.out.println("Issuing _RSLVSP2 failed."); else { tmpl = plist_matmatr[1].getOutputData(); int hmc_info_len = 0; hmc_info_len |= (int)(tmpl[16]) << 8; hmc_info_len |= (int)(tmpl[17]); System.out.println("Length of returned HMC info: " + hmc_info_len); String hmc_info = new String(tmpl, 18, hmc_info_len); System.out.println("HMC info: " + hmc_info); // returned HMC info are in ASCII charset } } catch(Exception e) { e.printStackTrace(); } } }
So is the ablitiy to utilize heap storage important to client programs? Not always. HLLs in which client programs are written have their own native support for dynamic storage management. It isn't reasonable to turn to a remote server just for a chunk of dynamically allocated storage. But heap storage allocated on an IBM i server sometimes is necessary when MI pointers are to be stored, since MI pointers can only be stored in SLS storage via proper MI instruction (e.g. CPYBWP).