regexes has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I' rather skeptical about this... and didn't find anything searching... some monk probably knows more...

Within an OS400 PASE environment, how can I determine that the architecture is actually OS400?

For example....
#!/usr/bin/perl use strict; use Config; my $os = $^O; my $config = $Config{'archname'}; print "OS -> $os\n"; print "Config -> $config\n";
Output of the program is:
OS -> aix Config -> aix
So.... on an actual AIX host, the program outputs:
OS -> aix Config -> aix-thread-multi
If I'm not mistaken, PASE is supposed to emulate the AIX environment for OS400. So... is it safe to assume that the output of $Config{'archname'} on OS400 is valid, i.e. can it be stated that anytime that output is aix, it's not AIX architecture but OS400?

Update:Corrected spelling in title.

regexes


-------------------------
Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan "press on" has solved and always will solve the problems of the human race.
-- Calvin Coolidge, 30th President of the USA.

Replies are listed 'Best First'.
Re: OS400 Pace - architecture?
by Fletch (Bishop) on Jun 06, 2007 at 13:19 UTC

    $Config{archname} is the architecture that copy of perl was built on, not necessarily what you're running on (similarly with $^O).

    You might be more interested in either using backticks to call the system's uname command, and/or calling uname from the core POSIX module.

      $Config{archname} is the architecture that copy of perl was built on, not necessarily what you're running on (similarly with $^O).

      Ok... but if the perl binary being used has been built on those architectures can I not safely say that $^O is correct? At least of all the unix machines we have in our landscape the perl was built on and delivered on those architectures.

      Update: I just answered my own question. No, I cannot.. hence aix on both OS400 and AIX architectures. That just shows that the perl binary delivered with the PACE environment was built on an AIX architecture..


      -------------------------
      Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan "press on" has solved and always will solve the problems of the human race.
      -- Calvin Coolidge, 30th President of the USA.
Re: OS400 Pace - architecture?
by chase (Sexton) on Jun 06, 2007 at 16:54 UTC
    This is my first monkish reply, so hopefully everything is formatted correctly.

    PASE (Portable Application Solutions Environment) is an integrated OS/400 runtime for porting selected *NIX applications. It works by making applications think they are running on AIX, which I take it, is the problem. You may be able to use an OS/400-specific QSHELL command to infer that you are running on an AS/400. QSHELL is a (somewhat) Korn shell environment on OS/400.

    I can't check this now because I am in front of an AS/400 without Perl installed, but, I believe that the command interpreter for system and backtick will be the PASE QSHELL. If that is true, then you could try an OS/400-specific QSHELL command like those below:

    ===> STRQSH > sysval QMODEL 570 > sysval -n SYSNAME MYSYSTEM > sysval QSRLNBR 1234ZRM
    I think that `sysval` is a valid AIX command, but I bet that `sysval QSRLNBR` is not.

    Google qshell strqsh for iSeries QSHELL stuff

    DSPSYSVAL documentation from IBM

    --chase