ASPL User's Guide v 1.00
© 2024 by SetSphere.COM


10-1

   Interrogating a Set Variable

The choice for the symbol ? is adopted in ASPL as the interrogation operator. This operator, when followed by a set variable, causes ASPL to interrogate the source that resulted in creating the variable.

A set variable is created when you assign a value to it; the value is an object that represents a dataset. The set variable is stored in ASPL symbol table that you can display by typing the symbol v.

Each set variable represents a dataset that originated from some kind of source: a function, a setadic statement, a grouping expression, etc. The source is maintained in each variable, and you can view it by displaying the symbol table. In this example, we load the workspace RANDONEBIT and display the symbol table:

01:20 root@mm01: ~ #  aspl -wsname RANDONEBIT -groupingclass BITGROUP

      ______  ____    ______  __                                                                                                                   
     / __  / / ___\  / __  / / /                                                                                                                   
    / /_/ /  \ \    / ____/ / /                                                                                                                    
   / __  /  __  \  / /     / /                                                                                                                     
  / / / /  / __ / / /     / /____                                                                                                                  
 /_/ /_/   \___/ /_/     /______/                                                                                                                  
                                                                                                                                                   
                                                                                                                                                   
  STARTING ASPL SESSION WITH WORKSPACE:  RANDONEBIT
  NAMED GROUP:  BITGROUP
     last saved 2024-02-13 01:09:15.855164

1:21:19 root@mm01 /root  aspl:1 > dm 1

  DISPLAY MODE SET TO 1

1:21:25 root@mm01 /root  aspl:2 > v

     VARIABLES TYPE 1

   vname       |card      |xpC         |Lgn                             |Src
   ------------|----------|------------|--------------------------------|------------------------------------
   v1          |#31/1     |ggfunc      |g1                              |ggbitsubgS(gstart,1,gcount,1,dmin,..
   v2          |#49/1     |ggfunc      |g2                              |ggbitsubgS(gstart,2,gcount,1,dmin,..
   v3          |#28/1     |ggfunc      |g3                              |ggbitsubgS(gstart,3,gcount,1,dmin,..



Notice the Src column showing the source function that created the variable. The variables have been created by sourcing the function ggbitsubgS() and you can view this function by typing ggls ggbitsubgS() at the ASPL prompt. This function creates random number of groups, subgroups, and elements. Calling this function at different time will result with different datasets. So let's see how to interrogate the set variable.

The choice for the symbol ? is adopted in ASPL as the interrogation operator.



You can interrogate a set variable by using ? operator and ASPL will reiterate the process that sourced this variable; then ASPL will compare the previous data to the sourced data: if there is any change in the sourced data then ASPL updates the variable with the newly sourced data. When a variable is being updated, its old data is being archived and you can use the @ operator to view a variable and its archived data.




Example 10.1.1

Interrogating a Set Variable EXAMPLE1
The following example shows how to find the union of subgroups and elements in random groups created in RANDONEBIT workspace. We start ASPL by loading the sample workspace RANDONEBIT, we interrogate the set variable v1, then issue the labinated operation ,gU on the set variables.

 

Operation 10.1.1

Interrogating a Set Variable OPERATION1

aspl RANDONEBIT
    (start ASPL loading the sample workspace RANDONEBIT)

①  aspl> v sorted
    (display the symbol table showing the archived variables)

②  aspl> ? v1
    (interrogate the v1 set variable updating it)

③  aspl> v sorted
    (display the symbol table showing the archived variables)

④  aspl> ,gU v1 v1@1
    (get groups union of v1 and its archived v1@1)

 

Example 10.1.2

Interrogating a Set Variable EXAMPLE2
The following example shows how to find the union of subdirectories and files found in a directory and its archive. We start ASPL by loading the sample workspace WS1, we make some changes in the source directory represented by set variable a1, then we interrogate the set variable a1 and issue the labinated operation ,gU on the set variables.

 

Operation 10.1.2

Interrogating a Set Variable OPERATION2

aspl WS1
    (start ASPL loading the sample workspace WS1)

①  aspl> v sorted
    (display the symbol table showing the archived variables)

②  aspl> ? a1
    (interrogate the a1 set variable updating it)

③  aspl> v sorted
    (display the symbol table showing the archived variables)

④  aspl> ,gU a1 a1@1
    (get groups union of a1 and its archived a1@1)