× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scot,

The command I was running didn't
run. I have been working on porting
Ant to the iSeries so that I could use
it to build RPG programs, etc. I will
check in what I have to the iSeries-toolkit
some time this weekend. I think it will be
a very effective build tool and it integrates
nicely with CVS, which I also use for
RPG source.

I see from a later post that you have
something that may work. Like I said,
my test did not. I was only running touch
and a few simple scripts to see if it was
working at all. Hopefully what you did
post will get it working for what I am
doing.

Someone (Joel?) mentioned that the
possibilities of running Unix commands
in RPG are "intoxicating" -- I would
put it as less than intoxicating
because you can use the multi-layered
qcmdexc/qsh technique, but it is still
a worthwhile pursuit.

Thanks,

David Morris

>>> klemscot@klements.com 04/05/02 14:55 PM >>>

Actually, I was thinking more about this...   and you said the return
status is 7, didn't you?  With a number that low, (i.e. less than 0xFF)
the program is probably getting run, and actually returning a 7 to you.

Okay, that probably made perfect sense to me and other people with Unix
experience, but not to you, so let me elaborate :)

In Unix, and MS-DOS, and similar command line operating systems, the
programs that you run return a value.   For example, in C you'd code:

int main(void) {

 /* do something here */

return XXX;     <-whatever the value of XXX is would be the exit status.
}

Or, SOMEWHERE in the program, it calls exit().  Maybe something like:

    fd = open(somefile, O_RDONLY);
    if (fd == -1) {
         fprintf(stderr, "ack!\n");
         exit(7);     <--- in this example, 7 would be the exit status.
    }

Although a programmer can return any status that he likes, the
"standard"
is to return 0 if your program was successful, or a positive integer if
your program was not.

In the normal OS/400 environment (i.e., non-QShell) if your program
failed, you would usually exit with an *ESCAPE message to indicate an
error.  That's kind of what returning a positive integer means in Unix.

(Frankly, the OS/400 way is a lot better, since people can't just ignore
the return values, but since you're running QShell, you have to live
with
the Unix way)

ANYWAY...  the underlying problem is most likely that something is not
set up the way that the command you're running is expecting it to be.
Like, maybe it expects stdin, stdout and stderr to already be opened up
by the shell so it can write its output, etc.

Unfortunately, I don't know how you can tell the exact meaning of the
exit status in this case.   You might try reading about it in the
manual,
most in the cases that I've looked at, the manual is rather vague.

For example, take the ls command.  Here's the info center page:
http://publib.boulder.ibm.com/pubs/html/as400/v4r5/ic2924/info/java/rzahz/ls.htm

Near the bottom, it says "Exit status:  0 on success, >0 if an error
occurs".   Not that helpful...

If you'd like an example of converting WIFxxxx procs to RPG, let me
know.


On Fri, 5 Apr 2002, David Morris wrote:
>
> Scot,
>
> Thanks for the tips. Did I mention that I did
> think this would be simple -- and am now being
> schooled by an API that takes a single parm
> and is documented in less than two pages?
>
> David Morris



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.