View previous topic :: View next topic
|
Author |
Message |
HenriqueS
New User
Joined: 17 Feb 2007 Posts: 30 Location: Brazil
|
|
|
|
Hello,
I´ve tried to call a shell script using the system() function (ex.: system('/tmp/script.sh') but I am getting RC=256. The script has executable attributes (+x) so I have no idea what is going on.
I printf the command line that is passed to the system() function, cut and paste into a Unix terminal window and it runs w/o problems.
Any clue? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You might try:
Code: |
system(sh '/tmp/script.sh') |
or
Code: |
system('sh /tmp/script.sh') |
|
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
HenriqueS,
It's considered bad form to post the same question on 2 different bulletin boards within an hour of each other. |
|
Back to top |
|
|
HenriqueS
New User
Joined: 17 Feb 2007 Posts: 30 Location: Brazil
|
|
|
|
sorry.
Terry Heinze wrote: |
HenriqueS,
It's considered bad form to post the same question on 2 different bulletin boards within an hour of each other. |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I always thought that ibmmainframes.com and READ FORUM RULES.com had different people showing up, sorry |
Why would this make a bad practice acceptable? It is ok if no one sees it No, it isn't. It is still quite inconsiderate to post the same question multiple places. . .
Is the rc=256 now resolved/working? |
|
Back to top |
|
|
HenriqueS
New User
Joined: 17 Feb 2007 Posts: 30 Location: Brazil
|
|
|
|
No it is not working, there is something really strange going on.
I have jdk 6 (64 bit) installed here. in a few lines:
DOES RUN
Code: |
sprintf(cmd, "/bin/java -cp .:jcifs-0.7.9.jar CopyFile %s %s > /tmp/out", source, dest);
system(cmd)
|
DOES NOT RUN
Code: |
sprintf(cmd, "/bin/java -cp .:jcifs-1.2.25.jar CopyFile %s %s > /tmp/out", source, dest);
system(cmd)
|
Data:
1) The running sample uses an old JCIF library (library that allows access to windows network shares), the CopyFile program was made originally to run with this lib version (0.7.9).
2) The sample that does not run uses a newer JCIFS library and a different CopyFile program that does a few differente method calls since these calls changed in the new version of the JCFIS lib.
Now the STRANGE stuff:
1) When I run the command line on the Unix prompt, using the newer library and the update CopyFile program, it DOES RUN. Actually I made my C program to print out which command line will be executed under the system() call, so I just copy from the SYSOUT and paste into the USS prompt.
2) the /tmp/out file that is supposed to record any stacktraces or error conditions is created fine with the first (older) program, but not in the second program. In fact, when the second program runs, the /tmp/out file is just 'touched' (a 0-byte file with the current timestamp as creation date).
3) All the error conditions I made on the 2nd program do not exit with a RC 256, but other numbers such a 0, 8 and 16.
dick scherrer wrote: |
Hello,
Quote: |
I always thought that ibmmainframes.com and READ FORUM RULES.com had different people showing up, sorry |
Why would this make a bad practice acceptable? It is ok if no one sees it No, it isn't. It is still quite inconsiderate to post the same question multiple places. . .
Is the rc=256 now resolved/working? |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Is it possible that there is a path difference/discrepancy in the different executions? If my memory is working, a file in the current directory would be used before the path was searched (on HP-UX years ago - repeat, if my memory is working).
Can you rename the problem module to ensure the desired code is being executed?
You might check the permissions on the new components. Especially if anything is supposed to have the "sticky bit" turned on.
Sorry but it's been too long. . . |
|
Back to top |
|
|
HenriqueS
New User
Joined: 17 Feb 2007 Posts: 30 Location: Brazil
|
|
|
|
Dick,
Thanks for your feedback, I made think and compare the file permission for the new .class (CopyFile program) and .jar files (JCifs library).
I figured out that the file permissions were not OK, I did set a chmod 755 for these new files and the job executed like a charm.[/b] |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Cool - good to hear it is working
Thank you for letting us know
d |
|
Back to top |
|
|
|