SeeView Manual
SeeView Statements and Script Symbols
HP NonStop SeeView Manual—526355-004
9-58
IF
Example
This example shows a nested IF statement.
?MENU DownDevs
?PROC ShowDown(#DevType)
{----------------------}
{ This proc displays a menu of down devices.
{ The column number of the down "D" state info
{ is dynamically determined from the PUP output.
{----------------------------------------------}
PARM #DevType; { Type of device, "" => all
VAR #line { Line of text from pup
, DownCol { Column of "D" down STATE info
, i { Scratch variable
;
DELETE DownDevs!; { clean out menu
TASK pup:=pup; { declare pup, start listdev
WRITE pup,"listdev " & #DevType;
WITH pup; { WITH pup for #taskprompting
DO BEGIN { find "STATE" column range
READ pup,#line;
SCAN #line UNTIL "STATE" -> DownCol;
IF #TASKPROMPTING THEN RETURN;
END UNTIL (DownCol > 0);
WHILE NOT #TASKPROMPTING
DO BEGIN { For each device check STATE
READ pup,#line;
SCAN #line UNTIL "$" -> i;
IF i THEN BEGIN { Have a device in #line
IF #TAKE #line[ DownCol:DownCol+4 ] = "D"
THEN BEGIN { Device down, push onto menu
PUSH #line ONTO DownDevs;
END;
END;
END;
WITH DownDevs; { Advise if none down
IF #TASKCACHELINES=0 THEN BEGIN
MSG(r) "No " & #DevType & " devices are down.";
RETURN;
END;
WINDOW DownDevs { Display menu
MENU "CALL UpDev(#MENUTEXT)"
FOR #TASKCACHELINES SIZE 17;
?PROC UpDev(#devinfo)
{-------------------}
PARM #devinfo;
BESIDE;
WINDOW pup,"listdev " & #devinfo[6:15];
{ Add desired logic ...
?SECT main
{---------}
PAGE 2; CW;
CALL ShowDown;