public function buildCommandXmlIn($cmd, $exec = 'pase')
    {
        $xmlIn = '';
        
        // get hex/ccsid information to pass along on the command.
        $propArray = array();
        $this->processParamProps($propArray);
        
        $ccsidHexStr = "{$propArray['ccsidStr']}{$propArray['hexStr']}"; 
        
        // if a string, make a single-item array from it.
        if (is_string($cmd)) {
            $cmdArray = array($cmd);
        } else {
            // already multiple.
            $cmdArray = $cmd;
        }
        
        foreach ($cmdArray as $oneCmd) {
            // Run PASE utility 'system', which runs an IBM i native command.
            // We call this an "interactive" command because it can return output from DSP* interactive commands.
            // Use double quotes around $cmd so that $cmd can safely contain single quotes.
            if ($exec == 'pase') {
                // -i is nice. @todo test speed
                $oneCmd = '/QOpenSys/usr/bin/system "' . $oneCmd . '"';
            }
            
            // if need to convert to hex, do so.
            $encodedCmd = $this->encodeString($oneCmd);
            
            // with pase and pasecmd is <sh, not <cmd.            
            // inner command depends on what was passed in.
            if ($exec == 'pase' || $exec == 'pasecmd') {
                $xmlIn .= "<sh rows='on'$ccsidHexStr>$encodedCmd</sh>";
            } else {
                // Not a "<sh>" tag. Try one of the cmd exec= command styles.
                
                // check that our exec value is in whitelist.
                // blank is a synonym for default of cmd.
                if ($exec && in_array($exec, $this->_cmdTypes)) {
                    $execStr = " exec='$exec'"; // e.g. <cmd exec='rexx'>
                } else {
                     $execStr = ''; // OK because blank string defaults to cmd on XMLSERVICE side
                }
                $xmlIn .= "<cmd$execStr$ccsidHexStr>$encodedCmd</cmd>";
            }
        }
        
        return $this->addOuterTags($xmlIn);
    }