SeeView Manual

SeeView Language Elements
HP NonStop SeeView Manual526355-004
5-26
Function Keys
When the program in Example 5-12 is invoked:
?SECT Main displays the Person window (or dialog box) shown in Figure 5-9.
?PROC PersonMaint is called when you press F5, F6, or F7. PersonMaint starts a
SQL conversational interface (SQLCI) session, clears the PersonData cache, and
then accepts the data from the Person window into the PersonData cache. If you
press F5, commands are issued to the SQLCI to insert the accepted data into the
SQL Person table as Figure 5-9 shows.
Example 5-12. Example Using Function Keys to Perform SQL Operations
?MENU Person
{-----------}
Last [ ] First [ ] :: (alpha) (alpha)
Address [ ]
City [ ] State[ ] Zip[ ] :: (a) (a) (n notab)
*
?MENU PersonData
?PROC PersonMaint
{----------------}
{ Maintains Person SQL Table, F5 add, F6 delete, F7 list.
{-------------------------------------------------------}
VAR #first, #last, #data;
TASK SQLci; { Declare SQL ci.
LINE #menuline, #menucol; { Address calling window.
DELETE PersonData!; { Clear person cache.
ACCEPT INTO PersonData FIELDPERLINE { Accept all fields to cache.
#last, #first; { Last, First fields to vars.
IF #fkey = 5 THEN BEGIN { Add Person
POP #data FROM PersonData; { INSERT INTO PERSON (*)
WRITE SQLci,"INSERT INTO PERSON(*) VALUES('" &#data& "'";
WITH PersonData; {
FOR #TaskCacheLines DO BEGIN { ,"data" . ..
POP #data FROM PersonData;
WRITE SQLci, #spaces[1:28] & ",'" & #data & "'";
END;
WRITE SQLci, ");"; { );
END;
IF #fkey = 6 THEN { Delete person
WRITE SQLci,"DELETE FROM PERSON WHERE LAST = '" & #last
& "' and FIRST= '" & #first & "';";
IF #fkey = 7 THEN { List person
WRITE SQLci, "SELECT * FROM PERSON;";
BELOW;
WINDOW SQLci CACHE -">>" NOFRAME NOCURSOR SIZE 66,12;
?SECT Main
{---------}
WINDOW person CACHE FIRST UNTIL "*" SIZE 43
MENU "CALL PersonMaint"
FIELDS (underline)
KEYS F5, F6, F7
HEAD "Add-F5 Del-F6 List-F7";