Applicable release versions: AP
|Description||using processing codes in a file-defining item.
The Power of Advanced Pick Dictionaries, Part 1:
The File-Defining Item
Contributed by Terri Hale
(original article ran in PickWorld Magazine)
Applications that used to take hundreds of lines of Pick/BASIC code can now be done using the Update processor (UP) and dictionaries with enhanced processing codes.
Several months ago, I was in Boulder, Colorado at the offices of Rigden. Ray Hoffman, a senior programmer, was upgrading one of Rigden's (R83) client's applications to Advanced Pick (AP). I asked Ray how much Pick/BASIC code he eliminated in the conversion. His answer may surprise you. "About 60 to 70%" was his reply.
In AP, many application functions are performed at the 'system' level, thereby greatly reducing the need for large Pick/BASIC programs while dramatically increasing its relational capabilities.
Included with Advanced Pick's processing codes is the ability to call Pick/BASIC subroutines from dictionaries. Applications which use the Update processor as their data entry tool consist of a varying number of small special function subroutines called from dictionaries, rather than one or more large data entry programs with multiple subroutine calls.
Processing codes, formerly referred to as conversions and correlatives, have been greatly enhanced in AP while maintaining compatibility with existing R83 conversions and correlatives. Data can be transformed at various processing times.
Processing codes are stored in both file-defining items and in attribute-defining items and define file relationships and data manipulation rules. Processing codes can be defined in three attributes in both file-defining and attribute-defining items.
In addition to increasing the functionality of existing dictionaries through the use of processing codes, four new attributes have been added to the Pick data dictionary. An inter-relationship exists between these new attributes and the Update processor.
Before we examine the file-defining item in Advanced Pick, let's review the structure of the file-defining item in R83 or Classic Pick.
ATT# NAME DESCRIPTION
001 D/CODE DICTIONARY CODE
002 A/AMC BASE FRAME IDENTFICATION NUMBER
003 S/NAME MODULO OR NUMBER OF CONTIGUOUS FRAMES IN
004 S/AMC SEPARATION OR NUMBER OF FRAMES PER GROUP
005 L/RET PROVIDES ACCESS RESTRICTION
006 L/UPD PROVIDES ACCESS RESTRICTION
009 V/TYP DATA JUSTIFICATION
010 V/MAX WIDTH FOR OUTPUT
013 REALLOC USED TO RESIZE FILE
Typically, the file-defining item includes a D/Code, Base FID, Modulo, Separation, V/Typ and V/Max. Programmers can modify the D/CODE, add security codes, change the length of item-ids and reallocate files.
Now, enter Advanced Pick.
To edit a dictionary in AP, the macro "ud", is used. This view is different than what is seen using the line editor in Classic Pick. The first thing you will notice is that the line numbers are not displayed. Secondly, the attribute names are displayed. Thirdly, four new attributes have been added to the data dictionary.
Figure B shows a file-defining item for the ORDER file in AP.
NAME DATA DESCRIPTION
DICTIONARY-CODE d VALID CODES ARE L,P,S,X,Y
BASE 10193 BASE FID
MODULO 67 MODULO
STRUCTURE SEPARATION IS ALWAYS 1.
RETRIEVAL-LOCK CONTROLS ACCESS TO FILE
UPDATE-LOCK CONTROLS ACCESS TO FILE
CORRELATIVE id100 ITEM-ID CORRELATIVE
call update.order PICK/BASIC PROGRAM CALL
I43322a1 FILE INDEX CORRELATIVE
bcustomer;2;6 BRIDGE CORRELATIVE
ATTRIBUTE-TYPE l JUSTIFICATION COLUMN-WIDTH 10 WIDTH FOR OUTPUT
INPUT-CONVERSION call default.order PICK/BASIC CALL
MACRO customer product qty DEFAULT INPUT ATTRIBUTES
OUTPUT-MACRO customer ext.price DEFAULT OUTPUT ATTRIBUTES
DESCRIPTION order file ON-LINE UP HELP MESSAGES
REALLOCATION REALLOCATION FOR RESIZING
All of the functions performed by the file-defining item in Classic Pick are still performed in AP. However, a closer look will show that application-oriented functionality has been added to the file-defining item in AP.
Let's examine some of the enhancements to the 13 original attributes, as well as study the four new attributes contained in the file-defining item in AP.
DICTIONARY-CODE. Several codes have been added to the existing (which are still valid) codes. This attribute must contain a d, and optionally the following codes:
l Causes transaction logger to log updates
p Primary filespace contains only pointer items
s Item-ids are case sensitive
x Do not save file
y Do not save file. An empty file exists after restore.
N Disable update protection
U Enable update protection
STRUCTURE. Separation is not specified in AP file creation, since the system defaults to a separation of 1.
CORRELATIVE. Processing codes on the correlative attribute are invoked at file time. In Figure B., there are several processing codes listed in multi-value format.
The first value "id100" is the item-id correlative which is used in conjunction with the Update processor to assign predefined item-ids to new items. The user can define the format and beginning number of the item-id by using this correlative. The system will assign the item-id at file time and automatically increment the item-id counter.
The second value "call update.order" tells the system to call a Pick/BASIC subroutine named update.order when the item is filed from UP. Within this Pick/BASIC subroutine, the item can be modified and/or data verification performed. This is the last chance to make amendments to the item before filing.
The third value "I43322a1" represents a file index correlative which indicates that an index has been created. This data is inserted by the system when the create-index verb is executed. (i.e., create-index ORDER a1)
Broken into parts, the "I" before the number "43322" is the processing code; "43322" is the root fid (or beginning frame address) of the index; the "a1" is the a-correlative expression defined in the creation of the index.
NOTE: Any number of attributes may be indexed in a file. Once the index has been created, the user can scan forward or backward by utilizing the Update processor on the indexed attribute (aka "cruising").
The fourth value "bcustomer;2;6" is a bridge correlative. Bridge correlatives maintain a horizontal relationship between an attribute in one file and an item in the same file, or to an item in another file. Filing an item with UP automatically executes the bridge correlative. In this example, the bridge correlative uses attribute 2 of the ORDER file as the item-id in the CUSTOMER file and writes the ORDER item-id into attribute 6 of the CUSTOMER file.
INPUT-CONVERSION. Processing codes on the input conversion attribute are applied before data entry. This dictionary is available only when used in conjunction with the Update processor.
In Figure B., there is a Pick/BASIC subroutine call to a program called default.order. This subroutine will be executed before the user gets control of the item.
MACRO. This attribute may contain default attributes to be used by the Update processor in data entry mode. By utilizing multi- values here, you can take advantage of a new functionality called "multiple views" of the data.
In Figure B., customer product and qty will be the attributes displayed for input when, for example, the tcl command :u order is executed.
OUTPUT-MACRO. This attribute may contain user specific attributes to be used by the LIST Processor.
In Figure B., customer and ext.price will be the attributes displayed for output by the list processor when, for example, the tcl-command :list order is executed.
If the OUTPUT-MACRO attribute is null, then the MACRO attribute is used as the default attribute list for output as well as for input. If both the MACRO and OUTPUT-MACRO attributes are null, then only the item-ids will be listed for output.
DESCRIPTION. This attribute may contain 'on-line' help documentation. In the Update processor, the description will be displayed, by typing "?" <return> at the item-id prompt.
In summary, by taking advantage of the Update processor and the enhanced processing codes, the programmer can modify or verify data from the file-defining item before getting into the item, or at file time.
In Part II of this series, you will see what enhancements have been made to the attribute-defining item in Advanced Pick. As a preview, the following chart summarizes the processing codes available for both the file-defining and the attribute-defining items.
FUNCTION OUTPUT CORR INPUT OUTPUT CORR INPUT
algebraic function x x x
ascending order x
attribute index correlative x
bridge correlative x
call BASIC subroutine x x x x x
callx BASIC subroutine x
character update x
concatenate x x
date conversion x x x
display only x
f-math correlative x x x
file index correlative x
group extract x x x
item id correlative x
length code x x x
mask character x x x
mask hexadecimal x x x
mask left & right justify x x x
mask time x x x
must input x
pattern match x x x
range x x x
remote index correlative x
substitution x x x
text extraction x x x
translate x x x
update stamp x
user exit x x
value code x
za x x
zip code x x x