Hi, can someone help me with the lines:
char b = (char) (myId[i] & 0xFF); if (b < 0x10) { in this piece of java code? I am trying to translate it into NetRexx. I just don't know what to make of these to lines... Thanks!!! Java: /****************************************************/ /* Some of the MQ Ids are actually byte strings and */ /* need to be dumped in hex format. */ /****************************************************/ static void dumpHexId(byte[] myId) { System.out.print("X'"); for (int i = 0; i < myId.length; i++) { char b = (char) (myId[i] & 0xFF); if (b < 0x10) { System.out.print("0"); } System.out.print((String) (Integer.toHexString(b)).toUpperCase()); } System.out.println("'"); NetRexx: /****************************************************/ /* Some of the MQ Ids are actually byte strings and */ /* need to be dumped in hex format. */ /****************************************************/ method dumpHexId(myId = byte[]) static public ; System.out.print("X'"); i = 0 Loop while i < myId.length ??? b = (myId[i].xand(x'FF'); ??? if (b < 0x10) then System.out.print("0"); else System.out.print((Integer.toHexString(b)).toUpperCase()); i = i + 1 end System.out.println("'"); Return Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20070322/0bc3eef5/attachment.html |
Hi Michael,
what about: method dumpHexId(myId = byte[]) static public say "X'\-"; i = 0 loop while i < myId.length say (Rexx myId[i]).d2x'\-' i = i + 1 end say "'" for short strings at least? best regards, Ren?. On 22-mrt-2007, at 19:09, Michael Dag wrote: > Hi, can someone help me with the lines: > char b = (char) (myId[i] & 0xFF); > if (b < 0x10) { > in this piece of java code? I am trying to translate it into NetRexx. > I just don't know what to make of these to lines... > > Thanks!!! > > Java: > > /****************************************************/ > /* Some of the MQ Ids are actually byte strings and */ > /* need to be dumped in hex format. */ > /****************************************************/ > static void dumpHexId(byte[] myId) { > System.out.print("X'"); > for (int i = 0; i < myId.length; i++) { > char b = (char) (myId[i] & 0xFF); > if (b < 0x10) { > System.out.print("0"); > } > System.out.print((String) (Integer.toHexString(b)).toUpperCase()); > } > System.out.println("'"); > > > NetRexx: > /****************************************************/ > /* Some of the MQ Ids are actually byte strings and */ > /* need to be dumped in hex format. */ > /****************************************************/ > method dumpHexId(myId = byte[]) static public ; > System.out.print("X'"); > i = 0 > Loop while i < myId.length ??? > b = (myId[i].xand(x'FF'); ??? > if (b < 0x10) then System.out.print("0"); > else System.out.print((Integer.toHexString(b)).toUpperCase()); > i = i + 1 > end > System.out.println("'"); > Return > > Michael > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20070322/6a7f0d38/attachment.html |
Hi Rene,
well it gave me the key to the puzzle!!! Thanks! this turned out to be the complete (for now) solution: method dumpHexId(myId = byte[]) static public say 'length' myid.length say "X'\-"; i = 0 loop while i < myId.length --say i' 'myId[i]' \-' if Rexx myId[i] < 0 Then say (Rexx myId[i]+ 256).d2x'\-' else do if Rexx myId[i] < 16 then say '0'(Rexx myId[i]).d2x'\-' else say (Rexx myId[i]).d2x'\-' end i = i + 1 end say "'" return _____ From: [hidden email] [mailto:[hidden email]] On Behalf Of Ren? Jansen Sent: donderdag 22 maart 2007 20:54 To: IBM Netrexx Subject: Re: [Ibm-netrexx] Need some help converting Java Code to NetRexx Hi Michael, what about: method dumpHexId(myId = byte[]) static public say "X'\-"; i = 0 loop while i < myId.length say (Rexx myId[i]).d2x'\-' i = i + 1 end say "'" for short strings at least? best regards, Ren?. On 22-mrt-2007, at 19:09, Michael Dag wrote: Hi, can someone help me with the lines: char b = (char) (myId[i] & 0xFF); if (b < 0x10) { in this piece of java code? I am trying to translate it into NetRexx. I just don't know what to make of these to lines... Thanks!!! Java: /****************************************************/ /* Some of the MQ Ids are actually byte strings and */ /* need to be dumped in hex format. */ /****************************************************/ static void dumpHexId(byte[] myId) { System.out.print("X'"); for (int i = 0; i < myId.length; i++) { char b = (char) (myId[i] & 0xFF); if (b < 0x10) { System.out.print("0"); } System.out.print((String) (Integer.toHexString(b)).toUpperCase()); } System.out.println("'"); NetRexx: /****************************************************/ /* Some of the MQ Ids are actually byte strings and */ /* need to be dumped in hex format. */ /****************************************************/ method dumpHexId(myId = byte[]) static public ; System.out.print("X'"); i = 0 Loop while i < myId.length ??? b = (myId[i].xand(x'FF'); ??? if (b < 0x10) then System.out.print("0"); else System.out.print((Integer.toHexString(b)).toUpperCase()); i = i + 1 end System.out.println("'"); Return Michael _______________________________________________ Ibm-netrexx mailing list [hidden email] -------------- next part -------------- An HTML attachment was scrubbed... URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20070322/9a178686/attachment-0001.html |
Free forum by Nabble | Edit this page |