Re: Execution error
by BrowserUk (Patriarch) on Apr 09, 2009 at 12:00 UTC
|
qsh: 001-0050 Syntax error on line 1:
Based on little more than vague recollections of a very breif encounter with some AS/400 stuff long, long ago--and a little logic--is it possible that the annotation 001-0050 indicates that the error was encountered on line 1 at character offset 50?
As your 'first line' appears to be no more than 21 chars long, could it be that line endings are not being recognised? Perhaps you need to redo the transfer using the equivalent of ftp 'ascii mode' or otherwise do something to fix up the line endings?
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
Re: Execution error
by JavaFan (Canon) on Apr 09, 2009 at 12:45 UTC
|
The error you are getting isn't a Perl error. It looks like a shell error - and 'qsh' is indeed an IBM shell.
Now, the she bang line is a Unix trick (the kernel looks at the first two bytes of the file to see what kind of excutable it is - in the case of '#!' it isn't an executable, but data for the program that follows). But I don't think Unices are the only OSses that can run on the AS/400.
So, what OS are you running, and how are you calling the script? | [reply] |
Re: Execution error
by almut (Canon) on Apr 09, 2009 at 12:23 UTC
|
| [reply] |
Re: Execution error
by wazoox (Prior) on Apr 09, 2009 at 12:01 UTC
|
Apparently it's the AS/400 shell that throws the error? Can you try calling the perl executable directly, like in
perl /my/program.pl
( I don't know anything about AS/400 shell unfortunately).
| [reply] [d/l] |
Re: Execution error
by Anonymous Monk on Apr 09, 2009 at 11:57 UTC
|
I am running a small perl script
How?
lmgtfy | [reply] |
Re: Execution error
by Bloodnok (Vicar) on Apr 09, 2009 at 12:28 UTC
|
AFAIR, a similar error can be generated by the shell if a perl script containing Windoze line endings and having execute permissions is run on a *NIX (specifically Solaris) box - the shell mis-understands the shebang line.
Update:
Thanx to almut for the nudge - when I say shell, I should've said OS (on/in which the shell runs).
A user level that continues to overstate my experience :-))
| [reply] |
|
|
a similar error can be generated by the shell
Those errors are typically along the lines of "Command not found", because the kernel does interpret the shebang line, but then doesn't find a perl binary ".../perl\r" (it's not the shell that interprets the shebang line — otherwise, how could you call a script via the exec* family of system calls, where no shell is involved?). In the case of the OP, the shebang line doesn't seem to be recognized at all, so the system defaults to using the shell to interpret the script.
| [reply] [d/l] [select] |
Re: Execution error
by raju_400 (Novice) on Apr 10, 2009 at 10:43 UTC
|
My thanks to all for the replies. Following are my responses:
================================================
lmgtfy
I am running the script as follows:
1. First I went to AS/400 shell by typing 'qsh'
2. and from shell,
perl tstcmd
======================================
BrowserUk
I have tried with ftp (ASCII mode) and also tried by writing the program using
AS/400 editor itself. But without success.
=======================================
wazoox
I have tried with perl /home/sbhowmik/tstcmd but same result
=======================================
JavaFan
I have already given how I am running the script.
The OS is OS/400 V5R3.
Just like to add I have written some programs on AS/400 in the past and executed from shell similarly. I have checked my script in
VSlick Edit and by displaying sepcial chars. It seems the newlines are coming as expected. At least similar to my other existing programs.
Regards
Sudip | [reply] |
|
|
perl -v
| [reply] [d/l] [select] |
|
|
'perl -v' output as follows:
This is perl, version 5.005_02 built for os400
Copyright 1987-1998, Larry Wall
Rebuilt for iSeries on 22nd Dec 2004 - v1.1
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
| [reply] |