Subject: | |
From: | |
Reply To: | [log in to unmask][log in to unmask]Subject: [HP3000-L] OT: iSeries (AS/400) listserv? Anyone out there know of an AS/400 equivalent of the hp3000-l ? Thanks, Chris Bartram * To join/leave the list, search archives, change list settings, * * etc., please visit http://raven.utc.edu/archives/hp3000-l.html * [...]44_23Aug200211:56: [log in to unmask] |
Date: | Fri, 23 Aug 2002 14:42:29 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Ray,
You could do something as follows:
:setcobsw _Run_Parm "0110"
Result: _Run_Parm = 24576
:run quad.util;parm=!_Run_Parm
The above sets switches 'SW1 and SW2'.
Regards
Paul Christidis
Where 'setcobsw' is the command file below that can be 'cut and pasted'
into your favorite editor:
===================== Start Cut *+1 <===
parm VarName="SWX", BitSettings="1", Direction="R"
if "!VarName" = "?" then
echo Usage: ![CHR(7)]
echo ![BASENAME(hpfile)] [VarName] [BitSettings] [Direction]
echo
echo Assigns to the indicated variable the decimal value of the
echo indicated binary bit pattern. The pattern must be a series
echo of 1's and 0's up to a length of 16 characters.
echo
echo VarName - Name of CI variable to receive the result.
echo Default: "SWX"
echo
echo BitSettings - A sting of 1's and/or 0's that represent the
echo binary number to be assigned to the variable.
echo Default: "1"
echo
echo Direction - Indicator that directs the command file whether to
echo process the 'BitSettings' in the 'Left' (from right to left)
echo OR the 'Right' (from left to right) direction. When all 16
echo bits are specified 'L' AND 'R' produce the same result.
echo Default: "R"
return
endif
setvar _BitSettings RTRIM(LTRIM(UPS("!BitSettings")))
setvar _BitCheck REPL(REPL(_BitSettings, "0",""), "1","")
if LEN(_BitCheck) <> 0 OR LEN(_BitSettings) = 0 then
echo ![CHR(7)] ** Invalid Bit pattern specified **
deletevar _Bit@
Return
endif
setvar _BitIdx LEN(_BitSettings) + 1
if _BitIdx > 17 then
echo ** Specified too many switches. Will process first 16.. **
setvar _BitIdx 17
endif
setvar _BitDirect RTRIM(LTRIM(UPS("!Direction")))
if _BitDirect = "R" then
setvar _BitEnd _BitIdx
setvar _BitIdx 0
setvar _BitExp 15
setvar _BitStep 1
else
setvar _BitEnd SETVAR(_BitExp, 0)
setvar _BitStep -1
endif
setvar _VarValue 0
While SETVAR(_BitIdx, _BitIdx + _BitStep) <> _BitEnd do
if STR(_BitSettings, _BitIdx, 1) = "1" then
setvar _VarValue _VarValue + 2^_BitExp
endif
setvar _BitExp _BitExp - _BitStep
endwhile
setvar !VarName _VarValue
echo Result: !VarName = !_VarValue
deletevar _Bit@, _VarValue
================== End Cut *-1 <===
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|