| Previous | Contents | Index |
ASK STRUCTURE: CURRENT assigns the current record value to the str_var. Once the current record has been assigned with ASK STRUCTURE: CURRENT, the SET STRUCTURE: CURRENT statement can be used to get this record.
SheerPower returns a zero-length string if there is no CURRENT record.
15.8.3 ASK STRUCTURE: DATAFILE
ASK STRUCTURE struc_name: DATAFILE str_var
|
| Example 15-31 ASK STRUCTURE: DATAFILE |
|---|
open structure cust: name 'sheerpower:samples\customer' open structure cl: name 'sheerpower:samples\client' ask structure cust: datafile z1$ ask structure cl: datafile z2$ print z1$ print z2$ end C:\SHEERPOWER\samples\CUSTOMER.ARS C:\SHEERPOWER\samples\CLIENT.ARS |
The ASK STRUCTURE: DATAFILE statement returns the full file name/file specification of a specified structure. struc_name is the specified structure name. str_var contains the returned file specification.
ASK STRUCTURE struc_name: FIELDS num_var
|
| Example 15-32 ASK STRUCTURE: FIELDS |
|---|
open structure cl: name 'sheerpower:samples\client', access input ask structure cl: fields z print z end 18 |
The number of fields in a structure can be determined with the ASK STRUCTURE: FIELDS statement. The number is assigned to the numeric variable num_var.
ASK STRUCTURE struc_name: KEYS num_var
|
| Example 15-33 ASK STRUCTURE: KEYS |
|---|
open structure cl: name 'sheerpower:samples\client', access input ask structure cl: keys z print z end 2 |
The ASK STRUCTURE: KEYS statement returns the number of keys that are accessible by SheerPower. It returns the value of 0 if no keys are available.
15.8.6 ASK STRUCTURE: CAPABILITY
ASK STRUCTURE struc_name: CAPABILITY str_var
|
| Example 15-34 ASK STRUCTURE: CAPABILITY |
|---|
open structure cl: name 'sheerpower:samples\client', access input ask structure cl: capability z$ print z$ end INDEXED,INPUT |
Given a structure expression, ASK STRUCTURE: CAPABILITY sets str_expr to a comma delimited string containing one or more of the following: INDEXED, INPUT, OUTPUT
| Structure Type | Description |
|---|---|
| INDEXED | The structure is indexed; it can be accessed by key with statements such as SET STRUCTURE...KEY. |
| INPUT | You can read from the structure. |
| OUTPUT | You can write to the structure. |
| null string | The structure is not currently open. |
15.8.7 ASK STRUCTURE: EXTRACTED
ASK STRUCTURE struc_name: EXTRACTED num_var
|
| Example 15-35 ASK STRUCTURE: EXTRACTED |
|---|
open structure cl: name 'sheerpower:samples\client' extract structure cl end extract ask structure cl: extracted z print 'Records found: '; z end Records found: 13 |
ASK STRUCTURE: EXTRACTED asks the operating system for the last extracted count for the structure specified.
ASK STRUCTURE struc_name: ID str_var
|
| Example 15-36 ASK STRUCTURE: ID |
|---|
declare structure str
open structure cl: name 'sheerpower:samples\client'
ask structure cl: id cl_id$
set structure str: id cl_id$
extract structure str
end extract
for each str
print str(#1); ' '; str(#2)
next str
end
20000 Smith
20001 Jones
20002 Kent
23422 Johnson
32001 Waters
43223 Errant
80542 Brock
80543 Cass
80544 Porter
80561 Derringer
80573 Farmer
|
The ASK STRUCTURE: ID statement asks the operating system for the ID of a structure and returns it in the string variable str_var.
ASK STRUCTURE struc_name: POINTER num_var
|
| Example 15-37 ASK STRUCTURE: POINTER |
|---|
open structure cl: name 'sheerpower:samples\client'
extract structure cl
end extract
for each cl
ask structure cl: pointer ptr
print ptr, cl(last)
next cl
end
1 Smith
2 Jones
3 Kent
4 Johnson
5 Waters
6 Errant
7 Brock
8 Cass
9 Porter
10 Derringer
11 Farmer
|
From within a FOR EACH...NEXT STRUCTURE_NAME block, ASK STRUCTURE: POINTER asks the structure for the number of the current record pointer.
15.8.10 ASK STRUCTURE: RECORDSIZE
ASK STRUCTURE struc_name: RECORDSIZE int_var
|
| Example 15-38 ASK STRUCTURE: RECORDSIZE |
|---|
open structure cl: name 'sheerpower:samples\client' ask structure cl: recordsize recsize print 'Logical recordsize: '; recsize end Logical recordsize: 400 |
The ASK STRUCTURE: RECORDSIZE statement returns the record size of the structure data file.
ASK STRUCTURE struc_name: ACCESS str_var
|
| Example 15-39 ASK STRUCTURE: ACCESS |
|---|
open structure inv: name 'sheerpower:samples\invoice', access input ask structure inv: access x$ print x$ close structure inv end SECURITY:N, READ:N, WRITE:N, UPDATE:N, DELETE:N |
The ASK STRUCTURE: ACCESS statement retrieves the access rules for the specified structure. Security level, data file read, write, update, and delete rules are returned.
15.8.12 ASK | SET STRUCTURE #string_expr . . .
ASK STRUCTURE #string_expr. . .
SET STRUCTURE #string_expr. . .
|
| Example 15-40 ASK | SET STRUCTURE#string_expr . . . |
|---|
open structure cl: name 'sheerpower:samples\client'
str$ = 'CL'
fld$ = 'ID'
do_work
stop
routine do_work
ask structure #str$, field #fld$: description dsc$
print 'Description is: '; dsc$
end routine
end
Description is: Client ID number
|
| Previous | Next | Contents | Index |