Search    
 

   
 

 
PRAGMA PROGRAM REFERENCE MANUAL
Index
All Operation

Expand All      ADDENDUM
EXCHANGE XC Standard Interactive-only Verb Operating System Operation
Target =

Replaces an item occurring in a verb or file definition with another item.
Do not confuse the EXCHANGE operation with the RENAME operation. RENAME chan-
ges an item's name without affecting the item's contents. EXCHANGE swaps an
entire item - its name AND contents - with another entire item.
Within certain limits you can also EXCHANGE standard verbs.

EXCHANGE occurrencies of ITEM1 with ITEM2 inside the definition of VERB - FILE

ITEM1 and ITEM2 can be numbers, nouns, expressions, files or user defined ver-
bs, including object verbs or standard words. Both items must be of the same
type. Both items must already be in the vocabulary.
VERB or FILE is the verb or file whose definition you wish to change.

SEE ALSO: EXCHANGE / EXCHANGE ALL

EXCHANGE (XC)


EXCHANGE replaces an item occurring in a verb or file definition with another item. Do not confuse the EXCHANGE operation with the RENAME operation. RENAME changes an item's name without affecting the item's contents. EXCHANGE swaps an entire item - its name AND contents - with another entire item.

To be able to exchange item1 with item2, item2 must be the same type as item1. For example, if item1 is a noun, item2 must also be a noun. Or if a verb has two objects, it can only be exchanged with a verb that also has two objects.


EXCHANGE is an interactive use only verb, that is, it can only be used from the START prompt and not from within a program.

After having specified the item to be exchanged and the item you want to exchange it with, PRAGMA checks if the items can be exchanged. If the exchange can take place, PRAGMA will prompt you for the name of the verb (or file if applicable) inside which you want to perform the exchange. After having done the exchange, PRAGMA will inform you of the number of times the exchange was performed. After having done an exchange you are given the possibility to do other exchanges with the same items. Simply hit to terminate the exchange procedure.


EXAMPLES

The following example illustrates how you can use EXCHANGE to correct a misspelling. When the file shown below was originally defined, the noun ADDRESS was misspelled ADRESS.


FILE called CUSTOMER

1 CUSTOMER INDEX SELECTION NOUN
2 NAME
3 ADRESS
4 ZIP
5 etc.


This error wasn't discovered until you attempted to include the noun ADDRESS in the definition of another verb. At that point PRAGMA responded with a message indicating that ADDRESS was not known and if you wanted to add it to the vocabulary as a new noun. Because of the different spelling, PRAGMA treated ADDRESS as a different noun. You went ahead with the definition of the new noun ADDRESS, deciding to correct the situation later.

You cannot correct this situation with a RENAME operation because both names now exist in PRAGMA's vocabulary. You may use the following EXCHANGE instruction instead:


EXCHANGE occurrences of ADRESS with ADDRESS

inside the definition of CUSTOMER


This replaces ADRESS with ADDRESS. Then you can use the verb FORGET to remove ADRESS from PRAGMA's vocabulary. Of course you could have also used ALTER to edit the file definition of CUSTOMER and replaced the misspelled noun. But should you have to exchange multiple occurrences of an item, EXCHANGE will come in handy.



Sometimes you may not want to alter the definition of a verb that is used by other verbs without first testing the changes.

EXCHANGE helps you do this. You create a copy of the verb, make the changes, and then test the verb. When you are satisfied that it works, you exchange the old verb with the new.


 

CustomWare® is a registered trademark of CustomWare Designs, Inc. All rights reserved.
CustomWare® is a registered servicemark of CustomWare Designs, Inc.  All rights reserved.
All images and designs on this web site are copyrighted© 2021.
v t