Sorry, yes a typo. I meant ISO8859-1.
re: new String(byte[])
- read the javadoc for this. It builds a String using the current
System.getProperty("file.encoding")
In generaly, you should *always* specify the encoding that you want when
making a String from bytes - unless what you really want is the default
file.encoding for the JVM.
For example - if you start a generic JVM using the "java" command, the
default file.encoding is IBM-1047 (EBCDIC).
But, Websphere and many other Java apps will run with
file.encoding=ISO8859-1.
This is because there are many libraries that incorrectly use the default
file.encoding (like new String(byte[])), but assume that they are working
in ASCII.
So, its just easier to run the JVM with file.encoding = ISO8859-1 to avoid
issue.
Then, you have to remember to specify that you want EBCDIC with you are
working with external EBCDIC resources.
Remember that Strings in Java are UTF-16.
Kirk Wolf
Dovetailed Technologies
http://dovetail.com
On Thu, Sep 19, 2013 at 9:34 AM, Don Poitras <[email protected]> wrote:
> In article <
> cahm_n2k-eg5ofeh0rirvr4eddp9pwq85phmi4vf_yfoea2t...@mail.gmail.com> you
> wrote:
> > Minor suggestion; should use:
>
> > System.out.println( new String(cpuid,
> > ZFile.DEFAULT_EBCDIC_CODE_PAGE) );
>
> > otherwise, the default file.encoding is used, which is very often
> > "ISO8849-1" on z/OS
>
> I'm guessing you meant ISO8859-1. It's not that way at our shop, but I
> suppose if you deal mostly with ascii, it would make sense.
>
> > Kirk Wolf
> > Dovetailed Technologies
> > http://dovetail.com
>
>
> > On Wed, Sep 18, 2013 at 12:08 PM, Denis G?bler <
> [email protected]>wrote:
>
> > > Hi Arye,
> > >
> > > this will give you the CPUID from the first PCCA.
> > >
> > > long cvt = ZUtil.peekOSMemory(16, 4);
> > > long cvtpccat = ZUtil.peekOSMemory(cvt+764, 4);
> > > long pcca = ZUtil.peekOSMemory(cvtpccat + 0*4, 4);
> > > byte[] cpuid = new byte[12];
> > > ZUtil.peekOSMemory(pcca+4, cpuid, 0, 12);
> > > System.out.println(new String(cpuid));
> > >
> > > Output Example:
> > > FF1111112097
> > >
> > > Matches D M=CPU Output:
> > > RESPONSE=SYS1
> > > IEE174I 16.50.42 DISPLAY M 166
> > > PROCESSOR STATUS
> > > ID CPU SERIAL
> > > 00 + 1111112097
> > >
> > > Its z/OS dependent code. Hope it helps.
> > >
> > >
> > >
> > > Denis.
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Arye Shemer <[email protected]>
> > > To: IBM-MAIN <[email protected]>
> > > Sent: Tue, Sep 17, 2013 9:21 pm
> > > Subject: Re: Get CPUID and srial number from JAVA code
> > >
> > >
> > > Thank you guys,
> > > I will consider all the options.
> > >
> > > Thanks again,
> > > Arye.
> > >
> > >
> > > On 17 September 2013 18:54, Bernd Oppolzer <[email protected]
> > > >wrote:
> > >
> > > > I wrote an ANSI C function that fetched this information using
> > > > the callable service CSRSI (System Information Service),
> > > > so if nothing else helps, you should IMO be able to call this
> > > > using JNI.
> > > >
> > > > Kind regards
> > > >
> > > > Bernd
> > > >
> > > >
> > > >
> > > > Am 17.09.2013 15:28, schrieb Arye Shemer:
> > > >
> > > >> Hi,
> > > >>
> > > >> Has anyone know how I can get CPUID and machine serial number from
> JAVA
> > > >> code ?
> > > >>
> > > >> Is there a z/OS Java forum that I can get help on this issue ?
> > > >>
> > > >> thanks,
> > > >>
> > > >> Arye Shemer.
>
> --
> Don Poitras - SAS Development - SAS Institute Inc. - SAS Campus Drive
> [email protected] (919) 531-5637 Cary, NC 27513
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN