Sheerpower®
A Guide to the Sheerpower Language


Previous Contents Index

FORMAT:


Command Format: 
  ARSFLUSH files-to-flush 
    files-to-flush - wildcard filespec of ARS files to flush caches for 

N.12 ARSLOCKMON - Display Locking Information

DESCRIPTION:

This utility displays locking information for ARS files. The information displayed, includes a list of record locks and which process/thread holds them and which processes/threads are waiting for them.

FORMAT:


Command Format: 
  ARSLOCKMON files-to-display 
    files-to-display: wildcard filespec of ARS files to display info for 


Appendix O
Smart Editing in Sheerpower

O.1 Overview

Sheerpower Rapid Development Environment (SPDEV) is designed to make writing professional programs easy. In addition to the special keystrokes that are configured by default, the following sections cover "smart" keystrokes that you can enable and use for faster, more efficient and accurate editing.

O.1.1 Smart Copy and Paste (Programming Keystroke)

Fast, efficient, and error-free code development: the Sheerpower IDE SmartCopy feature greatly speeds up the writing of error-free Sheerpower programs. SmartCopy does this by performing an intelligent copy, paste, and replacement of code on command. By default, SmartCopy operates on the single line of code above the cursor, but also works on preceding paragraphs or code snippets. SmartCopy features include:

Usually, the programming keystroke used to trigger SmartCopy is [CTRL+ENTER] (while holding down the [CTRL] key, press [ENTER]). See Appendix F, Keystrokes for Sheerpower Rapid Development Environment for more on special keystrokes in SPDEV.

All SmartCopy commands can be applied to an entire code snippet or paragraph. A leading slash ("/") means to apply the SmartCopy command to the entire paragraph above the cursor. Additionally, SmartCopy commands work in all file types (not just .SPINC and .SPSRC files).

The SmartCopy technology is patented, US 8,745,581.

O.1.2 Setup SmartCopy in SPDEV

To set up SmartCopy, open SPDEV and click on "Options" in the toolbar. Then select "Keystroke Function Mappings".

In the "Choose a key" dialog box that opens (with the keyboard), (1) place a check in the checkbox beside CONTROL, and (2) click on the [ENTER] key. (3) Then click on MAP THIS KEY. A list of functions to map is shown. (4) Choose "SmartCopy" from the list and (5) click on the "Map it" button.

Then click on the "Save and Exit" button in the bottom right corner of the window. You are now ready to use the SmartCopy feature with the Smart Key keystroke of [CTRL/ENTER].

O.1.2.1 Using SmartCopy

To use the SmartCopy while programming in SPDEV:

The SmartCopy command can only be invoked when the cursor is at the end of the line containing the command. SPDEV will beep if the cursor is not at the end of the line. If there is text entered in after the command and you invoke the command with the cursor at the end of the line, the text will be ignored and the command will execute. Note that an entire SmartCopy command can be UNDONE with a single [CTRL/Z] keystroke.

O.1.2.2 Single Field Name Smart Copy, Paste & Replace

FORMAT:


  var$ = table(field_name) 
  replacement_field_name 

DESCRIPTION:

SmartCopy commands can be as simple as a single field name - the first value that matches the pattern of "(*)". The example below shows how to duplicate a single line of code with a single field name replaced:

EXAMPLE:

Example O-1 SmartCopy with a Single Field Name

  my_city$ = payroll(CITY) 
  state   
// press [CTRL/ENTER] after "state" 
  
// result: 
 
  my_city$ = payroll(CITY) 
  my_state$ = payroll(STATE) 

In the above example, SmartCopy sees the word "state" in the command line and assumes that it is a field name. It then scans the line above for the first pattern of "(*)". It finds "(city)", and marks the word "city" as the TARGET and "state" as the replacement text. SmartCopy then duplicates the entire line, and changes all occurrences of "city" to "state".

Note that SmartCopy also preserves the upper and lower case of the text when printing out the new lines.

O.1.2.3 Multiple Replacement Values on a Field Name

FORMAT:


  var$ = table(field_name) 
  replacement_field_name[,...] 

DESCRIPTION:

If you are generating a series of new lines based on a single line of code above the cursor, you can give multiple replacement field name values separated by commas. All leading or trailing spaces in a list of replacement strings are ignored.

The code example below will generate three new lines of text below the first line containing the replacement value strings specified:

EXAMPLE:

