Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Running Java code in OMVS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Wed Mar 25, 2009 5:57 pm    Post subject: Running Java code in OMVS
Reply with quote

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
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Wed Mar 25, 2009 6:08 pm    Post subject:
Reply with quote

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
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Wed Mar 25, 2009 6:56 pm    Post subject: Reply to: Running Java code in OMVS
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Wed Mar 25, 2009 7:09 pm    Post subject:
Reply with quote

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
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Mar 26, 2009 11:13 am    Post subject: Reply to: Running Java code in OMVS
Reply with quote

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
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Mar 26, 2009 11:52 am    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Thu Mar 26, 2009 5:05 pm    Post subject:
Reply with quote

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
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Mon Mar 30, 2009 11:25 am    Post subject: Reply to: Running Java code in OMVS
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Mon Mar 30, 2009 5:04 pm    Post subject:
Reply with quote

The NLSPATH has nothing to do with the code page being used. NLSPATH sets the path for message catalogs (and don't ask what they are because I have no idea). If your /etc/profile has been customized for a code page, it should have something like this (which sets up IBM-277, Danish, per the manual):
Quote:
┌──────────────────────────────────────────────────────────────────────────────────┐
│ │
│ if test -z "$LOCALE_SWITCH" && tty -s │
│ then │
│ echo " - - - - - - - - - - - - - - - - - - - - - - - - - - - " │
│ echo " - Logon shell will now be invoked to reflect - " │
│ echo " - code page IBM-277 - " │
│ echo " - - - - - - - - - - - - - - - - - - - - - - - - - - - " │
│ LOCALE_SWITCH=EXECUTED │
│ LANG=C │
│ LC_ALL=Da_DK.IBM-277 │
│ export LANG LC_ALL LOCALE_SWITCH │
│ # Issue chcp if not using OMVS command │
│ if test "$?_BPX_TERMPATH != "OMVS" ) then │
│ chcp -a IS08859-1 -e IBM-277 │
│ fi │
│ exec sh -L │
│ else │
│ echo " - - - - - - - - - - - - - - - - - - - - - - - - - - - " │
│ echo " - Welcome to z/OS UNIX System Services -" │
│ echo " - - - - - - - - - - - - - - - - - - - - - - - - - - - " │
│ fi │
│ │
└──────────────────────────────────────────────────────────────────────────────────┘
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Wed Apr 01, 2009 3:46 pm    Post subject: Reply to: Running Java code in OMVS
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Wed Apr 01, 2009 5:48 pm    Post subject:
Reply with quote

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
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Wed Apr 01, 2009 6:04 pm    Post subject: Reply to: Running Java code in OMVS
Reply with quote

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
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Wed Apr 01, 2009 6:26 pm    Post subject: Reply to: Running Java code in OMVS
Reply with quote

I am getting a feeling that the issue is something else rather than code set conversion....
Back to top
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Wed Apr 01, 2009 6:55 pm    Post subject: Reply to: Running Java code in OMVS
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Wed Apr 01, 2009 7:33 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
This topic is locked: you cannot edit posts or make replies. Need to code a Rexx PGM sundaram.naveen CLIST & REXX 18 Thu Oct 06, 2016 6:45 pm
No new posts Need Help in understanding what is th... mainakdalal PL/I & Assembler 9 Mon Oct 03, 2016 8:03 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us