MPE::CIvar - Perl extension for CI variables and JCWs on MPE/ix


  use MPE::CIvar ':all';
  $acct = hpcigetvar("HPACCOUNT");
  hpciputvar("TEMPVAR", 1);
  hpciputvar("TEMPVAR", hpcigetvar("TEMPVAR")+1);
  $hold = hpcigetvar("TEMPVAR");
  print "tempvar value was $hold\n";
  $jcw = getjcw();
  $ci = findjcw("CIERROR");
  putjcw("CIERROR", 0);
  hpcicommand("build TOOOLONGNAME.PUB,invaliddomain", undef, undef, 2);
  if ($CIVAR{HPCIERR}) {
    print "Error message: $CIVAR{HPCIERRMSG}\n";
  hpcicmds("purge larry", 
           "build larry;rec=-80,,f,ascii",
           "file input=larry,old",
    or die "Error on cmd: '$MPE::CIvar::lastcmd': $CIVAR{HPCIERRMSG}\n";


Access to the MPE/iX intrinsic functions:

     setjcw, getjcw
     putjcw, findjcw
     hpciputvar, hpcigetvar

See the MPE/iX documentation at Specifically relevant for this module are:

   MPE/iX Intrinsics Reference Manual
   Command Interpreter Access and Variables Programmer's Guide
   Interprocess Communications Programmer's Guide

You may also access the CI variables through the tied hash, %CIVAR. This is analogous to %ENV but currently does not support 'each' or 'keys'.

Sets the jcw JCW to the value VALUE (a 16-bit unsigned integer). Note that setting JCW to a value of 32768 or greater indicates that the program terminated in an error state and may cause a batch job to terminate.

Returns the value of the jcw JCW.

putjcw($name, VALUE)
Sets the jcw $name to the value VALUE (a 16-bit unsigned integer). The function putjcw will return 0 on success, an error code on failure.

Returns the value of the jcw $name.

Returns the value of the CI variable $name. This function will return 'undef' if the variable does not exist. A boolean variable will be returned as 0 or 1.

hpciputvar($name, VALUE)
Sets the CI variable $name to VALUE. If VALUE is an integer it will be put as an integer value. If not, hpciputvar will try to interpret as a boolean or just put it as a string. The function hpciputvar will return 0 on success, an error code on failure.

Deletes the CI variable $name. It will return 0 on success, an error code on failure.

A hash tied to the CI variables. The follow are equivalent:
   $CIVAR{$name}         hpcigetvar($name)
   $CIVAR{$name}=VALUE   hpciputvar($name, value)
   delete $CIVAR{$name}  hpcideletevar($name)

hpcicommand($command [, $cmderr [, $parmnum [,$msglevel]]])
Calls intrinsic HPCICOMMAND with the command string. The other arguments are optional. A value of 0 will be returned on success, otherwise an error value will be returned and assigned to $cmderr if a variable is passed as the second argument. You can set $msglevel to 1 to suppress warnings and set it to 2 to suppress errors as well as warnings. For example,
   hpcicommand($command, undef, undef, 2);

hpcicmds( @cmdlist )
Calls hpcicommand for each string in @cmdlist. It will stop processing the list on an error, but not a warning. You can set the msglevel (see above) by assigning to $MPE::CIvar::msglevel before calling hpcicmds. You can see the last command executed by looking at $MPE::CIvar::lastcmd and any error in $MPE::CIvar::cmderr.


None by default.


Ken Hirsch <>

This module may be used and distributed on the same terms as Perl.