Example O-2 SmartCopy - Multiple Replacement Values on a Field Name

  my_city$ = payroll(city) 
  state,zipcode,country   
// press [CTRL/ENTER] after "country" 
  
// result: 
 
  my_city$ = payroll(city) 
  my_state$ = payroll(state) 
  my_zipcode$ = payroll(zipcode) 
  my_country$ = payroll(country) 

The next example illustrates SmartCopy ignoring leading and trailing spaces when generating the new lines of code:


  my_city$ = payroll(city) 
  state,  zipcode ,country   
  // press [CTRL/ENTER] after "country" 
  
// result: 
 
  my_city$ = payroll(city) 
  my_state$ = payroll(state) 
  my_zipcode$ = payroll(zipcode) 
  my_country$ = payroll(country) 

O.1.2.4 Set Explicit Target and Replacement Text

FORMAT:


// on a single line: 
 
   target = replacement[,...] 
   
// on a code snippet: 
 
   /target = replacement[,...] 

DESCRIPTION:

You can set explicit target and the replacement text in a SmartCopy command by using the equal sign as shown in the next example:

EXAMPLE:

Example O-3 SmartCopy - Set Explicit Target & Replacement Text

  my_city$ = payroll(city) 
  city = state,zipcode 
// press [CTRL/ENTER] after "state" 
 
// result: 
  my_city$ = payroll(city) 
  my_state$ = payroll(state) 
  my_zipcode$ = payroll(zipcode) 

EXAMPLE:

Example O-4 SmartCopy - Set Explicit Target & Replacement Text in HTML File

  <td class="city"> 
    City: [[city]] 
  </td> 
  /city=state,country,zipcode 
// press [CTRL/ENTER] after "zipcode" 
 
 
// result: 
  <td class="city"> 
    City: [[city]] 
  </td> 
                             
  <td class="state"> 
    State: [[state]] 
  </td> 
 
  <td class="country"> 
    Country: [[country]] 
  </td> 
 
  <td class="zipcode"> 
    Zipcode: [[zipcode]] 
  </td> 

The next example shows how to use SmartCopy to create multiple new OPEN statements. The target and replacement values are explicitly set:

EXAMPLE:

Example O-5 SmartCopy - Duplicating OPEN Statements

  open structure payroll: name '@..\data\payroll', access outin 
  payroll = client, membership, audit   
  // press [CTRL/ENTER] after "audit" 
 
// result: 
 
  open structure payroll: name '@..\data\payroll', access outin 
  open structure client : name '@..\data\client', access outin 
  open structure membership: name '@..\data\membership', access outin 
  open structure audit  : name '@..\data\audit', access outin 

To produce one or more new code snippets from a preceding code snippet (instead of the single line above), simply put a forward slash "/" in front of the SmartCopy command. The target and replacement text are set explicitly.

Example O-6 Smart Copy & Paste on Code Snippets and Paragraphs

  audit(type) = 'CITY' 
  audit(value) = payroll(city) 
  do_the_audit 
  /city = state, zipcode  
  // press [CTRL/ENTER] after "zipcode" 
 
// result: 
 
  audit(type) = 'CITY' 
  audit(value) = payroll(city) 
  do_the_audit 
 
  audit(type) = 'STATE' 
  audit(value) = payroll(state) 
  do_the_audit 
 
  audit(type) = 'ZIPCODE' 
  audit(value) = payroll(zipcode) 
  do_the_audit 

O.1.2.5 Rapid Correction of Text Through Replacement

FORMAT:


// on a single line: 
 
   .target = replacement 
   
// on a code snippet or paragraph: 
 
   /.target = replacement 

DESCRIPTION:

SmartCopy also allows for the rapid correction of text through replacement. For example, if you incorrectly entered "fullname" in a line of text instead of "client_name", you can fix it quickly. The leading DOT (".") says that we are doing an "in place" replacement of text. The target and replacement text are set explicitly.

EXAMPLE:

Example O-7 SmartCopy - Correcting a single line of text through replacement

  my_fullname$ = payroll(fullname) 
  .fullname = client_name  
  // press [CTRL/ENTER] after "client_name" 
 
// result: 
 
  my_client_name$ = payroll(client_name) 

For correcting multiple lines of text through replacement, place a leading forward slash "/" before the period "." in the SmartCopy command as shown in the next example:


Previous Next Contents Index