2

I am using IBM z/OS390 and I am using the OMVS shell. I don't have "vi" installed at all so I use "oedit". If I try to initialize the app.jar straigh from OMVS shell it Works perfectly. I mean, if I reach the java directory and start the app from there with the two commands below, it Works 100%.

cd /WebSphere/was85/mycel/mynode/AppServer/java_1.7_64/bin
./java -cp /usr/my.jar com/com.my_comapny_witt_entire_name/myMain 

I created a script file via OEDIT and added both lines. The second was broke in two lines. Unfortunatelly I am getting this error obviously because while running, the second command line has been treated as diferente two lines.

$ ./script_boot_app
Error: Could not find or load main class com.my_comapny_witt_entire_name.
/myMain: ./script_boot_app 3: FSUM7351 not found

Probably if the path and java package names were smaller enough to fit in one line it wouldn't happen. So my question is: how can I use OEDIT and guarante that multiple lines will be treated as just one line exactly as I did when executing the command straight from shell? When typing straigh in OMVS shell and the end of line is reached, naturaly I continue in the below line and it is executed as a single command line. How can I do the same inside of a script created in OEDIT tool?

  • The answer you received is right about the `` but it seems to me that you really need to learn to use the editor to fix that tiny mistake if you want to be able to do anything useful on the system. – Julie Pelletier May 31 '16 at 4:54
  • Julie, thanks. You are right. Although I have almost 20 years working as developer I know very little about linux and even less about unix and mainframe. I have been struglgling to use editors in z/OS390. If you can suggest me any read for begginer about OMVS I will be thankfull. I downloaded several excelletn RedBooks but as an immediate help, a quick read about OMVS will be usefull – Jim C May 31 '16 at 21:59
1

The cd should not be required. The following line should do the same.

/WebSphere/was85/mycel/mynode/AppServer/java_1.7_64/bin/java -cp \
    /usr/my.jar com/com.my_comapny_witt_entire_name/myMain 

I broke the command line into two lines by using backslash continuation. There must be no characters between the backslash and the newline for continuation to work.

An alternative is to add you Java bin directory to the PATH variable ahead of any directories that contain java. The command which java should tell you which java will be used.

PATH=/WebSphere/was85/mycel/mynode/AppServer/java_1.7_64/bin:$PATH
java -cp /usr/my.jar com/com.my_comapny_witt_entire_name/myMain 
  • BillThor, your first suggestion fixed my issue. About PATH, I can't change at all. There are several others applications running and I can't change the current PATH. I guess there is some way in Unix to change the PATH variable to apply only to the session my application is running but I am confident about the first solution so I followed it. – Jim C May 31 '16 at 22:09
1

To start with, it's better to always check the exit status of cd, so

cd /WebSphere/was85/mycel/mynode/AppServer/java_1.7_64/bin && ./java -cp /usr/my.jar com/com.my_comapny_witt_entire_name/myMain

cmd1 && cmd2 means execute cmd2 if cmd1 succeeds.

Now I suspect your problem here is that that script is not being interpreted by that OMVS shell (which is meant to be a POSIX shell so should work at interpreting those two lines).

Or of course, it could just be because of those typos (comapny, witt) as the java command is found which would imply that for it to be found, there's one in the current directory as well as at /WebSphere/was85/mycel/mynode/AppServer/java_1.7_64/bin

  • Thanks Stéphane, I didn't know "cmd1 && cmd2 means execute cmd2 if cmd1 succeeds" – Jim C May 31 '16 at 21:56
0

Just a backslash

cd /WebSphere/was85/mycel/mynode/AppServer/java_1.7_64/bin ./java -cp \
/usr/my.jar com/com.my_comapny_witt_entire_name/myMain
  • very unsure this work. cd can only have one parameter. – J. Chomel May 31 '16 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.