ADVANCED
INFORM
NOTES
North Carolina Community College System Gloria S. Johnson Applications Analyst Programmer
Table of Contents
Page
Boolean (Logical) Operators ................................. 14 COMO ....................................................... 42 DICTIONARY CONVersions ..................................... 53 ENUM ....................................................... 57 File Pointers .............................................. 11 INLINE PROMPTING ........................................... 37 MENUS ...................................................... 40 Multivalued Fields ......................................... 7 SETPTR .................................................... 51 SLEEP Command .............................................. 35 Stored Paragraph Examples ................................. 38 Stored Sentences .......................................... 31 INFORM Verbs DELETE.LIST .......................................... GET.LIST ............................................. LIST.LABEL ........................................... MERGE.LIST ........................................... SAVE.LIST ............................................ SAVE.STACK ........................................... SELECT ................................................ I-Types or I-Descriptors CASE ................................................. CHAR ................................................. CONCATATION .......................................... CONDITIONAL EXPRESSION ............................... COUNT ................................................ DATE().................................................. DOWNCASE ............................................. EXTRACT .............................................. ICONV ................................................ LEN .................................................. LITERAL STRING ....................................... LINE NUMBERING ....................................... NUMERIC CONSTANT ..................................... OCONV ................................................ SUBSTRING EXTRACTION ................................. SUBROUTINE ........................................... SUM .................................................. TRANSLATE ............................................
23 22 52 26 21 25 16
60 50 45 50 57 55 49 46 54 49 46 47 47 54 49 50 57 58
I-Types 'On the Fly' ........................................ 62
APPENDIX Editor Commands ..................................... ii SELECT Editor Commands .............................. iii Prestored Editor Commands ........................... iv Associated Multivalued Field Examples ............... vi
About this manual:
1. 2. 3. Items in () are information only.
Bolded
items are for you to key or for emphasis. Do remember
Whenever you see “name”, fill in with your choice of names. the name you use must follow filename rules: a. b.
c.
d. e. 4.
Use capital letters. No spaces. Do not use system reserved words for filenames, such as, AVERAGE, CATALOG, COPY, GENERAL , INDEX, LIST, etc. The first character of a filename must be alphabetic. Maximum of 28 characters.
Items in <> are terminal keys to press. Example:
means to press your ENTER key.
5.
File data is enclosed in single quotes. Example: LIST STUDMAST WITH SEX = 'F'
6.
System words are sometimes in double quotes for emphasis. Example: "WHEN" keyword used with multivalued fields.
Note :
Additional information on any of the items covered in this manual may be found in an INFORM, PERFORM or INFO/BASIC manual.
On Line Documentation
:HELP
command, will display on-line documentation about that command.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -1-
COMPONENTS OF THE INFORMATION SYSTEM
There are four parts to the INFORMATION system: 1. 2.
PERFORM -- the command interpreter/environment of INFORMATION. INFORM -- the data manager, query language, and report writer of
INFORMATION.
3. 4.
INFO/BASIC -- a compiler and programming language for INFORMATION. Editor -- the component that allows you to create and edit INFO/BASIC
programs and data in INFORMATION files.
PERFORM -- the command interpreter of INFORMATION.
Every command that you issue to INFORMATION is first interpreted by PERFORM, which determines what action is to be taken. The command you issue may be handled by PERFORM itself, or may be passed along to another component for execution. Subsequent control, however, is always passed back to PERFORM when the command has been executed. The PERFORM colon prompt (:) appears whenever the system is waiting for you to give it an instruction. The colon prompt indicates that you are at PERFORM.
INFORM -- the INFORMATION system query language and report generator. Its
primary function is to perform file searches and to format output. Another useful part of INFORM is MODIFY, which allows simple data entry and modification.
INFO/BASIC -- is a tool for programmers.
It combines many features of PL1 and other high-level languages with BASIC. A comprehensive debugger is provided with INFO/BASIC. With INFO/BASIC complete application packages can be written, using the many available functions and subroutines.
Editor -- is a versatile line editor that combines all the basic features of a
text editor with the ability to edit, store, and re-execute commands. It is used primarily to create and modify INFO/BASIC programs, and to modify the contents of INFORMATION files.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -2-
Review of Retrieving Information
Points to remember when constructing INFORM STATEMENTS: 1. Make sure you are logged on to the appropriate account or have access to the files from which you wish to retrieve information. Enter INFORM statements at the colon prompt (:). The first word of an INFORM statement must be a verb. Each statement must be executed by pressing the key. Use only one filename per statement. Verbs, filenames, fieldnames, and other parameters must be separated by a blank space. Make sure that you enter the correct filename. List the dictionary of the file and become familiar with the fieldnames. Always enter INFORM statements in UPPERCASE letters. Use the key to erase, backup and correct.
2. 3. 4. 5. 6.
7. 8. 9. 10.
LOGIN
tc#
Enter password
:SET.TERM.TYPE PROCOMM.WYSE50
Editing Commands or PERFORM Stack Commands
The Stack keeps a record of all the commands you enter at the PERFORM command level or colon (:) prompt. It can contain up to 99 entries. New entries are constantly overwriting the oldest entries. The newest entry is entry number 01. The stack commands are often referred to as "dot" commands, because each one must begin with a dot (.). .L , .R , .C/old/new, .S (name), .A
The list of Stack Commands is stored in a HELP file. You can display this list at anytime by simply entering a .? at the colon prompt (:).
:.? :.L
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -3-
Defining Dictionary Contents
:CREATE.FILE GRADES DYNAMIC
This command creates an INFORMATION file named GRADES as a Dynamic file with default parameter values. Dynamic simply means the file can expand or contract and system access will be efficient. This message will display on your screen: Creating file "GRADES" as a DYNAMIC file. Added "@ID", the default record for INFORM, to DICT "GRADES".
:BELL OFF :MODIFY DICT GRADES
Creates the dictionary for the file, GRADES. This command is used to build and/or change a dictionary. The dictionary records define a field’s name, location, length, and field display and declare whether or not the field is single or multivalued. Prompt 1 FIELD= User Response Enter the NAME of the data field being described. No spaces. @ID is always in Location 0 and therefore the first field entry when building a dictionary. Enter D , I , or PH , plus optional description. D - data item, I - calculable, PH - phrase Enter location number, expression, or phrase fields. Enter data fields in strict numeric sequence. Optional: Enter INFO/BASIC conversion specification. MD0, number with no decimal places MD2, number with 2 decimal places D2/, for the date 02/04/88 D4/, for the date 02/04/1988 MCL, changes data to lowercase MCU, changes data to uppercase MCT, first letter uppercase and rest lowercase Optional: Enter display name for this field. It can have spaces. The default is the FIELDNAME
2 TYPE+EXP= New record 3 LOCATION=
4 CONV=
5 DISPLAY NAME=
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -4-
6 FORMAT=
#R #T #L R (Right Justify) numeric data to align and sort properly! T (Text Justify) alphabetic or alphanumeric data. Text
contains embedded spaces; the output lines are broken up using the field size as a guide, but only where a space occurs in the text line. (Left Justify) alphabetic or alphanumeric data.
L
7 S/M=
Only one value in a field, enter multiple values, enter M .
S; fields that contain
8 ASSOC=
Optional: PH name that names one or more multivalued fields that are related. When an association is specified, each value in one multivalued field is associated with its corresponding value in the other associated field(s).
Keep all of your fields in consecutive order, if you add a new field, check your dictionary for the next available location. Remember, to add the new field to the @MODIFY phrase or you will not be prompted for that field when entering data. The @MODIFY phrase is automatically created the first time data is entered in the file. A brief explanation of what is required as input to each of the MODIFY prompts is displayed when you press > in response to any MODIFY prompt.
At end, CHANGE= will be displayed; everything O.K., press
CHANGE= DELETE will delete the displayed field only CHANGE=
# will allow changes to that #
CHANGE= TOP will bail you out and return you to the beginning CHANGE= CHANGE=
^ backs up and repeats the previous prompt ?? displays HELP information
To make data changes to multivalued fields:
CHANGE= S2 (S2 means screen 2 for multivalued fields) Change which line item= # FIELDNAME= > (inserts before #) FIELDNAME= INSERT.NAME Change which line item= # FIELDNAME= ## (deletes the #)
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -5-
FIELDNAME @ID NAME DEPT SECTION GRADE CODE CNT LINK
TYPE D D D D D D I PH
LOCATION 0 1 2 3 4 5 1
CONV
DISPLAY NAME SSN
FORMAT S/M ASSOC 11R###-##-#### 15L S M M M S LINK LINK LINK
DEPARTMENT NAME SECTION NUMBER
4L 3R 1L 7L 3R 25L
DEPT SECTION GRADE
:LIST DICT GRADES
If changes need to be made, the same command used to create the dictionary can also be used to make changes in the dictionary.
:MODIFY DICT GRADES
At the FIELD= prompt, enter the FIELDNAME to change.
To enter data into the file GRADES ,
:MODIFY GRADES
The @MODIFY phrase is built by the system the first time data is entered. When you enter your data, use the following data examples:
DEPARTMENT NAME = SECTION NUMBER = GRADE = CODE =
MAT, ENG, WLD, PSY 101, 233, 112, 101 A, B, C, D, F A2526E, A10100
:SETFILE
Pathname:
/u1/class/GRADES2 GRADES2
VOC name:
:COPY FROM GRADES2 TO GRADES ALL SQUAWK
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -6-
Multivalued Fields
A multivalued field has more than one data value in that particular field. DEPT, SECTION and GRADE are multivalued fields since each student is likely to have more than one course or one grade. Multivalued fields have an M in the S/M field of the dictionary. Value marks "{" are automatically inserted to separate each individual value in a multivalued field. They can be viewed using the Editor.
ASSOCiations for Multivalued Fields
The association fieldname has a PH in the Type+Exp field to name the fields to be associated. An association relates two or more multivalued fields so that for every value in one field, there is a companion value in each of the associated fields. Look at the field, LINK!
:LIST GRADES LINK
"WITH" can be applied to single-valued and multivalued fields. "WITH" limits which records are chosen on a search. This contrasts with "WHEN", which limits which values of a multivalued field are displayed. "WITH EVERY" on multivalued fields lists only fields with that one value - no others -!
:LIST GRADES WITH GRADE = 'F' GRADE NAME
How many records were displayed? What did the display look like?
:LIST GRADES WHEN GRADE = 'F' GRADE NAME
How many records were displayed? What did the display look like?
:LIST GRADES WITH EVERY GRADE = 'F' GRADE NAME
How many records were displayed? What did the display look like?
BY.EXP
A variation of the "BY" command is the "BY.EXP" command that takes a multivalued field and explodes or expands the values of a particular field into their own list. To understand how the "BY.EXP" modifier works, you need to know that some fields of the records may have more than one piece of information stored in that field. For example, on the GRADES file, the DEPT
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -7-
field is multivalued and contains the department code for the classes the student is enrolled in. The "BY.EXP" modifier allows you to list out all of the information in that particular field; in this case you could create a list of all students in the GRADES file with a listing for each MATH department. Without the "BY.EXP" modifier, a regular INFORM statement would return only the first value in the field. The "BY.EXP" modifier creates a list in ascending order, listing all values in a field. It can be used with the SORT, SELECT or SSELECT verbs.
:LIST GRADES BY.EXP DEPT BY.EXP SECTION DEPT SECTION NAME
Remember that the "BY.EXP" command has created a listing for every value in the sorted field--not just for each record in the file.
BY.EXP.DSND
This modifier is a combination of both the "BY.EXP" and "BY.DSND" modifiers. It returns the same information as "BY.EXP", but it sorts it and then displays the information in descending (reverse) order--that is, from Z to A or from 10 to 1. Use your .C to change "BY.EXP" to "BY.EXP.DSND " and execute.
:LIST GRADES BY.EXP.DSND DEPT BY.EXP.DSND SECTION DEPT SECTION NAME
Notice the difference in display? How would you get a listing not only by department but also by section that is in sorted order? How would you list the department and section but in grade order?
:LIST GRADES BY.EXP GRADE BY.EXP DEPT BY.EXP SECTION LINK
How would you list in department, section and grade order?
:LIST GRADES BY.EXP DEPT BY.EXP SECTION BY.EXP GRADE LINK
Do you remember how to use "BREAK.ON" for a more readable display?
:LIST GRADES BY.EXP DEPT BY.EXP SECTION BY.EXP GRADE BREAK.ON DEPT BREAK.ON SECTION BREAK.ON GRADE
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -8-
Multivalued Field Sentence Examples:
:LIST GRADES NAME DEPT SECTION GRADE BY NAME :LIST GRADES WHEN DEPT = 'MAT' DEPT NAME :LIST GRADES WHEN GRADE = 'A' NAME DEPT SECTION BY.EXP DEPT BY.EXP SECTION GRADE :LIST GRADES BY.EXP DEPT BY.EXP SECTION GRADE NAME DEPT SECTION :LIST GRADES WHEN DEPT = 'ENG' DEPT SECTION BY.EXP SECTION :LIST GRADES WHEN GRADE = 'F' NAME DEPT SECTION GRADE BY.EXP DEPT BY.EXP SECTION :LIST GRADES BY.EXP DEPT BY.EXP SECTION GRADE NAME BREAK.ON DEPT BREAK.ON SECTION :LIST GRADES BY.EXP DEPT BREAK.ON "'O'" DEPT BY.EXP SECTION BREAK.ON "'O'" SECTION GRADE NAME :LIST GRADES WHEN DEPT = 'WLD' AND WHEN SECTION = '112' DEPT SECTION NAME TOTAL CNT
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -9-
Two Line Heading for Display Names
You may use the following EDITOR COMMANDS when creating or modifying a record.
DE DELETE
FILE
I
P
T C Q
deletes the line above it deletes the entire record files the current record puts you in input mode prints or displays record takes you to the top of the record allows you to make changes to exit or quit
For additional information on the Editor Commands refer to the appendix of this manual. If you wanted to make DEPARTMENT display on one line of the column heading and have
NAME display directly below DEPARTMENT on a second line, try this:
:ED DICT GRADES DEPT
7 lines long. ____: P 0001: D 0002: 2 0003: 0004: DEPARTMENT NAME 0005: 4L 0006: M 0007: LINK Bottom at line 7. ____: T
(display name field)
When your cursor is under line 4, to enable the Up arrow mode: Hold down the key and press <6> then Up arrow mode = enabled will be displayed.
C/T N/T^253N
0004: ____: DEPARTMENT^253NAME
FILE
When the up arrow mode is disabled, the same line will be displayed as: ^ Up arrow mode = disabled.
0004:
DEPARTMENT}NAME
Change the display to two lines for the field, SECTION.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -10-
File Pointers
To retrieve information from a file, you must have a file pointer to the desired file or files if they DO NOT reside in the user's account. Think of a file pointer as the address or location of the file. In the user's account, at the INFORMATION colon (:),
the command for a file pointer is:
:SETFILE
These prompts will be displayed for you to answer! Pathname:
/u1/class/STUDMAST STUDMAST
VOC name:
:SETFILE
Pathname:
/u1/class/MAJORS MAJORS
VOC name:
:SETFILE
Pathname:
/u1/class/COUNTIES COUNTIES
VOC name:
You must do a file pointer for every file to be accessed. Look at the file dictionary and make sure any I-types you are planning to use also have file pointers to those files. Check to see if you have access to the above files, by listing their dictionaries.
:LIST DICT STUDMAST :LIST DICT MAJORS :LIST DICT COUNTIES
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -11-
:LIST DICT STUDMAST
The above INFORM sentence will serve as a check. If you can list the DICTionary you know your file pointer has been correctly established. This is a partial listing of the DICTionary of the STUDMAST file. FIELD NAME @ID LAST FIRST MIDDLE ADDRESS CITY STATE ZIP COUNTY PHONE SEX RACE BIRTHDATE MAJOR ADVISOR SEM-IDX CUM-IDX CURR.EMP GRD-LVL CNT CSZ1 NAME ADD1 JOB TYPE D D D D D D D D D D D D D D D D D D D I I I I I LOCATION CONV DISPLAY NAME FORMAT S/M ASSOC 0 STUDMAST 10L S 1 16L S 2 16L S 3 16L S 4 30L M 5 19L S 6 2L S 7 5L S 8 2L S 9 12R###-###-#### 11 1L S 12 2L S 15 D2/ 8R S 45 5L M 47 7L S 54 MD34 6R S 55 MD34 6R S 66 1L M 67 2R S 1 4R S CITY:', ':STATE:' ':ZIP 36L LAST:', ':FIRST:' ':MIDDLE EXTRACT(ADDRESS,1,1,0) 30L IF CURR.EMP = 'U' THEN 'UNEMPLOYED' 12L ELSE IF CURR.EMP = 'P' THEN 'PART-TIME' ELSE 'FULL-TIME' IF RACE = '1' THEN 'WHITE' ELSE IF 16L RACE = '2' THEN 'BLACK' ELSE IF RACE = '3' THEN 'AMERICAN INDIAN' ELSE IF RACE = '4' THEN 'HISPANIC' ELSE 'ASIAN' TRANS(ETHNIC,RACE,DESCRIPTION,'X') IF SEX = 'F' THEN 'FEMALE' ELSE 'MALE' IF SEX ='M' THEN 'Mr.' ELSE 'Ms.' IF BIRTHDATE # '' THEN INT((DATE() - BIRTHDATE) / 365.25) ELSE '' TITLE:' ':FIRST:' ':MIDDLE:' ':LAST TRANS(COUNTIES,COUNTY,COUNTY,'X') TRANS(MAJORS,MAJOR,DESCRIPTION,'X') 3L 3R
RACE.DESC
I
RACE.NAME SEX.DESC TITLE AGE
I I I I
ENVNAME COUNTY.NAME MAJOR.NAME
I I I
36L 30L 35L
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -12-
Review of WITH, WHEN and WITH EVERY
Using "EVERY" in the INFORM statement means that for an item to be selected, every value of a multivalued field must meet the condition indicated. If you are producing a list of students with a PROG.SEM = '81/02' and you include "EVERY", it means that every PROG.SEM must be equal to '81/02' otherwise, the student record will not be selected for your list.
:LIST STUDMAST WITH PROG.SEM = '1999*01' PROG.SEM LAST
This displays a list of students who have multiple PROG.SEM.
:LIST STUDMAST WITH EVERY PROG.SEM = '1999*01' PROG.SEM LAST MAJOR.NAME
Notice the difference! For multivalued fields use the keyword "WHEN" and notice the difference over the keyword "WITH".
:LIST STUDMAST WHEN PROG.SEM = '1999*01' PROG.SEM LAST :.C/WHEN/WITH :.X
Explain the difference!
Variations in Display Format
Every INFORM statement we have used thus far has generated a list on the terminal screen. The record keys for the file and the data from each requested field were listed in separate columns. Sometimes, however, an INFORM statement produces so much information that it will not fit in the 80 columns available for display on the screen. The following INFORM statement, for example, produces a list too wide to display each field in separate columns: :LIST
STUDMAST NAME CSZ1 JOB RACE.DESC BIRTHDATE
All the information is there, but rather than being listed in separate columns across the screen, the data for each field is displayed on a separate line, with a blank line between records. If you send your job to a printer with computer paper, your report may still print horizontally as approximately 132 characters can be printed on 14-inch wide paper.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -13-
Boolean (Logical) Operators
Boolean or logical operators, also called connectives, can be used in INFORM statements to expand or restrict the records that are selected. Below is a list of the Boolean operators than can be used with INFORM statements. CONNECTIVE MEANING Both connected parts must be true. Either connected part must be true. Used to exclude items from consideration.
AND OR NO or NOT
"AND" is used when two or more criteria are to be applied to the selection of records. For example, to create a list of students who are female and black use this statement:
:LIST STUDMAST WITH SEX = 'F' SEX AND WITH RACE = RACE.DESC
'2'
Another command that is often helpful in locating problem records uses the "NO" operator. The "NO" applies only to the one fieldname that directly follows it. When "NO" is used, the command will select only those records that have no data in that field. If the record contains any data in that field, even a zero or a space, it will not be selected.
:LIST STUDMAST WITH NO PHONE LAST PHONE :LIST STUDMAST WITH NO BIRTHDATE BIRTHDATE AND WITH NO PHONE PHONE LAST
The above lists all of the STUDMAST records that do not have a telephone listing or a birth date.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -14-
Combining Modifiers in Complex Statements
When using combinations of "AND", "OR", "WITH ", "NO" and other modifiers and connectives, it is very important that they be understood and used correctly. Seemingly minor variation in the construction of a complex statement can provide extremely different results. To get the results you want, you need to enter the correct command. To demonstrate the intricacies of using multiple selection criteria, we will use three fields from the STUDMAST file. The first statement displays the contents of these three fields for all records in the entire STUDMAST file:
:LIST STUDMAST SEX RACE CURR.EMP :LIST STUDMAST WITH SEX = 'F' OR WITH WITH CURR.EMP = 'U' SEX RACE.DESC JOB RACE = '2' OR
This example demonstrates the "OR" modifier. Notice that when "OR" is used, only one of the criteria must be met to make the record available for inclusion on the list. Generally, the more "ORs" you use, the larger and more inclusive the list will become. This is because there are more chances for each record to meet one of the requirements. Since a record only needs to meet one of the requirements, it becomes easier to be included on the list. Adding additional "OR" clauses to a command can only increase the number of items on the list or keep it the same. You cannot reduce the number of items on a list by using "OR" clauses. When more and more "AND" clauses are used, the list becomes smaller. The connective "AND" has the effect of being more selective because each record has more requirements to meet, and it must meet all of them, in order to be included. Adding an additional "AND" clause cannot increase the number of items to be selected. It can only make the list smaller or leave the same items.
:.C/OR/AND/G :.X :LIST STUDMAST WITH SEX = 'F' AND WITH RACE = '2' AND WITH CURR.EMP = 'U' SEX RACE.DESC JOB
When "AND WITH " and "OR WITH" are used in the same command, the processing is always left to right. In the STUDMAST dictionary, the fields CURR.EMP and EMP-F/P contain the same data and can be used interchangeably.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -15-
:LIST STUDMAST WITH SEX = 'M' AND WITH RACE = '1' AND WITH CURR.EMP = 'F' SEX RACE.DESC JOB
Change the "ANDs" to "ORs" and re-execute. Did you notice that the "AND" became more selective, allowing very few records to make it on the list. The "OR" had the effect of being inclusive in that it easily adds many records to our list.
Introduction to the SELECT Verb
The SELECT verb is used to separate out a specified portion of a file that can be saved in another file for future use. It does take some time to execute because the entire file being accessed must be reviewed to ensure that the final selected list is complete. Once the desired set of records has been gathered by a SELECT statement, that information can then be processed further using other INFORM statements or saved for future use. The standard format for a SELECT statement is shown below, followed by an example:
SELECT Filename Selection Criteria
:SELECT STUDMAST WITH CITY = 'Raleigh'
It is important to include the selection criteria portion of a SELECT statement (i.e., the WITH CITY = 'Raleigh' phrase above), because without it, the entire file will be selected, which would be both time consuming and fruitless. The SELECT statement is used only to select. No data is displayed; therefore, no fieldnames are included in a SELECT statement, as they often are with LIST and SORT. Note the sample SELECT statement below and its results:
:SELECT STUDMAST WITH SEX = 'F'
In the statement, the verb is SELECT, the filename is STUDMAST, and the selection criteria consist of a WITH phrase acting upon the SEX field. The single quotation marks are used to surround the exact value to be looked for in the SEX field. Double quotes may also be used. Just open and close with the same quote mark. Instead of displaying records as the LIST and SORT verbs do, a SELECT statement always gives a message in the following pattern: N records selected. (where "N" can be any number)
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -16-
The SELECT verb creates in memory a list of record keys (item IDs) for those records that meet the selection criteria. Here is another example of how to use SELECT.
:SELECT STUDMAST WITH MAJOR = 'A2526E'
In this example, records from the STUDMAST file of students in a 'A2526E' curriculum were selected. The results tell us there are how many students in the 'A2526E' curriculum? Once a SELECT statement has been executed, the very next INFORM statement entered at the colon (:) prompt applies to this selected list, rather than to the entire file. For example, if a LIST statement were entered at the (:) prompt following the message "________ items selected," only the selected information would be listed, instead of the entire STUDMAST file. For example, suppose you enter the two INFORM statements shown in the following example:
:SELECT STUDMAST WITH NO PHONE :LIST STUDMAST PHONE LAST
The LIST statement will list no phone number along with the last name for the records previously selected from the STUDMAST file.
.X
(Remember, this re-executes the last sentence)
What data is displayed now? To sort the information, the BY phrase could be placed either before or after the WITH phrase, as shown in the following examples:
:LIST STUDMAST WITH SEX = 'M' BY LAST NAME SEX :LIST STUDMAST BY LAST WITH SEX = 'M' NAME SEX :SORT STUDMAST WITH SEX = 'M' LAST CITY SEX BY LAST
Using the SORT verb will display the record @IDs of people with the same last name in numeric order. Think of the primary sort being on last name and the secondary sort on @ID.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -17-
We mentioned earlier that any valid LIST, SORT , COUNT, or other INFORM statement can be used after a SELECT statement, and the statement will act only on those records which have been selected. However, this is true only when the INFORM statement is entered immediately after the SELECT statement has executed. The following examples will demonstrate how this is done. In the next example, student records for students living in Raleigh are selected.
:SELECT STUDMAST WITH CITY SPOKEN 'RALEIGH'
Suppose, now, that you attempt to list the selected students but misspell CITY as CITTY. This results in the system message: "CITTY not found." No items will be selected. Type the following sentence and then correct it. What happened?
:LIST STUDMAST CITTY :.C/CITTY/CITY :.X
Since the list gathered by the SELECT statement remains active only for the very next INFORM statement, entering anything else before a valid INFORM statement is entered causes the selected list to be lost. A subsequent INFORM statement then applies to the entire file. The result is the whole STUDMAST file gets displayed. You will see cities other than Raleigh. Suppose, however, that a correct LIST statement had been entered immediately following the SELECT statement--now only those students whose address is in 'Raleigh' have been listed. Do it! Suppose that you enter a SELECT statement with no selection criteria phrase, as shown below:
:SELECT STUDMAST
In this case, all record keys in the STUDMAST file are selected (this will also take a long time on normal systems); in other words, the resulting list is the same as the unselected contents of the STUDMAST file. Thus a SELECT statement of this type gives no advantage over using INFORM on the STUDMAST file directly.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -18-
Using the SSELECT (SORT SELECT) Verb
Another version of the SELECT verb is SSELECT, which stands for "SORT SELECT." SSELECT allows you to sort or order the records in a file as their keys are being selected. This is different from SELECT, which (Like LIST ) retrieves the information in the order in which the records are stored on the disk. An SSELECT statement takes a little longer to execute than a comparable SELECT statement, because of the additional sorting that takes place after the records have been selected. An SSELECT statement followed by a LIST statement produces exactly the same result as a SELECT statement followed by a SORT statement, when applied to the same file. For example, our earlier sample SELECT statement is displayed again. Also shown is a SORT statement being entered immediately after the SELECT.
:SELECT STUDMAST WITH CITY = 'Greensboro' :SORT STUDMAST BY LAST LAST ADDRESS CITY
The SSELECT statement and LIST statement shown below are the equivalent of the combination of SELECT and SORT statements.
:SSELECT STUDMAST BY LAST WITH CITY SPOKEN 'GREENSBORO' :LIST STUDMAST LAST ADDRESS CITY
Comparing the resulting displays shows the results to be identical. As you can see, the report generated by the LIST statement is in alphabetical order because of the earlier SSELECT. An SSELECT statement is therefore most advantageous when used to create a select list that will be stored on the disk so it can be retrieved for repeated future use. When an SSELECT statement is used instead of a SELECT statement, the data is restored in a standard order. Then LIST statements (which display results more quickly than SORT statements) can be used for future processing. Using a "BY.DSND" phrase with SSELECT works just as with a SORT verb, except that specified keys are selected before the SORT takes place and the sorted list is therefore shorter.
:SSELECT STUDMAST BY.DSND LAST WITH CITY SPOKEN 'MONROE' :LIST STUDMAST LAST ADDRESS CITY
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -19-
Note the results include only students from Monroe, because of the select that took place. The same set of students was retrieved as with the SORT verb, but in descending alphabetical order because of the "BY.DSND" statement. So far we have covered the SELECT and SSELECT verbs. The next section describes how to use SELECT and SSELECT with multiple files. After this section we will introduce several other verbs that can be used in conjunction with SELECT and SSELECT to save and retrieve a selected list for repeated use.
Using SELECT with Multiple Files
In the examples thus far, the INFORM statement entered immediately after the SELECT statement has always referred to the same file. For example, when we first SELECTed a portion of the STUDMAST file, we went on to use the STUDMAST file in the LIST or SORT statement that followed. This is not a requirement, however. A list of SELECTed keys can also be used for further processing in a different file. Remember that you can only use one filename in each INFORM statement. However, you can use another statement in conjunction with a SELECT statement to produce some useful reports. With this process you can use information from two or more files because each filename is in a separate command. The second statement will refer to the data collected from the first SELECT statement. This process works when the key for each file used is the same.
:SELECT GRADES :SELECT STUDMAST :LIST STUDMAST LAST CITY
Explain your results! The "SAVING" keyword when used with a "SELECT" is very useful when the saving field happens to be the @ID of another file with information in it you wish. In other words, you have two files and you want some data from both of them and the record IDs are not the same.
:SELECT STUDMAST WITH MAJOR = 'A10100' SAVING MAJOR :LIST MAJORS DESCRIPTION
Explain your results!
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -20-
Storing and Retrieving Lists
When using the SELECT or SSELECT verb, you sort through an entire file in order to select a small group of records for use in an additional INFORM statement. Unless the selected list can somehow be saved to disk, it is lost as soon as the second INFORM statement executes. This is true even if there is an error in the second statement so that the desired information was not obtained-you must start from scratch. To avoid repeating the time-consuming selection process, you can save a selected list and use it over and over again. A selected list is saved through the use of an INFORM verb called SAVE.LIST .
Using the SAVE.LIST Verb
You have learned that when using the SELECT verb, a group of record keys is gathered and stored in temporary memory. You have also learned that a follow-up INFORM statement must be entered immediately after the selected list has been generated. If anything else is entered at the next colon (:) prompt, the selected list is lost. Even when a second INFORM statement is entered and the data displayed using either a LIST or SORT verb, the selected list cannot be used again unless you start from the beginning and select it a second time. To avoid losing a selected list, you can enter the verb SAVE.LIST, followed by an identifying name, at the colon (:) prompt that appears right after a SELECT verb has executed. Any identifying name will work, but some names should be avoided. Do not use verbs, keywords or names of files as a saved list name. These are special words reserved for system use. The name should be descriptive enough to explain what is in the list, but short enough to be easily used and remembered. The name must be a single word (no spaces), but can include periods. Following is an example of a SELECT statement followed immediately by a SAVE.LIST statement.
:SELECT STUDMAST WITH SEM-IDX GT '3.50' :SAVE.LIST HONORS
The SAVE.LIST statement stores the selected list of STUDMAST records on the disk so that the list can be used repeatedly. The SAVE.LIST verb thus turns a temporary select list into a saved select list. We see that when the above list was saved on the disk, a message was displayed. Saved list "HONORS" in file "&SAVEDLISTS&". It is helpful to save a selected list under a short but descriptive name to help you remember what the list contains.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -21-
Using the GET.LIST Verb
In order to use a saved SELECT list, you must first retrieve the list and place it in temporary memory for further processing. Entering the verb GET.LIST, followed by the name of the saved select list does this. The following example shows how the GET.LIST verb can be used to retrieve the list of STUDMAST records saved earlier under the name HONORS.
:GET.LIST HONORS
Whenever the GET.LIST verb is used, it reports the number of records (i.e., items) in the retrieved list, as follows: N items selected.
:LIST STUDMAST SEM-IDX
Once the saved select list has been retrieved into temporary memory, you can enter any valid INFORM statement you wish to apply to the list. However, if you make a mistake, you must again bring the saved select list into temporary memory by the use of a GET.LIST statement. This can be done as many times as is necessary or desired. Following is an example of retrieving a list and making an error, then again retrieving the list and creating a valid report:
:GET.LIST HONORS :LSIT STUDMAST LAST SEM-IDX MAJOR
Error: "LSIT" is not in your vocabulary file.
:.C/LSIT/LIST :.X :GET.LIST HONORS :LIST STUDMAST LAST SEM-IDX MAJOR
Practice using your stack to re-execute the sentences. When using a saved select list, remember that only the record keys are saved. When you ask for the list to be displayed using either a LIST or SORT verb, you must specify the fieldnames to display. Using a filename different than the one used in the original SELECT is possible, but you have to know what you are doing to avoid confusion.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -22-
:SELECT GRADES WITH EVERY GRADE = 'A' :LIST STUDMAST NAME ADDRESS CSZ1
What was the result?
Using a DELETE.LIST Verb
Saved select lists are stored on the computer's hard disk. At first, there will most likely be only a few of these saved select lists occupying space. However, the number of saved select lists can build up with time. It is a good idea, as each list is saved, to write down its name and exactly what it contains or what its' intended uses are. When you have finished using a saved select list and have no further need of it, you should delete the list using the DELETE.LIST verb. Make sure that you are not going to need the list for future reports or worksheets, because once a saved select list has been deleted, you will need to reselect the list to use it again. An example of how to use DELETE.LIST is:
:DELETE.LIST HONORS
The saved select list of STUDMAST records has now been deleted. Notice that we did not have to retrieve the list to delete it. The system automatically searched the disk until it found the list named "HONORS" and deleted it. An attempt to retrieve a saved select list after it has been deleted, or to retrieve a nonexistent list, results in an error message. Try one or more of the following examples and note the results! Example 1
:SELECT STUDMAST WITH CITY = "Raleigh"
or
:SELECT STUDMAST WITH CITY SPOKEN 'RALEIGH'
8 records selected.
:SAVE.LIST RALEIGH
Saved list "RALEIGH" in file &SAVEDLISTS&".
:GET.LIST RALEIGH :LIST STUDMAST CITY LAST
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -23-
Example 2
:SELECT STUDMAST WITH MAJOR = 'A2526E'
23 records selected.
:SAVE.LIST PROGRAMMING
Saved list "PROGRAMMING" in file "&SAVEDLISTS&".
:GET.LIST PROGRAMMING :LIST STUDMAST MAJOR MAJOR.NAME LAST
Example 3
:SELECT STUDMAST WITH SEM-IDX GT '3.50' :SAVE.LIST HONORS :LIST STUDMAST SEM-IDX LAST MAJOR BY MAJOR
Now use the GET.LIST command and re-execute the INFORM sentences.
:GET.LIST RALEIGH :LIST STUDMAST NAME CITY
Explain the results! List all of your saved lists and practice using them. Use EDIT.LIST and DELETE.LIST for each SAVE.LIST. Can you think of a different SELECT statement to test and use with each of the ".LIST" commands?
Identifying Saved Lists
At times, you will want to identify all of the lists that have been saved on your system, either to find one when you cannot remember its name or to see if there are unused lists that should be deleted. To see the names of all saved select lists, enter the following:
:LIST &SAVEDLISTS&
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -24-
Notice that the display shows only the names of lists saved on the disk. It doesn't tell you anything about what is stored in a list or how large it is. For this reason, you should always keep a record of the names of your saved select lists, along with descriptions of what the lists contain, and what they are to be used for. The &&S.LOGIN.LINE# entries are system entries showing the user login and line number of users accessing the account. The other entries are saved lists in the current account. If data in the files changes, your saved lists will not be current. It is also important to know that an existing saved select list will be lost if you use the same name in saving another list. The system will not warn you that there is already a list saved under that name, but will automatically write the data from the new list on top of the data from the previous list. This makes it impossible to access the original select list.
:EDIT.LIST "name"
What did you think would be displayed?
SAVE.STACK Command
The SAVE.STACK command saves the current stack in &SAVEDLISTS& with the name you assign to it. It can be retrieved with the GET.STACK command. You may retrieve a saved stack even if you are using a different LOGIN or have a different user line from the time it was created, just so you are in the same account it was saved in. Remember the command, .L99 displays your current stack.
:SAVE.STACK "name" :GET.STACK "name"
You may turn your stack "ON" or "OFF" as you wish. The default is "ON".
:ED VOC STACKWRITE
2 lines long. 0001: X 0002: ON Bottom at line 2. Save your current stack. Remember what you name it. sometime before the end of class and use it. Retrieve your saved stack
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -25-
MERGE.LIST Command
The MERGE.LIST command merges two SELECT Lists using relational sets. Format:
MERGE.LIST list.number rel.op list.number [TO list.number] [COUNT.SUP] list.number is the number of a SELECT List, 0 through 10.
rel.op is one of the following relational set operators:
UNION INTERSECTION (synonym INTERSECT) DIFFERENCE (synonym DIFF) TO precedes the number of the output SELECT list, into which the merged
lists are placed.
COUNT.SUP suppresses the display of the number of records selected.
The MERGE.LIST command applies the relational set operators UNION, INTERSECTION, and DIFFERENCE to SELECT Lists. MERGE.LIST performs the relational set operation on two numbered SELECT Lists, and places the result of the operation in a SELECT List.
MERGE.LIST enables you to create a SELECT list from existing SELECT Lists, and avoids the need to execute another SELECT command. After a successful relational set operation, the two numbered SELECT Lists are emptied, and @SYSTEM.RETURN.CODE contains the number of elements in the resultant SELECT List. If MERGE.LIST does not complete successfully, the @SYSTEM.RETURN.CODE is set to -1; the SELECT Lists are also drained, unless the error was
syntactic, in which case they are not changed.
UNION:
The union of two sets, A and B, results in a set whose members are contained in set A or set B. The resultant set contains no duplicates, and the order of members within the set is not predefined.
INTERSECTION :
The intersection of two sets, A and B, results in a set whose members are contained in both set A and set B. The resultant set contains no duplicates, and the order of members within the set is not predefined.
DIFFERENCE:
The difference of two sets, A and B, results in a set whose members are the remainder after the subtraction from set A of members who also exist in set B. The order of members within the set is not predefined.
Specifying the SELECT Lists :
You must specify the numbers of the two
SELECT Lists to be merged. If you want to store the result of the merger in a specified SELECT List, use the TO clause. If you omit the TO clause, MERGE.LIST uses SELECT List 0 as the output SELECT List.
If you specify a SELECT List that is either inactive or empty, MERGE.LIST issues a warning message, and terminates.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -26-
MERGE.LIST Command
The MERGE.LIST command merges two SELECT lists using relational set operations. There are three choices to use along with MERGE.LIST . They are UNION, INTERSECTION and DIFFERENCE . You would use UNION for no duplicates, INTERSECTION to find those IDs common to both and DIFFERENCE for those left after subtracting a set.
:SELECT GRADES :SAVE.LIST "name" :SELECT STUDMAST :SAVE.LIST "second.name" :GET.LIST "name" TO 1 :GET.LIST "second.name" TO 6 :MERGE.LIST 1 UNION 6 TO 2 :SAVE.LIST "new.name" FROM 2
All numbers are in memory. The new.name SAVE.LIST gives unduplicated IDs of the two GET.LIST s. GRADES has 12 records; STUDMAST has 161; 7 records in GRADES are also in STUDMAST . After the merge using UNION there are 165 records in the new save list. The two record IDs in GRADES that were not in STUDMAST were the ones added. The result gives an unduplicated ID list that is great. The last SAVE.LIST is what gives 2 a name and puts it in &SAVEDLISTS& to use.
GET.LIST s must have similar IDs and #s must be between 1 and 10. UNION
__________ |//////////| A |//////////|…………… |/////|////|/////| |/////|////|/////| |/////|////|/////| |/////|////|/////| |//////////| B |//////////| 150 added 2 IDs INTERSECTION __________ | | A | |…………… | |////| | | |////| | | |////| | | |////| | | | B |__________| 9 DIFFERENCE __________ |//////////| A |//////////|…………… |/////| | | |/////| | | |/////| | | |/////| | | | | B |__________| 2
IDs same in both
IDs not in STUDMAST
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -27-
Example using STUDMAST file and MISC.TEST file in CC.RG account .
In the file, MISC.TEST , the fields, MISC.TEST.CODE and MISC.TEST.SCORE, are both multivalued. Assuming your test codes are MATH and ACT, try this:
:SELECT MISC.TEST BY.EXP MISC.TEST.CODE WHEN MISC.TEST.CODE EQ 'MATH' AND MISC.TEST.SCORE GT '49' :SELECT STUDMAST SAVING UNIQUE @ID
Saving Unique IDs eliminates the duplicates created using BY.EXP
:SAVE.LIST TEST.1 :SELECT MISC.TEST BY.EXP MISC.TEST.CODE WHEN MISC.TEST.CODE EQ 'ACT' AND MISC.TEST.SCORE GT 49 :SELECT STUDMAST SAVING UNIQUE @ID :SAVE.LIST TEST.2 :GET.LIST TEST.1 TO 1 :GET.LIST TEST.2 TO 2 :MERGE.LIST 1 INTERSECTION 2 TO 3 :SAVE.LIST TEST.3 FROM 3 :GET.LIST TEST.3 :LIST MISC.TEST MISC.TEST.CODE MISC.TEST.SCORE :GET.LIST TEST.3 :LIST STUDMAST NAME ADDRESS .......
So, after all this, TEST.3 should be the SELECT list of SSNs that you want.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -28-
Using the SETPTR command
It is often useful to print at a printer other than the system printer. The "SETPTR" command can be used to print at your choice of available printers.
:SETPTR 0,,,,,,AT TCPR,NFMT
Note :
TCPR is the name of the printer at the back of the classroom. When you use the command at your college, replace TCPR with the name of your printer. Lptr Width Length Top margin Bot margin Mode 0 132 60 3 3 1 Spool
Options are: EJECT; NFMT; AT TCPR OK to set parameters as displayed? (Enter or "N") = Press for yes to accept defaults as displayed. Example:
:SETPTR 0,80,55,6,5,1,AT TCPR,NFMT,BRIEF
80 55 6 5 columns lines per page lines top margin lines bottom margin
Note :
The 6 commas with the default command and the same 6 commas when you make selections! The "BRIEF" option means execute the command, but do not display the parameters. For additional information about the "SETPTR" command, enter:
:HELP SETPTR
What would the "SETPTR" command be if you only wished to change the column parameter to 80 and not change any other parameters?
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -29-
Printing INFORM Reports
Reports generated by INFORM statements can be sent to a system printer instead of to the terminal screen by using the keyword LPTR anywhere within the statement. It is advisable to create and be satisfied with your report and then use the append command to add LPTR before re-executing.
:LIST STUDMAST BY LAST NAME PHONE :.A :.X
It is important to remember that the files used in class are much smaller than your system files. Please use caution when working with large files at your college. Use the keyword "SAMPLE" to start, get it displayed as you wish on your screen and then print. A mistake can result in a 2000-page printout whose only real use is in your fireplace!
LPTR
:SELECT STUDMAST SAMPLE 10 :LIST STUDMAST BY LAST NAME PHONE
A job can be stopped before it starts to print using the commands:
:SPOOL -LIST -DETAIL :SPOOL -CANCEL #
(note the JOB # on the left)
You may only cancel your own jobs. If the printing has already started, call your system administrator to stop the printer and cancel the request or try this command:
:SPOOL -CANCEL # -NOW
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -30-
Creating a Stored Sentence
INFORM statements can become very complex, and occasionally you will want to save a statement to be used repeatedly. To do this, you can create what is called a stored sentence or a paragraph that is a group of stored sentences. They are very convenient because you can run them using only a single word. This allows you to set up your own custom reports that can be run on a daily or monthly basis without having to re-key the entire sequence of INFORM commands. Once stored, the sentence may be executed again by simply typing the name at the colon prompt. Stored sentence records in the vocabulary file contain an "S" as the first character on line one, with an optional description of the purpose of the sentence. Line two is the sentence that will be executed when the name of the sentence is encountered. Stored sentences are also useful for situations where a sentence is long and complex and is going to be used more than once, or where any sentence is going to be used frequently, and it is desired to reduce the amount of typing or the possibility of typing errors. The stored sentence, "LISTS" displays all stored sentence definition records in the "VOC" file of the user account.
:LISTS :ED VOC "name"
New record. ____: I (input) 0001= S (description) 0002= the text of the stored sentence 0003= Bottom at line 2. ____: FILE “name” filed in file "VOC". You may also store a sentence from position 1 in your stack by typing .S “name” , where name is the stored sentence name. To execute, type “name”. If the “name” you use already exists in the “VOC”, you will be prompted by the following message. "name" is already in your vocabulary file as type "S". Saved on 18:50:22 19 AUG 1999 by TC2 Do you wish to choose a New name, or Overwrite, or Quit?
(N/O/Q):
Save a few stored sentences and execute them as a test of the procedure. Paragraphs are a series of sentences kept in a single record in the "VOC" file, for subsequent execution by simply typing the name of the paragraph. The first two characters of field one of the paragraph record must be the letters "PA", to identify this as a paragraph record; a description of the paragraph may optionally be included. Each of the next lines contain an INFORM sentence, using the same format as would be used at the terminal keyboard. Sentences in a
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -31-
paragraph are executed in sequence. Commands in a paragraph may be complete sentences, or they may be names of stored sentences, names of paragraphs, names of menus, etc. The stored sentence, "LISTPA" displays all paragraph definition records stored in the "VOC" file of the user account.
:LISTPA :ED VOC "name"
New record. ____: I (input) 0001= PA (description) 0002= the text of the stored sentence 0003= another sentence 0004= any valid INFORM statement 0005= Bottom at line 4. ____: FILE
“name” filed in file "VOC".
An example of a stored paragraph:
:ED VOC AWARDS
New record. ____: I (input) 0001= PA 0002= SETPTR 0,,,,,,AT TCPR,NFMT,BRIEF 0003= SELECT STUDMAST WITH SEM-IDX GT '3.50' 0004= LIST STUDMAST BY LAST LAST SEM-IDX MAJOR REQUIRE.SELECT 0005= Bottom at line 4. ____: FILE "AWARDS" filed in file "VOC". The stored paragraph allows you to combine several statements; the system processes them in order until the statement is finished or it encounters an error. The statement can be arranged in any desired order. To begin processing, simply type AWARDS or the name of your stored paragraph. Paragraphs may also be stored using your sentence stack and the .S command.
:.S "name" (start #) (end #)
For example, .S TEST 4 1 Create several stored paragraphs and test them.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -32-
Sentence Examples:
:LIST STUDMAST COUNTY PHONE BIRTHDATE COUNTY.NAME :LIST STUDMAST BY SEX SEX NAME SEX.DESC :LIST STUDMAST BY SEX BREAK.ON SEX TOTAL CNT SEX :LIST STUDMAST BY SEX BREAK.ON "TOTAL FOR... 'O'" SEX TOTAL CNT SEX :LIST STUDMAST WITH SEX = 'F' SEX ENVNAME BY LAST :LIST STUDMAST WITH GRD-LVL < '12' GRD-LVL NAME :LIST STUDMAST WITH GRD-LVL > '12' GRD-LVL SEM-IDX :LIST STUDMAST BY EMP-F/P BREAK.ON EMP-F/P JOB LAST BY SEX BREAK.ON SEX TOTAL CNT SEX PHONE :LIST STUDMAST BY RACE BREAK.ON "TOTAL NUMBER 'O'" RACE.DESC LAST PHONE TOTAL CNT RACE :LIST STUDMAST AVG CUM-IDX NAME AVG SEM-IDX NO.PAGE :LIST STUDMAST MAJOR MAJOR.NAME NAME BY MAJOR ID.SUP :LIST STUDMAST ENVNAME ADD1 CSZ1 ID.SUP HDR.SUP VERT NO.PAGE NO.SPLIT COL.SUP :LIST STUDMAST BY EMP-F/P BREAK.ON EMP-F/P JOB NAME HEADING "LISTING BY JOB CATEGORY 'C' 'LLDG' PAGE 'P'" BY LAST BY SEX
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -33-
Identifying Saved Sentences and Paragraphs
As with saved SELECT lists, you should write down the names of the saved sentences and paragraphs that you create and what they are used for. Remember they are stored in your "VOC" file and can be displayed using the "LISTS" and "LISTPA" commands.
Deleting Stored Sentences and Paragraphs
:ED VOC "name" DELETE
The following message will be displayed: You are about to DELETE the ENTIRE record from the File!
OK(N)?
Press to delete. Pressing your or for the NO delete and the record will not be deleted!
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -34-
SLEEP command
The sleep command allows you to create a stored paragraph that will sleep until a desired time. The system then processes the stored paragraph just as it normally would. This feature is useful if you want to run a stored paragraph after hours. Be careful when using the "SLEEP" command because it may cause confusion for other people who are using the terminals. The terminal cannot be used until after the paragraph wakes up and has finished processing the INFORM statements. Unless you press or Break key, the terminal appears to be locked. You should test the INFORM statement first before using the "SLEEP" command. This keeps you from starting a paragraph at night, only to come in the next morning and find out that there was an error and processing was not as you wished. The "SLEEP" command can be entered in two ways. The first way is to enter the time of day that the paragraph is to start. The time of day should be entered as "hours:minutes:seconds." It is entered in this format:
:SLEEP 14:00
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -35-
The time is entered according to a 24-hour clock. Thus, 2:00 PM would be entered as 14:00. Entering the seconds is optional. The other format is to enter the number of seconds that the paragraph is to sleep. If you want your paragraph to sleep one hour, you should enter it in this format:
:SLEEP 3600
(60 seconds * 60 minutes)
When the paragraph awakens, you can have it process any regular INFORM statements. Again, pressing the Break key can stop the “SLEEP” function. is a sample paragraph with a "SLEEP" command added. Try it!
Below
:ED VOC "name"
New record. ____: I (input) 0001= 0002= 0003= 0004=
0005= 0006= Bottom at line 5. ____: FILE
PA TIME SLEEP 60 TIME BLOCK.TERM
I AWOKE
“name” filed in file "VOC".
Execute your sleep paragraph! How long was the nap?
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -36-
INLINE PROMPTING
In some sentences, paragraphs and phrases, some items can be left unspecified until the time the sentence, paragraph or phrase is invoked. At that time, a prompt defined within the sentence, paragraph or phrase is displayed on the terminal. The data entered in response to the prompt is used as the value needed to complete the sentence, paragraph or phrase.
The basic format for an inline prompt is:
<>
This allows the user to make selections in answer to the prompt!
A more complex prompt with options is:
<<@(CLR),@(20,10),@(BELL),ENTER MATCH VARIABLE>>
Option @(CLR) @(column,row) @(BELL) @(TOF) A Description Clear the screen Print at column (spaces across), row (lines down) Ring the terminal bell Print at the top of the screen Always prompt. If the same prompt occurs more than once, the first input is stored and re-used the next time, unless the "A" option is used. Repeatedly prompt. Prompt until a null, , is entered.
R
For additional information concerning control and check options, refer to your PERFORM manual or access your on-line documentation.
:HELP PROMPTING
Examples:
:LIST STUDMAST WITH CITY SPOKEN 'WINSTON SALEM' CITY <> :.C/ENTER/@(CLR),ENTER :.X :.C/ENTER/@(20,10),ENTER :.X
Include the bell option and execute.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -37-
Stored Sentence Example with Inline Prompt:
:SETPTR 0,80,,,,,AT <<@(CLR),@(20,20),ENTER PRINTER>>,NFMT,BRIEF :.S PRT
This stores the SETPTR command in your VOC, and it can be executed at any time by typing the name you used to store it: PRT
Paragraph Examples
:ED VOC REPORT
New record. ____: I (input)
0001: PA 0002: SELECT STUDMAST WITH MAJOR # '' 0003: LIST STUDMAST BY MAJOR BY RACE BY SEX BREAK.SUP "'BP'" MAJOR.NAME BREAK.ON RACE.DESC BREAK.ON SEX.DESC TOTAL MJR.CTR DET.SUP ID.SUP HEADING "'C'DCC TEST REPORT 'LC'RACE & SEX DATA FOR 'B''LDLL'" 0004: Bottom at line 3. ____: FILE
:ED VOC WAKE.REPORT
New record. ____: I (input)
0001: PA 0002: SETPTR 0,,,,,,NFMT,NHEAD,BRIEF,AT <<@(CLR),@(20,10),@(BELL),ENTER PRINTER NAME>> 0003: LIST STUDMAST BY MAJOR WITH CO/ST = '92' BREAK.SUP "'BP'" MAJOR.NAME CO/ST TOTAL MJR.CTR DET.SUP ID.SUP HEADING "'C' WAKE TECHNICAL COMMUNITY COLLEGE 'LC' WAKE COUNTY RESIDENTS DATA FOR 'B''LDLL'" <<@(5,4),ENTER "LPTR" for hard copy or press “ENTER”>> 0004: Bottom at line 3. ____: FILE
:ED VOC MY.DICT
____:
I
(input)
0001: PA 0002: PRT 0003: LIST DICT GRADES LPTR 0004: BLOCK.TERM GO GET 0005: Bottom at line 4. ____: FILE
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -38-
:ED VOC PASSWORD
New record: ____: I (input)
0001: 0002: 0003: 0004: 0005: 0006: 0007: 0008: 0009: 0010: 0011: 0012: 0013: 0014: Bottom ____:
PA PTERM -HALF SET.TERM.TYPE PROCOMM.WYSE50 CS DISPLAY "*******************************************" IF <<@(CLR),@(15,10),ENTER PASSWORD>> # "WORD" THEN GO XXX DISPLAY "CONGRATULATIONS, YOU MAY WORK NOW!!!" PTERM -FULL GO YYY XXX: DISPLAY "GET OUT - YOU ARE NOT AUTHORIZED!!!" PTERM -FULL LO YYY: DISPLAY "HAVE A NICE DAY!!!" at line 15. FILE
:ED VOC CITIES
New record. ____: I (input)
PA CS DISPLAY THIS PARAGRAPH CREATES A REPORT BY CITIES DISPLAY DISPLAY LOOP IF <> = '' THEN GO DONE: SELECT STUDMAST WITH CITY SPOKEN "<>" AND WITH CITY # '' 0009: DISPLAY 0010: DISPLAY 0011: LIST STUDMAST ENVNAME CSZ1 MAJOR REQUIRE.SELECT ID.SUP 0012: REPEAT 0013: DONE: DISPLAY A L L F I N I S H E D ! 0014: Bottom at line 13. ____: FILE
Select a paragraph example or two and test. Explain your results!
0001: 0002: 0003: 0004: 0005: 0006: 0007: 0008:
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -39-
MENUS
A "MENU" is a list of processes from which a selection may be made for execution by PERFORM. A record kept in a MENU file defines a “MENU”, and it is invoked by specifying the name of the "MENU" pointer record that is kept in the "VOC" file. The "MAKE.MENUS" or "MENUS" command at the colon prompt (:) will invoke the process that enables the user to build a new menu or modify an existing menu.
Building your first "MENU" is a four-step process:
First, create a file for this menu and any others you may create. 1.
:CREATE.FILE XXPA DYNAMIC
Second, invoke the "MENU" process. 2. 1=
:MAKE.MENUS
or
:MENUS
Enter/Modify a menu
Answer the prompts, or make your selection. Name of MENU file= XXPA MENU.NAME=
MXX
TITLE= The Title of your Menu DESCRIPTION= Describe item number 1 on your menu ACTION= Valid INFORM sentence, paragraph or command EXPLANATION= What will be displayed if > entered Change which line item= ( if no changes) CHANGE= At end, until MENU.NAME is displayed again MENU.NAME=
END
to get out of process or until colon (:)
Third, establish your "VOC" pointer to the menu created. 3.
:ED VOC MXX
New record. ____: I 0001: M 0002: XXPA 0003: MXX 0004: ____: FILE
or
5=
Enter/Modify a VOC menu selector SELECTOR NAME= MXX TYPE(M)+DESC= M MENU.FILE= XXPA MENU.ITEM= MXX CHANGE=
Fourth, test or use your menu by invoking it. 4. :MXX If you need to make any changes, redo the process.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -40-
Following is an example menu for you to key, or create your own .
Name of MENU file= MENU.NAME=
XXPA
MXX TITLE= INFORM CLASS MENU DESCRIPTION= Current Date and Time ACTION= TIME
EXPLANATION= DESCRIPTION=
ACTION= EXPLANATION= DESCRIPTION=
My User Number WHO Printer Selection SETPTR 0,,,,,,AT TCPR,NFMT View GRADES Dictionary LIST DICT GRADES Females in A2526E Program LIST STUDMAST NAME MAJOR BY LAST ID.SUP WITH SEX = 'F' AND WITH MAJOR = 'A2526E' GONE TO LUNCH BLOCK.TERM LUNCH TIME
ACTION= EXPLANATION= DESCRIPTION=
ACTION= EXPLANATION= DESCRIPTION= ACTION=
EXPLANATION= DESCRIPTION=
ACTION= EXPLANATION=
Change which line item= ( if no changes) CHANGE= until MENU.NAME is displayed again MENU.NAME=
END
to get out of process or until colon (:)
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -41-
COMO
Have you ever wanted a printed copy of what is on your screen? The "COMO" command allows you to snap a picture of your screen information.
:COMO ON "name"
(Start the camera rolling) Execute your INFORM command(s)! :COMO OFF (Turns the camera off)
:COMO SPOOL "name" (Prints at LPTR unless SETPTR is :COMO DELETE "name" (Deletes the "COMO" file) :COMO LIST (List COMO files, displays action choices) :ED &COMO& “name” (Edit contents of COMO file)
Additional Commands
executed)
:SPOOL -LIST :SPOOL -CANCEL # (will accept several separated by a :USERS :WHO :MESSAGE -# -NOW Type your message :MESSAGE LOGIN -NOW Type your message :PRECISION OFF :BELL OFF :CS :OTD :DTO :DTB
single space)
Executing UNIX commands from Information
:ED VOC !
(should already exist in your account) New record. ____: I 0001: V 0002: 0003: PR 0004: ____: FILE (present working directory) (displays contents of directory)
:! pwd :! ls
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -42-
:CREATE.FILE filename DYNAMIC :BELL OFF :MODIFY DICT filename
FIELD NAME @ID FIRST MIDDLE LAST STREET CITY ZIP SEX B.DATE TYPE LOCATION D 0 D D D D D D D D 1 2 3 4 5 6 7 8 D4/ MD2 BIRTH DATE CONV DISPLAY NAME SSN FORMAT S/M ASSOC 11R###-##-#### 10L 1R 10L 28T 15T 5R 1L 10R S S S M S S S S
MO.SALARY D 9 (3 format choices, pick just 1)
14R2$, S 14*R2$, fill '*' 14'0'R2$, 'zero' MARITAL STATUS 1L 14R2$, S
MAR.STAT YR.SALARY
D I
10
12 * OCONV(MO.SALARY,'MD2')
:LIST DICT filename
This command will display your completed dictionary. If you need to make any corrections, use MODIFY DICT filename and at the prompt FIELD= enter the fieldname you wish to change.
:MODIFY filename
This command is used to input data into the named file. enter > for HELP screens and information. At any prompt, you many
Enter your data using the following as a guide! SSN= 111111111 MIDDLE= 1 character and no period SEX= F for female, M for male BIRTHDATE= 01/01/1950 (29 becomes 2029 without 19) MO.SALARY= 950.70 or 1200 MARITAL STATUS= M for married, S for single
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -43-
:SETFILE
Pathname:
/u1/class/A.INFORM A.INFORM
VOC name:
:COPY FROM A.INFORM TO filename ALL SQUAWK
INFORMATION TYPES
All I-types must have an I in the Type Field (field 2) and the expression to be evaluated in the Location Field (field 3). The expression defines how the value for this I-type should be derived. These expressions follow rules that are very similar to the expression rules of INFO/BASIC. I-type expressions are also called dictionary expressions in INFORMATION. Expressions are composed of elements that get operated on or manipulated in some way, and operators that specify what is to be done to those elements. I-Type Expression Elements Elements fieldnames numeric constants string literals @variable functions (expression) Description Names of I-types in the dictionary Numeric values like 20, 5, 10.3 Must be in quotes ("hello") Internal variables called "@-variables" Any legal INFO/BASIC function, like STR or FIELD, or an INFORM function like TOTAL or TRANS An expression enclosed in parentheses
Arithmetic operators Operator * / + : Meaning Multiplication Division Addition Subtraction Concatenation (to connect or link in a series)
Relational Operators EQ or = NE or # > or GT < or LT =>, >=, or GE =<,<<=, or LE #> #< MATCHES Equal to Not equal to Greater than Less than Greater than or equal to Less than or equal to Not greater than Not less than String value matches pattern
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -44-
CREATING AN I-TYPE
:MODIFY DICT filename
1 FIELD= name of I-type 2 TYPE+EXP= I New record 3 LOCATION= Define the I-type 4 CONV= 5 DISPLAY NAME= 6 FORMAT= #R or #L or #T 7 S/M= 8 ASSOC=
(Examples follow)
Various I-TYPE Examples
CONCATENATION
:
or CAT Format Example: Example: -To connect or link in a series. FIELD:FIELD:FIELD FIRST:' ':MIDDLE:' ':LAST IF MIDDLE = '' THEN FIRST:' ':LAST ELSE FIRST:' ':MIDDLE:'. ':LAST
Transparency: 1 FIELD=
2 New record 3 LOCATION= FIRST:' 4 CONV= 5 DISPLAY NAME= 6 FORMAT= 25L 7 S/M= 8 ASSOC= Example to test:
NAME TYPE+EXP= I
':MIDDLE:'.
':LAST
:LIST filename BY LAST NAME
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -45-
LITERAL STRING
A literal string in I-type expressions must be enclosed in single or double quotes. Literal means a letter or symbol in data that represents itself. Example: Example: Transparency: 1 FIELD= 'Mr. ' CITY:', NC ':ZIP
CSZ NC ':ZIP
2 TYPE+EXP= I New record 3 LOCATION= CITY:', 4 CONV= 5 DISPLAY NAME= 6 FORMAT= 7 S/M= 8 ASSOC=
30L
Example to test:
:LIST filename NAME STREET CSZ VERT ID.SUP COL.HDR.SUPP
EXTRACT
The EXTRACT function extracts data from a specific field. Format Example: -EXTRACT(fieldname,start.pos,value.pos,subvalue)
EXTRACT(STREET,1,1,0)
Returns the first value in the multivalued fieldname STREET. No sub-values.
Example:
EXTRACT(STREET,1,2,0)
Returns the second value in the multivalued fieldname STREET. 0 -- No sub-values.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -46-
NUMERIC CONSTANT
Create an I-type with the fieldname of CNT and for location enter the numeric constant, 1. This is as simple an I-type as you can do, but most useful. When you have finished, try the following INFORM sentence.
:LIST filename BY SEX BREAK.ON SEX TOTAL CNT BY.DSND MO.SALARY TOTAL MO.SALARY NAME
How many times are you asked to count this, count that, how many, etc.? Use the new fieldname "CNT" in another INFORM sentence.
LINE NUMBERING and COMPOUND I-TYPES
For those unfamiliar with compound I-types, they are useful in creating I-types where the result of the I-type is determined by multiple dependent expressions. The format of a compound expression is "expr1;expr2;expr3;...". INFORM evaluates the compound expression from left to right. The final result is the last expression. Each expression is usually dependent on the result of the previous expression. The result of expr1 may be used in expr2. The result of expr2 can be used in expr3 and so on. Each result may be referenced by an "@-variable". In other words, the result expr1 may be referenced by a subsequent expression as "@1". The result of expr2 can be referenced by "@2", etc. The symbol "@" alone may be used to refer to the result of the previous expression. The @-variables may not only be referenced by expressions to obtain a final result for a particular record ID but may also be referenced by subsequent record IDs. There is also a system item counter available called "@NI". Many times it is necessary to produce listings that are used as checklists, rosters or some other type of report requiring that a line number precede each line of data. Through INFORM, this can be done with an I-type like the LINE.CNT and BRK.CNT that follow:
1 FIELD=
2 New record 3 LOCATION= @NI:'.' 4 CONV= 5 DISPLAY NAME= No. 6 FORMAT= 7 S/M= 8 ASSOC=
LINE.CNT TYPE+EXP= I
4R
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -47-
Example to test:
:LIST filename BY LAST BY FIRST LINE.CNT NAME CSZ ID.SUP COL.HDR.SUPP COL.SPCS 2
The same type of numbering can be done to identify each "break" in a report. This will provide not only a "group number", but a way of indicating the number of breaks in a report. Through INFORM this can be done with an I-type called "BRK.CNT" . This dictionary item follows:
1 FIELD=
2 New record 3 LOCATION=
BRK.CNT TYPE+EXP= I CITY;IF @1 = @3 THEN '' ELSE @1; @1; IF @2 THEN @4+1 ELSE @4; IF @1 = @2 THEN @4:'.' ELSE '' No.
4 CONV= 5 DISPLAY NAME= 6 FORMAT= 7 S/M= 8 ASSOC=
4R
'' -- This is a NULL value, represented by two single quotes side by side. The field "CITY" in this example is the field that is used as the break field in the example sentence that follows. Any I-type you create should contain the field that will be used as the break field in any subsequent INFORM sentence you wish to create.
:LIST filename BY CITY BRK.CNT BREAK.ON CITY LAST FIRST ID.SUP COL.SPCS 2 :LIST filename WITH CITY = 'ASHEVILLE' 'RALEIGH' BRK.CNT CITY NAME
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -48-
SUBSTRING EXTRACTION
Substring extraction allows you to extract a substring (part) from a string. In this case, fieldname is the string from which to extract the data. Format --
fieldname[position.expr,length.expr]
position.expr is the position of the first character length.expr is the number of characters to extract
Example: Example:
LAST:', ':FIRST[1,1]:'.' LAST[1,1]:@ID[6,4]
DOWNCASE
DOWNCASE function converts all uppercase letters in an expression to lowercase
letters. Format --
DOWNCASE(expr)
expr is the character string or fieldname you wish to downcase!
Example: Example:
DOWNCASE(LAST)
LAST[1,1]:DOWNCASE(LAST[2,99])
There is also an UPCASE function available!
LEN
The LEN function returns the length of a string (field) or counts the number of characters in a given string. The result returned is numeric. Format Example: Example: --
LEN(expr) LEN(CITY)
LAST[1,1]:DOWNCASE(LAST[2,LEN(LAST)])
These functions may be used in the LOCATION fields of I-types or directly in programming code.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -49-
CONDITIONAL EXPRESSION
Conditional expressions are legal in I-types, such as "IF....THEN...." expressions, or "conditionals." Conditionals are evaluated to true or false, and the action taken depends on the outcome of the evaluation. The reserved keywords IF, THEN and ELSE are used in I-type expressions to create conditional expressions.
Format
--
IF expr1 THEN expr2 ELSE expr3
The expressions expr2 and expr3 represent the possible values which the I-type will be assigned based on the value of expr1. The ELSE clause is required in all INFORM conditionals. Format Example: Example: --
IF expr1 THEN expr2 ELSE IF expr3 THEN expr4 ELSE expr5
IF SEX = 'M' THEN 'Mr. ' ELSE 'Ms. ' IF SEX = 'M' THEN 'MR. ' ELSE IF MAR.STAT = 'S' THEN 'MS. ' ELSE 'MRS. '
CHAR
The CHAR function converts a numeric value to the corresponding ASCII character. Format --
CHAR(numeric.expr)
numeric.expr is an expression evaluating to a number ranging from 0 through 255.
CHAR(253)
CHAR(7) Example: Example:
vm or value mark rings a bell!
treated as a line feed by the LIST processor
LAST:CHAR(7)
NAME:CHAR(253):STREET:CHAR(253):CSZ:CHAR(253)
SUBROUTINE
A cataloged INFO/BASIC subroutine may be called from dictionary expressions with the SUBR function. The term cataloged means that the INFO/BASIC subroutine has been compiled and made available for general use. Data is passed to the subroutine and a value is returned from the result field set by the called subroutine. The subroutine statement identifies an external subroutine and specifies the number and names of arguments to be passed to it. A system wide subroutine is available for your use.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -50-
It is located at: Example:
CC.COMMON/SYSBP/LOWER.CASE.SUBR
SUBR("*CC.COMMON*LOWER.CASE.SUBR",fieldname)
fieldname is what you are sending to the subroutine to be converted. Format --
SUBR(name.expr,arg.expr,arg.expr,...)
name.expr is any expression which evaluates to the name of the subroutine to be called and arg.expr is any expression to be evaluated and passed to the called subroutine.
Example:
SUBR("*CC.COMMON*LOWER.CASE.SUBR","LABEL")
passes LABEL to subroutine named LOWER.CASE.SUBR in CC.COMMON and returns LABEL in upper and lowercase characters.
If you get a B52 Subroutine not catalogued, contact your SA and ask him/her to do the following: LOGTO /path/CC.COMMON :CATALOG SYSBP LOWER.CASE.SUBR Message should come back saying "*CC.COMMON*LOWER.CASE.SUBR" catalogued
SETPTR COMMAND
:SETPTR 0,,,,,,AT TCPR,NFMT,BRIEF
To test: ("0" is numeric zero)
:LIST filename .......... LPTR
You may select options other than the defaults.
:SETPTR 0,80,55,6,5,1,AT XXXX,NFMT
Where: 0 logical print unit 80 column width 55 lines per page 6 top margin 5 bottom margin 1 spool
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -51-
LIST.LABEL and SORT.LABEL INFORM VERBS
You will be prompted for additional parameters. Enter in this form: count, rows, skip, indent, size, space [,C] You must enter these parameters in the same order as listed in the prompt. count rows skip indent is the number of labels across the page is the number of lines printed for each label, generally 6 lpi is the number of blank lines between labels vertically is the number of spaces to indent the data from the left margin, use 0 (zero) or you will be prompted for row headers, use MARGIN! is the number of print positions reserved for each line of each label or width, printing at 10 cpi use 30 for 3 inches per line is the number of spaces to be left between labels, horizontally 0 (zero) for 1-across or no space necessary Specifies that null lines are to be suppressed |<----edge of printing area | | | | +---------MARGIN keyword to leave white space here | | | | |<-----edge of text area | | | | |+----------row header area, "indent" print positions wide | | | | | |<-----edge of first label | | | | | |<---------"count" labels across ---------> | | | | | | +---------"space" print positions | | | | | |rrr|xxxxxxxxxxxxxxxxxx | xxxxxxxxxxxxxxxxxx | |rrr|xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx "rows" lines | |rrr|xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx | | | |rrr|xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx ______ | | |<-----"size"-----> "skip" lines | | | | | |rrr|xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx | |rrr|xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx
size
space
[C]
:LIST.LABEL filename NAME STREET CSZ COL.HDR.SUPP ID.SUP MARGIN #
Example of parameters to use for a 1-across, 3 1/2" X 1" continuous feed:
1,5,1,0,30,0,C
Example of parameters to use for 2-across:
2,5,1,0,30,5,C ________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -52-
DICTIONARY CONVersions
If your data entry has not been flawlessly accurate, you may have data in some files that is in all uppercase and some that is in upper and lowercase. Using the following conversion codes will assure that your reports are uniform or displayed as you wish. The format is:
MC {U or L or T} {} means select one of the available options
Where: Mask Character Code Display Specifies Masking of Character output. Required. Must be followed by option. Converts to all uppercase. Converts to all lowercase. Converts the first character to uppercase and all the rest lowercase.
MC MCU MCL MCT
To use or test, I would suggest creating a new fieldname in the dictionary of your file choice.
:MODIFY DICT filename
1 FIELD= 2 New record 3 LOCATION= (same 4 5 6 7 8 CONV= MCT DISPLAY NAME= FORMAT= #L S/M= ASSOC=
NEW.FIELDNAME TYPE+EXP= D #
as field you want to use)
You may also use I at the TYPE+EXP prompt and then the fieldname or I-type for the LOCATION prompt! If you need to convert a "CSZ" I-descriptor and keep the "STATE" abbreviation in uppercase, a subroutine called LOWER.CASE.SUBR in the file SYSBP in CC.COMMON can be called. This information is covered on page 50.
:LIST.RECORD filename BY B.DATE
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -53-
OCONV
The OCONV function converts a string from an internal storage format to an external output format. Format --
OCONV(fieldname,conversion.code.expr)
conversion.code.expr is an expression evaluating to a conversion code that specifies the method of conversion.
Codes External D 27 MAY 1985 D2 27 MAY 85 D2/ 09/09/90 D4/ 05/27/1985 D209-09-90 MD2 10000.75 With Format 10R2$, $10,000.75 Example: Example:
Internal 6357 6357 8288 6357 8288 1000075
1000075
12 * OCONV(MO.SALARY,'MD2') OCONV(B.DATE,'D4/')[1,5]
ARITHMETIC OPERATOR
Specifies the arithmetic operation to be carried out on the two operands they separate. Example:
YR.SALARY * .10
result is 10% raise based on yearly salary
Example:
YR.SALARY * 1.10
new yearly salary after 10% raise
How would you compute weekly salary?
ICONV
The ICONV function converts a string to an internal storage format. select any valid conversion code. Format Example: Example: -You may
ICONV(fieldname,conversion.code.expr)
ICONV(B.DATE,"D4/") ICONV(MO.SALARY,"MD2")
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -54-
DATE()
The DATE function returns the current date in internal format. Format Example: --
DATE()
IF B.DATE # '' THEN ((DATE() - B.DATE)/365.25) ELSE ''
Note :
'' represents a null value and are 2 single quotes side by side
STR
The STR function returns a string comprising a specified string repeated a specified number of times. Format --
STR(string.expr,numeric.expr)
string.expr evaluates to a string numeric.expr evaluates to the required number of repetitions of the string.
Example: Example: Example:
STR('$',OCONV(MO.SALARY,'MD2')/300) STR('$',(YR.SALARY)/1000) STR('+',LEN(LAST))
Who has the longest last name?
This can be used for graphic representation of data. Use the 'BY' and or 'BY.DSND' keywords in an INFORM sentence that also includes your new I-type.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -55-
:CREATE.FILE TESTS DYNAMIC :MODIFY DICT TESTS
FIELD NAME.... TYPE LOCATION....... CONV. DISPLAY NAME... FORMAT SM ASSOC..... @ID D 0 SSN 11R###-##-#### C.TESTS EXAM D D 1 2 3R 3R M S
_____________________________________________________________________________ NUM.TESTS I COUNT(C.TESTS,@VM)+1 2R TEST.AVG I SUM(C.TESTS)/(COUNT(C.TESTS,@VM)+1) or SUM(C.TESTS)/NUM.TESTS .75 * TEST.AVG + .25 * EXAM EXTRACT(C.TESTS,1,2,0) IF EXAM LT 60 THEN 'FAILED' ELSE STR('!',EXAM/5) IF FINAL.AVG < 70 ELSE IF FINAL.AVG ELSE IF FINAL.AVG ELSE IF FINAL.AVG ELSE 'A' THEN < 77 < 85 < 93 'F' THEN 'D' THEN 'C' THEN 'B' 6R2 6R2 6R2 3R 25L
FINAL.AVG TEST2 HIST
I I I
LET.GRADE
I
1R
FIRST LAST
I I
TRANS(filename,@ID,FIRST,'X') TRANS(filename,@ID,LAST,'X')
10L 10L
:MODIFY TESTS
Enter data using the following as a guide! SSN= 111111111 EXAM= 95 TESTS= 80 92 60
Note :
You are always prompted for all single valued fields first, then prompted for the multivalued fields.
:LIST.RECORD TESTS
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -56-
COUNT
The COUNT function returns the number of occurrences of a substring within a string. In the following example, you are counting the value marks separating the data in the multivalued field "C.TESTS". Format Example: -COUNT(fieldname,@VM) (counts all occurrences)
COUNT(C.TESTS,@VM) + 1
SUM
The SUM function totals the value of the field specified. Format Example: -SUM(fieldname)
SUM(C.TESTS)
ENUM
The ENUM Keyword counts the number of instances that a specified field value occurs in a set of records. A null value is included in the total unless you add the NO.NULLS option to the command. Format --
ENUM fieldname [NO.NULLS]
If the field has a default column header, ENUM is added to the front of it. The total number of values is displayed at the foot of the column when the fields are listed. Example: Example: Example:
LIST TESTS ENUM EXAM LIST TESTS ENUM EXAM NO.NULLS LIST TESTS ENUM EXAM WITH EXAM GT '80'
A total of the fields meeting this condition is then displayed at the bottom of the list.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -57-
TRANSLATE
The INFORM TRANS function allows you to extract information from other data files. This makes it possible to fetch field values, or entire records from some other data file and use them in evaluating some I-type expression in the current file. In order to do this, you must supply TRANS with the name of the file from which you want to extract the information. Think of this file as the "translate" file. You must also supply either the name of a field in the current file that contains the same values as the record @ID in the translate file, or supply an @ID expression which will produce values equivalent to the record @ID values of the translate file. Then you must specify the name or number of the field which you want retrieved from the translate file, or, an expression which involves a fieldname or number from the translate file. The entire record can also be extracted if desired, using a special @-variable called @RECORD. The results of the translation process are monitored with a special control code feature, which tells TRANS what to do in case of an unsuccessful translation. Format Format ---
TRANS(filename,@ID,fieldname,code.expr) TRANS(filename,@id.expr,fieldname,code.expr)
code.expr = "X" means TRANSlate if possible, otherwise set result to NULL. "C" means TRANSlate if possible, otherwise return the @ID.
Example:
TRANS(filename,@ID,LAST,"X")
How would you retrieve the person's first name?
Working in the dictionary of the file you created, how would you retrieve the person's exam score? See Page 59 for translates from the DICT of the TESTS file to the dictionary of the file you created.
Note :
Unfortunately, I-types cannot be retrieved using a "TRANS", as they are never stored as data. I-types are evaluated at the time of an INFORM sentence execution. You may retrieve each data field from another file and then create an I-type in the file dictionary you want to use it in. Try it?
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -58-
INFORM DICTIONARY DEFINITION MODIFY 15:00:47 21 AUG 1999 1 FIELD C.TESTS 2 TYPE I 3 LOC TRANS(TESTS,@ID,C.TESTS,'X') 4 CONV 5 NAME 6 FORMAT 3R 7 S/M M 8 ASSOC INFORM DICTIONARY DEFINITION MODIFY 15:01:09 21 AUG 1999 1 FIELD EXAM 2 TYPE I 3 LOC TRANS(TESTS,@ID,EXAM,'X') 4 CONV 5 NAME 6 FORMAT 3R 7 S/M 8 ASSOC INFORM DICTIONARY DEFINITION MODIFY 15:01:26 21 AUG 1999 1 FIELD TEST.AVG 2 TYPE I 3 LOC SUM(C.TESTS)/(COUNT(C.TESTS,@VM)+1) 4 CONV 5 NAME 6 FORMAT 7 S/M 8 ASSOC INFORM DICTIONARY DEFINITION MODIFY 15:01:44 21 AUG 1999 1 FIELD FINAL.AVG 2 TYPE I 3 LOC .75 * TEST.AVG + .25 * EXAM 4 CONV 5 NAME 6 FORMAT 7 S/M 8 ASSOC INFORM DICTIONARY DEFINITION MODIFY 15:02:01 21 AUG 1999 1 FIELD LET.GRADE 2 TYPE I 3 LOC SUBR("*TCMASTER*LETTER",FINAL.AVG) 4 CONV 5 NAME 6 FORMAT 7 S/M 8 ASSOC
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -59-
CASE
The CASE statement evaluates one or more test expressions to select among several alternative statement sequences. The general format is:
BEGIN CASE CASE expr
statements
CASE expr
statements ... ...
END CASE
Statements may be formatted on the same line as the CASE expression by inserting a semi-colon (;) between the expression and the statement:
CASE expr; statements(s)
When BEGIN CASE is encountered, the first CASE expression is evaluated to determine if its logical value is true (non-zero) or false (zero). If the first expression is true, the statements(s) following the expression are executed; then program control proceeds past END CASE to the next sequential statement. If the first expression is false, program control proceeds to the second CASE specified. The second CASE expression is then evaluated as true or false. Either the second CASE statements are executed or program control proceeds to the third CASE specified; and so on through all the specified CASE expressions. If the last CASE expression is evaluated as false program control proceeds past END CASE without performing any statements. Note that once a CASE expression is evaluated as true and the specified statements are executed for that CASE, no subsequent CASES are evaluated. The expression "1" may be designated as the CASE expression to specify unconditional execution of the statements for a CASE; when used with CASE, 1 (one) means "always true." See example below.
:ED SYSBP LETTER
SUBROUTINE LETTER(LET.GRADE,FINAL.AVG) BEGIN CASE CASE FINAL.AVG GE 93 LET.GRADE = 'A' CASE FINAL.AVG GE 85 LET.GRADE = 'B' CASE FINAL.AVG GE 77 LET.GRADE = 'C' CASE FINAL.AVG GE 70 LET.GRADE = 'D' CASE 1 LET.GRADE = 'F' END CASE RETURN END
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -60-
DISPLAY.LIKE
The DISPLAY.LIKE Keyword is used to set the display attributes of a field or expression to be the same as those of another field. The display attributes of a field are its Conversion, Display Name, Format, Single or Multiple Value Indicator, and Association. The Keyword must follow the field or expression to which it applies. It must be followed by a field whose name either exists in the file's dictionary, or is defined earlier in the current INFORM sentence by means of the AS Keyword. Any of the Keywords CONV, COL.HDG, FMT, SINGLE.VALUE, MULTI.VALUE, ASSOC, and ASSOC.WITH can be used to override the display attributes set by means of DISPLAY.LIKE. DISPLAY.LIKE is processed before any other qualifiers. Example:
LIST filename STREET DISPLAY.LIKE CSZ
FMT
The FMT Keyword is used to define the format for a field or expression. The Keyword must follow the field or expression to which it applies. It must be followed by a string between single or double quotation marks (') or ("), giving the format to be used. This format overrides the format specified in the file's dictionary. If the format string is null or invalid, then the INFORM default of 10L is applied, whether or not there is a corresponding format entry in the dictionary. If this happens, a warning message is generated. If the FMT qualifier is used with a sort clause, then the sort is performed according to the new format of the field as defined by the qualifier. If you change the field justification, for example, this may affect the result of the sort. Example: Example:
LIST filename STREET FMT '22R' LIST filename MO.SALARY FMT '14*R2$,'
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -61-
I-types 'On the Fly'
Keyword COL.HDG Description Defines a column heading (that is, a display name) for a field or expression. Overrides any conversion that may be specified in a file's dictionary. Sets display attributes to be the same as the named field. Enables an INFORM sentence to use an expression that is defined within the sentence. The expression is defined as a temporary I-type field and it uses the same expression syntax, operators, and functions as are used for I-type expressions. Defines the format for a field or expression.
CONV
DISPLAY.LIKE EVAL or EVALUATE
FMT
Example:
LIST filename EVAL "LAST:', ':FIRST[1,1]:'.'" COL.HDG "NAME" CONV "MCT" FMT "22L".................
I-types to be evaluated must be within double quote marks. Inside the double quotes must be a valid I-type expression.
Column Heading to use must be inside double quote marks following the keyword:
COL.HDG
Optional Conversion must be inside double quote marks following the keyword:
CONV
Valid Format must be inside double quote marks following the keyword: FMT Not using a Format results in default of 10 characters.
Example:
LIST filename EVAL "IF B.DATE # '' THEN ((DATE() B.DATE) / 365.25) ELSE ''" COL.HDG "AGE" FMT "6R2" .................
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -62-
:LIST DICT filename
FIELD NAME.... TYPE LOCATION....... CONV. DISPLAY NAME... FORMAT @ID D 0 SSN 11R### -##-## ## FIRST D 1 10L MIDDLE D 2 1R LAST D 3 10L STREET D 4 28T CITY D 5 15T ZIP D 6 5R SEX D 7 1L B.DATE D 8 D4/ BIRTHDATE 10R MO.SALARY D 9 MD2 14R2$, MAR.STAT D 10 MARITAL STATUS 1L NAME I FIRST:' ':MIDDLE:'. ':LAST 25L LASTF I LAST:', ':FIRST[1,1]:'.' 15L TITLE I IF SEX = 'M' THEN 'MR. ' ELSE IF 5L MAR.STAT = 'S' THEN 'MS. ' ELSE 'MRS. ' FOR.NAME I TITLE:NAME 20L CODE I LAST[1,1]:@ID[6,4] 5L CSZ I CITY:', NC ':ZIP 30L LABEL I CHAR(253):FOR.NAME:CHAR(253): 25L STREET:CHAR(253):CSZ:CHAR(253) CNT I 1 3R CNT.SEX I COUNT(SEX,CHAR(253)) + 1 3R STREET1 I EXTRACT(STREET,1,1,0) 25L STREET2 I EXTRACT(STREET,1,2,0) 25L YR.SALARY I 12 * OCONV(MO.SALARY,'MD2') 14R2$, WK.SALARY.MO I OCONV(MO.SALARY,'MD2') / 4.33 12R2$, WK.SALARY I YR.SALARY / 52 12R2$, AGE.1 I OCONV(@DATE,'D4/')[7,4] 3R OCONV(B.DATE,'D4/')[7,4] AGE.2 I IF B.DATE = '' THEN '' ELSE IF 3R @MONTH < OCONV(B.DATE,'D4/')[1,2] THEN AGE - 1 ELSE AGE AGE I IF B.DATE # '' THEN ((DATE() - B.DATE) / 365.25) ELSE '' 5R2 BAR.GRAPH I STR('$',OCONV(MO.SALARY, 'MD2') 30L / 100) LABEL.NAME I SUBR("*CC.COMMON*LOWER.CASE.SUBR",LABEL) RAISE.5 I YR.SALARY * .05 MD2 10R2, RAISE.10 I YR.SALARY * .10 MD2 10R2, TOT.RAISE.5 I YR.SALARY * 1.05 MD0 14R2$, @MODIFY PH @ID FIRST MIDDLE LAST STREET CITY ZIP SEX B.DATE MO.SALARY MAR.STAT SM ASSOC... S
S S S M S S S S S S
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -63-
PARAGRAPH TO GENERATE LABELS USING 'LIST.LABEL' COMMAND
(Generates labels 1-across, 3-1/2" x 1", continuous feed) The following paragraph allows the Financial Aid person to print labels for her GSL Students for a particular enrollment term using the new LIST.LABEL command available at INFORMATION 8.1.2. The file called "GSL.STUDENTS" is an information file with the student SSN as the record id where GSL student information is input (using MODIFY) such as loan dates, grade level, contact names and addresses. -----------------------------------------------------------------------PA CS SETPTR 0,,,,,,AT XXXX,NHEAD,BRIEF,NFMT DISPLAY LABEL PRINT DISPLAY DISPLAY (Your labels will print at the Student Services Label Printer.) DISPLAY DISPLAY DISPLAY ENTER THE ENROLLMENT TERM (YY/MM) FOR THE DISPLAY SELECTION TO START FROM OR TO QUIT DISPLAY IF <> = '' THEN GO FINISH DISPLAY Selecting records, please wait... SELECT GSL.STUDENTS BY STUD.NAME WITH PROG.SEM => "<>" LIST.LABEL GSL.STUDENTS PRINT.NAME STUD.ADDRESS STUD.CSZ COL.HDR.SUPP ID.SUP REQUIRE.SELECT LPTR DATA 1,5,1,1,30,0,C DATA DATA DATA DATA DATA FINISH: SETPTR 0,,,,,,BRIEF,AT LPTR,NFMT Compliments of Jeannie Castano, System Administrator, Craven CC, now Financial Services Systems Accountant at Fayetteville TCC. For additional information:
:HELP LIST.LABEL
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Page -64-
APPENDIX
Page
Editor Commands
ii
SELECT Editor Commands
Prestored Editor Commands
iii
iv
Associated Multivalued Fields Example
vi
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Appendix -i-
Editor Commands
CHANGE -- The CHANGE command allows you to replace a string in a line with
another string. This can be a replacement of just the first occurrence of the string or all occurrences. The format of the change command is:
C/old.str/new.str/# C/old.str/new.str/G#
(Changes first occurrence of old.str to new.str in indicated number of lines of current record.) (Changes all occurrences of old.str to new.str in current line. If a number is supplied, the change is made globally throughout this number of lines. the slash (/). Other delimiter characters such also be used as separators. # is the number of The default is one, in which case only the option indicates a global change, which means should be changed in a line, and not just the
The delimiter character used is as the (!), (-), (.) or (|) can lines to change in the record. current line is changed. The G every occurrence of some string first occurrence.
DELETE -- The commands that delete lines from records and delete entire
records are:
D or DE (deletes the line just above when you type it in). D# (delete that number of lines at one time). FD or DELETE (deletes an entire record). FILE -- The FILE command saves the contents of the record currently being
edited. After the record is filed, the Editor then goes on to the next record specified in a select list (if one is active), to the next record specified on the ED COMMAND line (if more than one was specified), or it returns you to PERFORM command level. The format of this command is:
FILE (filename) (record.name) FI
The default format of the command writes the record to the file using the original record identified (record.name) when the Editor was invoked.
INPUT -- The INPUT or INSERT command allows you to add lines to a record.
The format of the command is:
I (line)
If the default form is used, the EDitor goes into input mode and accepts successive lines of input until a null line is entered (or ).
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Appendix -ii-
LOCATE --The LOCATE command looks for the next line in the record that
contains a given string. The form of this command is:
L (string)
When string is supplied, the record will be scanned for the next line after the current line that contains string. If string is omitted, the last full Locate command will be executed. If no such command has been entered, the current line position is advanced by one position (to the next line.)
OOPS -- The OOPS command will restore the record to the condition prior to the
last change command executed. Change commands include any commands that alter the contents of the record. The OOPS command has the following format:
OOPS PRINT -- The PRINT command is a synonym for the LIST command.
The P command is preferred by most users because it does not require a numeric argument, and defaults to printing 23 lines the first time it is used. The format is:
P# REPLACE -- The REPLACE command replaces the current line with some other
string. The format of this command is:
R (new.string)
With the new.string argument, the current line is replaced with new.string. Without an argument, the previous Replace command is repeated.
SELECT Editor Commands
Within the Editor to look at all records:
SELECT filename ED filename
N X P# T L# G# I
Takes you to the next record. Returns you to the : or exits. Print the indicated number of lines on the screen. Takes you to the top. Lists the indicated number of lines Go to the indicated line number, whether it is before or after your present location. Input.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Appendix -iii-
Prestored Editor Commands
The list of commands needed to store, retrieve, and execute pre-stored command strings are: .D (filename) rec.name .L (filename) rec.name .L (filename) * .R (filename) rec.name .S# (filename) rec.name Deletes rec.name from filename Lists contents of rec.name in filename Lists all record ID's in filename Recalls contents of rec.name in filename Saves lines # through 01 to rec.name in filename. Stack commands go from 01 to the number of the line specified. Executes pre-stored commands in rec.name.
.X (filename) rec.name
XEQ --
The XEQ command allows you to execute any legal PERFORM command from within the Editor environment. When execution of this command is completed, control is returned to the Editor. The format of this command is:
XEQ perform.command
The XEQ command uses a number of variables to enhance its usefulness and allows you to: edit more than one record at a time, edit records in a file other than the current one, change a record, unload it and copy it to another file without leaving the Editor. Using XEQ you can edit, compile, and execute an INFO/BASIC program without leaving the Editor environment.
An Example using a Pre-Stored Command:
1. 2. LOGTO the appropriate module and at the colon prompt: Select Filename Condition statement, for example:
SELECT GRADES WITH CODE = A2526E
3. Save the selected list and give it a name.
SAVE.LIST INFSYS
4. Call the selected records on which the change is to be made.
GET.LIST INFSYS
5. Create an edit command to modify the selected records.
ED GRADES 5 (This is the location C/A2526E/A10100/
of the field to be changed)
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Appendix -iv-
6.
Create a name for the 'change' portion of the edit and save it.
.S2 CHNGT
_____Saved "CHNGT" in file "&ED&". 7. Edit the nested edit change. ____: XEQ ED &ED& CHNGT
P
0001: 0002: 0003: ____: 0004: 0005:
(To display the nested edit) E... 5 C/A2526E/A10100/ Bottom at line 3. I (input)
0006: 0007: Bottom at line 6. ____: FILE ____"CHNGT" filed in ------------------returned 8.
FILE< .X CHNGT FILE
(To file the first changed GRADES record)
(To file the amended nested edit procedure)
(To file all changed records) file "&ED&". to the EDITOR.
Run the change program for the remaining records in the file via ____:.X CHNGT The process will cycle until there are no more record ID's in the SELECT list. File name = GRADES Record name = (To exit the editor).
9.
The same process can be used to return the selected records to their original condition as follows: A. Change line 3 of the nested edit change by calling :ED &ED& CHNGT enter the change and file it. B. GET.LIST INFSYS
ED GRADES D. .X CHNGT
C. E. F. (To exit the editor). DELETE.LIST INFSYS (To clear the select list when finished)
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Appendix -v-
Associated Multivalued Fields Example
There are times when you need to list data from multivalued fields based on the values in different fields. For example, you want a list of English classes that have an audit grade. This list can be created from the REG-HOLD file. However, the audit grade is in the GRD field and the notation of an English class is in the DEPT field. The question is how to create this list using the values in two different fields. The first thing you must do is establish an association of the multivalued fields. There are two steps to forming an association. The first step is to enter the name of the association in the ASSOCIATION field of each dictionary record you want to associate. This can be done by using the MODIFY process. Once you have entered the association name in each dictionary record, the association name must be entered as a Phrase record in the dictionary of the file. The association name needs to be a field name in the file dictionary. Enter PH in the TYPE field of the dictionary record. Enter each field in the association on the LOCATION line of the dictionary record. Leave all other fields of the dictionary record blank. Once the association is established, you can list the data based on values in two or more different fields. The key to breaking out this data is using the BY.EXP keyword with the WHEN keyword. When you want to list information you must use the BY.EXP with one field in the association. The BY.EXP will break down all of the associated values into sets and the WHEN keyword will select based on the values in each set. This is the reason why both the BY.EXP and the WHEN keywords must be used. To try this, establish an association between all of the fields in the REG-HOLD that you want to display. If you display a multivalued field that is not a part of the association, it will list every value in the unassociated multivalued field. The following are fields to associate.
RGHLD.DEPT RGHLD.CAT RGHLD.SECT RGHLD.GRD
The field that contains the department code of the course. The catalog number of the course. The section number of the course. The grade the student was given in the course. Please remember the grade is only posted to the REG-HOLD and ROSTER file if the grade was entered as a MID-TERM grade. The ADD.DROP status codes of 'R', 'A', 'D' or 'X'. The date of the ADD.DROP status.
RGHLD.ADD.DROP RGHLD.A.D.DATE
Establish the association by entering an association name in the ASSOC field of the dictionary record for each of the fields listed above. For this example, use the association name of COURSE.GRADE. Next, establish the COURSE.GRADE field in the dictionary of the REG-HOLD file. To enter the new dictionary field, follow the example. The REG-HOLD file is not currently available on the Ultra UNIX training machine. REG-HOLD can be found in the CC.RG account on your system.
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Appendix -vi-
:MODIFY DICT REG-HOLD
1 FIELD= 2 New record 3 LOCATION= 4 5 6 7 8
COURSE.GRADE TYPE+EXP= PH
RGHLD.DEPT RGHLD.CAT RGHLD.SECT RGHLD.GRD RGHLD.ADD.DROP RGHLD.A.D.DATE
CONV= DISPLAY NAME= FORMAT= S/M= ASSOC=
If you do not enter each field you want to associate in LOCATION, the multivalued fields will not associate correctly. Now you are ready to list data based on the values in associated multivalued fields. Following are example INFORM sentences:
:LIST REG-HOLD COURSE.GRADE :LIST REG-HOLD RGHLD.DEPT RGHLD.CAT RGHLD.SECT RGHLD.GRD BY.EXP RGHLD.GRD WHEN RGHLD.GRD EQ "AU" AND WHEN RGHLD.DEPT EQ "ENG"
This INFORM sentence will list the department code, catalog number, section number and grade of each class with a grade of "AU" and department code of "ENG". The "AU" is the audit grade and "ENG" is the department code for English classes. The grade code and department code may be different at your college. LIST REG-HOLD RGHLD.DEPT RGHLD.CAT RGHLD.SECT RGHLD.GRD BY.EXP RGHLD.GRD WHEN RGHLD.GRD EQ "AU" AND WHEN RGHLD.DEPT EQ "ENG" 17:00:04 08-21-99 PAGE 1 REG.HOLD........ Prefix Cat Num Sect Grade 1991*11121212121 1998*01262109999 2 records listed. Now let's look at each part of the association used in the sentence. The DEPT CAT SECT GRD tells the sentence what fields to display. Keep in mind that if an unassociated field is displayed then every value in the unassociated field will be displayed. For example, if you used CAT-NO instead of CAT then every catalog number would have displayed. The BY.EXP on the GRD field breaks the associated values into sets and each set is displayed based on the selection of the WHEN keywords. Now you could have used any field in the association with the BY.EXP but you must use one of the associated multivalued fields. ENG ENG 98 111A 01 1A AU AU
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Appendix -vii-
There is one problem with the first sentence. The first sentence will list every English course on the REG-HOLD file. If you are interested in only the English courses from the current term, you will need to add another selection criteria to the sentence.
:SELECT REG-HOLD WITH SEM EQ '1998*01' :LIST REG-HOLD RGHLD.DEPT RGHLD.CAT RGHLD.SECT RGHLD.GRD BY.EXP RGHLD.GRD WHEN RGHLD.GRD EQ "AU" AND WHEN RGHLD.DEPT EQ "ENG"
These sentences list only the English classes that have audit grades and were registered for "1998*01". Notice that the WITH keyword is used with the SEM field. Because the SEM field is a single value field, you cannot use the WHEN keyword. LIST REG-HOLD RGHLD.DEPT RGHLD.CAT RGHLD.SECT RGHLD.GRD BY.EXP RGHLD.GRD WHEN RGHLD.GRD EQ "AU" AND WHEN RGHLD.DEPT EQ "ENG" 17:13:45 08-21-99 PAGE 1 REG.HOLD........ Prefix Cat Num Sect Grade 1998*01262109999 One record listed. There are several files with associated multivalued fields and this process can be used with each of them. The key is to establish the association and use the BY.EXP keyword with the WHEN keyword when you want to select data based on the values in different associated multivalued fields. ENG 111A 1A AU
________________________________________________________________________________ North Carolina Community College System Advanced INFORM Notes Appendix -viii-