These procedures show how to drive CONNECT VIEW from a script. VIEW$[7] passes a SELECT WHEN, SORT or USING clause, and VIEW$[16] runs a command-mode function such as COUNT, LIST, PRINT, DELETE, MOVE, COPY, SUM or CHANGE.
.HOFF! These are examles of how to use VIEW$[7] and VIEW$[16]! to do CONNECT VIEW commands
MAINLINE DIM VIEW$[17] DO USING-FUNCTION CONNECT VIEW "UTCUST"
SELECT-WHEN-FUNCTION LET VIEW$[7] = "WHEN #UTCUST.CUST-NAME = "+QUO+ "Team Sports " +QUOSORT-FUNCTION LET VIEW$[7] = "SORT 1"USING-FUNCTION LET VIEW$[7] = "USING RANGE FROM " + QUO + "0003" + QUO + " TO " + QUO + "0008" + QUO
! **** COMMAND MODE PROCESSING ****! FUNCTION! |VERIFY(Y/N)! ||LINK NAME! |||||||||| COMMENT HEADER! |||||||||||||||||||||||||||||||||...COUNT-FUNCTION LET VIEW$[16] = "N Example of COUNT Function"LIST-FUNCTION LET VIEW$[16] = "L Example of LIST Function"PRINT-FUNCTION LET VIEW$[16] = "P Example of PRINT Function"DELETE-FUNCTION LET VIEW$[16] = "CY Example of DELETE Function"MOVE-FUNCTION LET VIEW$[16] = "MYUTTEST Example of MOVE Function"COPY-FUNCTION LET VIEW$[16] = "CYUTTEST Example of COPY Function"SUM-FUNCTION LET VIEW$[16] = "S" + !<- FUNCTION CHR(1) + !<- # of Columns to SUM CHR(5) + !<- Column Number to SUM "Example of SUM Function" !<- Comment HeaderCHANGE-FUNCTION LET VIEW$[16] = "c" + !<- FUNCTION "Y" + !<- VERIFY(Y/N) CHR(17) + !<- Length of Change Exp "#UTCUST.TERMS = "+QUO+"Z"+QUO+ !<- Expression "Example of CHANGE Function" !<- Comment HeaderNotes
- The MAINLINE runs one example (USING-FUNCTION) and then CONNECT VIEW “UTCUST”. Change the DO line to try the others.
- For command mode, VIEW$[16] holds the function code in position 1, the verify flag (Y or N) in position 2, a link name in positions 3 to 10 and the comment header after that, as the comment block in the code shows.
- SUM and CHANGE use a slightly different layout, shown in their own comments.