View previous topic :: View next topic
|
Author |
Message |
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
Hi
I am trying to run a java program in OMVS. This is simple "hello world" program. While doing the JAVAC the compiler is not recognize [] braces.
The code compiles well on the windows platform. Can some one direct me where is the error or related manual. I have sg245142.
Some one who has run java on z/os either in batch job or thru omvs command line can share his exp.
Program :
class javaex
{
public static void main(String args[])
{
System.out.println("this is a simple Java program");
}
}
after compiling :
javac javaex.java
javaex.java:3: illegal character: \168
public static void main(String args[])
¬
javaex.java:7: ';' expected
}
¬
2 errors
Regards
Rohit
Ps : I searched all the forums for java on z/os , seems this one is relevant for this query. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Square brackets are not standard characters in EBCDIC. It appears your left bracket is a hex 'A8' (decimal 168); the ones that work for Java are hex 'AD' and 'BD'. You may have to look at your code in hex to put the right characters in your program. |
|
Back to top |
|
|
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
thanks Robert, that correct [] is the cause of error, but when I change hex values for []the code , it does not show the [], instead s¹û appear. which again throws the error.
n(String args¹û)
94EA98984898ADD544444
5D23995701972ABD00000
Shoud'nt there be some environment variable set which shud take care of asci/ ebsdic conversions. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Shoud'nt there be some environment variable set which shud take care of asci/ ebsdic conversions. |
If only there were ....
One of the basic problems is that there are two conflicting standards for EBCDIC square brackets; getting the wrong translation table may cause the characters to look weird or may cause syntax errors for applications expecting square brackets.
One thing to try is go to ISPF option 0 and ensure your terminal type is 3278A per the ISPF Planning and Customizing manual (GC34-4814), section 5.10 in the V1R8 version of the manual. |
|
Back to top |
|
|
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
I changed the terminal type but still same error. I understood the probelm as follows :
MVS and shell uses different code pages for conversion of symbols.
some how these tow need to be in sysnc.
let me know if my understanding is correct.
thanks
Rohit |
|
Back to top |
|
|
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
I used the 'iconv' which converts between the two code pages to get the desired result.
syntax is :
iconv -f ibm-037 -t ibm-1047 javaex.java > pgm1.java
I feel there should be better way of doing it. I will appreciate your inputs.
Rohit |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
It may be possible -- have your site support group check into customizing /etc/profile to set national code page IBM-1047 as the default. It may be easier to edit the hex values for brackets. |
|
Back to top |
|
|
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
Hi Robert
following is the ENV variable
NLSPATH=/usr/lpp/gskssl/lib/nls/msg/En_US.IBM-1047/%N:/usr/lpp/ldap/lib/nls/msg/
I guess the code page for unix shell is already IBM 1047. Since I am creating the file in ISPF, should'nt we need to check the code page used in ISPF.
Regards
Rohit |
|
Back to top |
|
|
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
Thanks Robert..
I am bit confused with the code page stuff.
How can i check in MVS which code page its using? is there a way we can check the code page for a file or dataset ?
I am noticing that the code page are diff for a file we create it from omvs command 'oedit' and from normal ISPF 3.2/4 options. Even though oedit opens up ISPF. Please let me know if I am understanding is correctly.
Thanks
Rohit |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
z/OS is IBM-1047 typically. I'm not sure how much of that can be changed.
You can find a lot in the Unix System Services bookshelf by searching all documents for 'character set id'. A specific Unix file (or directory) can be examined via the chtag -p OR ls -T commands. It would be very unusual for an MVS dataset to not be using the default codepage.
If you can talk your systems support people into implement CONVERT(BPXFX111) on your OMVS command, you can see normal square brackets instead of the odd characters. Otherwise, I think you're stuck with them.
There's a lot about code pages and character sets in the Unix manuals -- but we don't use that much of them here. Perhaps someone with experience using some other code page (Danish or German or French or Spanish for example) could provide additional insight? |
|
Back to top |
|
|
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
I have parsed through the BPXZA430, but not able to decipher following issue.
This is the issue I am facing,
I created a PS, wrote a JAVA hello program in it. Through OPUT I copied the dataset in HFS ( Unix system). The [] brackets are converted but I am getting error for {} brackets ( while compiling) . When I create the file from unix using "oedit" and then using ICONV to convert the code page from IBM 037 to IBM 1047
it works fine (same program).
Code :
class javaex
{
public static void main(String args ݨ)
{
System.out.println("this is a simple Java program");
}
}
Hex Value :
class javaex
898AA498A88A444444444444444444444444444444444444444444444444444444444444
331220115157000000000000000000000000000000000000000000000000000000000000
-----------------------------------------------------------------------
{
C44444444444444444444444444444444444444444444444444444444444444444444444
000000000000000000000000000000000000000000000000000000000000000000000000
-----------------------------------------------------------------------
public static void main(String args ݨ)
44449A89884AA8A884A988498894EA98984898A4AB544444444444444444444444444444
000074239302313930569404195D239957019720DDD00000000000000000000000000000
-----------------------------------------------------------------------
{
4444C4444444444444444444444444444444444444444444444444444444444444444444
000000000000000000000000000000000000000000000000000000000000000000000000
Error :
javaex.java:1: '{' expected
class javaex
00000100
¬
javaex.java:8: '}' expected
¬
2 errors
Oput :
oput JAVA.TEST '/home/r02637/javaex.java' TEXT CONVERT(YES)
Thanks for your help .
Rohit |
|
Back to top |
|
|
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
I am getting a feeling that the issue is something else rather than code set conversion.... |
|
Back to top |
|
|
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
Hi Robert
I got the issue, the conversion was taking place correctly, but while doing oput system was appending 00 at end (CRLF, enter). When I manually removed and compiled it worked.
Do you know any trick so that while doing a oput/oget etc crlf, 00 etc are appended at the end of line ?
Thanks
Rohit |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
The OPUT usage notes in the Unix Commands manual says
Quote: |
When you copy MVS data sets to z/OS UNIX file system text files, a <newline> character is appended to the end of each record. If trailing blanks exist in the record, the <newline> character is appended after the trailing blanks. |
The <newline> character is hex 0A (linefeed) for Unix, so if you're getting CRLF (0D0A) that's not Unix -- it's Windows. And I don't know where a hex '00' would come from. |
|
Back to top |
|
|
|