|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 240128 (0x3aa00) Types: TextFile Names: »D28«
└─⟦4233bed4d⟧ Bits:30005867/disk04.imd Dokumenter (RCSL m.m.) └─⟦this⟧ »D28«
\f DATA ENTRY RELEASE 2 FORMAT LANGUAGE GUIDE First Edition A/S REGNECENTRALEN June 1978 Information Department RCSL 42 - i 0664\f F_ Authors: Aino Andersen, Lis Clement, Peter Jørgensen, Bodil Larsen Text Editor: Peter Jørgensen KEY WORDS: MUS, Data Entry System, batch translation, format language, definitions, coding sheets, execution, examples. ABSTRACT: This manual contains a description of the format language, and instructions on the writing, translation and execution of format programs. Users of Copyright A/S Regnecentralen, 1978 Printed by A/S Regnecentralen, Copenhagen\f TABLE OF CONTENTS 0 INTRODUCTION 1 DEFINITIONS 1.1 Definition of Batch - Record - Field 1.1.1 Batch 1.1.2 Record 1.1.3 Field 1.2 Definition of Format, Subformat, and Field Description 1.2.1 Format 1.2.2 Subformat 1.2.3 Field Description 1.2.4 Field Definition - Field Program 1.3 Definition of Subprogram - Table 1.3.1 Subprogram 1.3.2 Table 1.3.3 Argument - Function 1.4 Definition of Register 1.5 Definition of Fill-In-the Blanks and Format Image 1.5.1 Fill-In-the-Blanks 1.5.2 Format Image - Subformat Image 1.5.3 Image Page - Fill-In-the-Blanks Mask 2 FORMAT - IMAGE -SUBPROGRAM - TABLE CODING SHEETS 2.1 Format Coding Sheet and Image Coding Sheet 2.1.1 Format Coding Sheet 2.1.1.1 Subformat Head 2.1.1.2 Field Description 2.1.2 Image Coding Sheet 2.1.2.1 Subformat Head 2.1.2.2 Tag Desciption 2.2 Subprogram Coding Sheet 2.2.1 Subprogram Head 2.2.2 Subprogram Part 2.3 Table Coding Sheets 2.3.1 Single Entry Table Coding Sheets 2.3.1.1 Table Hed With Argument Description 2.3.1.2 Argument Part 2.3.2 Double Entry Table Coding Sheet 2.3.2.1 Table Head With Argument Description and Function Description 2.3.2.2 Argument and Function \f 2.3.3 Disctable Coding Sheet 2.3.3.1 Table Head with Argument Description and Function Description 2.3.3.2 Argument and Function Part 3 THE FORMAT LANGUAGE 3.1 On Programming 3.1.1 What Is a Program? 3.1.2 The Elements of a Program 3.1.3 The Elements of the Format Language 3.1.4 Example In the Format Language 3.2 Character Set 3.2.1 Names 3.2.2 Arithmetic Operators 3.2.3 Relational Operators 3.2.4 Logical Operators 3.2.5 Punctuation Symbols 3.3 Operands 3.3.1 Constants 3.3.2 Registers 3.3.3 Fields 3.3.4 Subscripts 3.4 Notation 3.5 Arithmetic Expressions 3.6 Conditions 3.6.1 Relation 3.6.1.1 Comparison of Numeric Operands 3.6.1.2 Comparison of Nonnumeric Operands 3.6.2 Table Condition 3.6.3 Validity Condition 3.6.4 Compound Conditions 3.7 Format Language Statements 3.7.1 Unconditional Statements 3.7.1.1 ALARM Statement 3.7.1.2 ALLOW and DISALLOW Statements 3.7.1.3 COMPUTE Statement 3.7.1.4 CONNECT Statement 3.7.1.5 DEFINE Statement 3.7.1.6 DISPLAY Statement 3.7.1.7 DUP Statement 3.7.1.8 END Statement 3.7.1.9 END SUBFORMAT Statement 3.7.1.10 GOTO Statement 3.7.1.11 LIMIT Statement 3.7.1.12 MOVE Statement \f 3.7.1.13 NOTE Statement 3.7.1.14 PERFORM Statement 3.7.1.15 SEARCH Statement 3.7.1.16 SELECT Statement 3.7.1.17 SET Statement 3.7.1.18 SKIP Statement 3.7.2 Conditional Statements 3.7.2.1 IF Statement 3.8 Subprograms 3.8.1 Statements In Subprograms 3.8.2 Operands In Subprograms 4 EXECUTION OF FORMAT PROGRAMS 4.1. Selecting Subformat 4.2 Terminating a Format Program 4.3 Execution of Subformats 4.4 Execution of a Field Description 4.4.1 Keyed Fields 4.4.2 Automatic Fields 4.4.2.1 Duplicate Fields 4.4.2.2 Constant Fields 4.4.2.3 Increment Fields 4.4.3 Not Keyed Fields 4.4.4 Fields Skipped By SKIP 4.4.5 Fields Skipped By ENTER 4.4.6 Fields Skipped By RECORD RELEASE 4.4.6.1 Fields With Kind KEYED, DUPLICATE, CONSTANT, INCREMENT 4.4.6.2 Fields With Kind NOT KEYED 4.4.7 Fields Skipped By BYPASS 4.4.8 Execution of a Field Program 4.5 Field Flags 4.5.1 Validity Flag 4.5.2 Skipped Flag 4.5.3 Flags For REKEY 4.5.4 Flags For EDIT 4.6 Registers 4.7 Replay 4.8 Execution of IMAGE 5 ENTERING NEW FORMATS, SUBPROGRAMS, AND TABLES 5.1 New Formats 5.2 New Subprograms 5.3 New Tables 5.3.1 New Core Tables \f 5.3.2 Disc Tables 6 PROGRAMMING HINTS 6.1 Screen Processing 6.1.1.ScreenProcessing Assigned To the System 6.1.2 Establishing Keying Position 6.1.3 Defining Tags 6.2 Reformatting 6.3Automatic Insertion 6.3.1 Not Keyed Fields 6.3.2 Constant Fields 6.4 Automatic Duplication 6.5 Automatic Incrementation 6.6 The Use of Tables 6.7 Partial Rekeying 6.8 The use of Pseudo Registers APPENDIX 1 Required Space In Core For Formats, Subprograms and Tables APPENDIX 11 Required Space On Disc For Batches APPENDIX 111 Examples APPENDIX 1V Standard Formats FORM, IMAGE, SUBPR, and TABLE APPENDIX V Format Language Syntax APPENDIX V1 Limitations APPENDIX V11 Messages from TRANSLATE APPENDIX V111 Definitions of Terms APPENDIX 1X Index\f F_o_r_e_w_o_r_d_ The main differences between the present second edition and the first edition of RC 3600 Date Entry Release 2 Format Language Guide (September 1976) are due to the extension of the RC 3600 Data Entry System with - multiple - entried tables (disc tables) - subscript - intervals and conversion operators - pseudo - registers - infinite number of formats, subprograms and tables. In order to handle multiple - entried tables the standard format TABLE has been changed and a new coding sheet (disc table coding sheet) has been introduced. It is now possible to give between 0 and 6 functions to one argument, so the syntax of the SEARCH - statement has been changed (variable number of destinations, and one or more destination(s) may be dummy). To permit reference to groups of characters within fields or re- gisters subscript - intervals and conversion operators (ALPHA- NUMERIC, NUMERIC) have been introduced. The system has been extended with a number of pseudo-registers containing run - time information, such as batchname, data and time. Some instructions concerning (user defined) registers have been made in order to leave fill characters and justifications un- touched. a. automatic field (i.e. kind D, C or 1) must have exactly the same length as the corresponding register. b. after execution of an eventual field program connected to a D-field or an 1-field the field contents will be copied into the register. c. 1-fields must be of numeric type (N). Beside this (user-defined) registers with a negativ value will be in embedded trailing representation (as for SS-fields).\f In section 3.7.1.7 DUP-statement is described even if it is not implemented yet. The statement is used to simulate activation of the DUP control key. Finally the TRANSLATE program has been changed in order to inform about the size of a translated item (i.e. format, image, sub- program and table).\f HOW TO USE THIS GUIDE The purpose of this manual is to enable the programmer to acquire a reliable working knowledge of the Format Language. It is be- lieved that a careful study of the six chapters and the append- ices will equip him with all the insight required to write and successfully operate Data Entry format programs. The subjects dealt with in the various chapters and sections are listed in the Table of Contents. For the novice, especially, the following order of study is considered preferable: 0 Introduction 3 The Format Language 1 Definitions 2 Format - Image - Subprogram - Table Coding Sheets 4 Execution of Format Programs 5 Entering New Formats, Subprograms, and Tables 6 Programming Hints Appendices 1 - V11 Appendix V111 Definitions of Terms and IX Index should be con- sulted any time the user of this manual feels the need to orien- tate himself about the terminology.\f 0 INTRODUCTION The RC 3600 Data Entry System is a software package operating under the RC 3600 Disc Operating Multiprogramming Utility System (DOMUS). It is an input data preparation key-to-disc system, receiving data from local or remote key stations under format program control, and storing data on disc files. Whenever a data batch is comple- ted, it may be dumped on tape or transmitted for remote process- ing. New format programs can be created and the formats are available to all key stations simultaneously. The system offers a great variety of data manipulation possibil- ities during data entering, including: validity checking, rekey- ing, editing, skipping, duplication, arithmetic operations, batch accumulating, etc. Supervisor functions include: format program generation, data batch transmission, etc. The keying of new format programs is done under control of a standard format and the resulting format text is stored on the disc as a normal data batch. Now the supervisor may translate it to a format program and add it to the format library. The manual contains a description of the format language, and instructions on the writing and translation of format programs. As to the practical use of the RC 3600 Data Entry System, see User's Guide and Operating Guide.\f 1 DEFINITIONS 1.1 Definition of Batch - Record - Field 1.1.1 B_a_t_c_h_ A b_a_t_c_h_is the area on a disc (a disc file), where the processed data are stored. The batch is output area for the processed document. 1.1.2 R_e_c_o_r_d_ A batch consists of a number of r_e_c_o_r_d_s_. These records describe the logical structure of the processed document(s). 1.1.3 F_i_e_l_d_ A record contains a number of fields. A field is an element in the document that is processed as a single unit (e.g., a customer number, a name, an address). E_x_a_m_p_l_e_ _1_ See Figure 1.1.3. Here the document is an invoice and the corresponding batch may consist of a number of documents structured in the same way as this invoice. Logically, the document may be divided into the following three parts: A h_e_a_d_, containing: customer name, date, terms of payment, customer number, payment to, invoice number An a_r_t_i_c_l_e_ _l_i_n_e_, containing: article name, quantity, unit price, and final price A t_o_t_a_l_, containing: total price Each part corresponds to a record in the batch.\f F_ Figure 1.1.3 \f F_ The individual columns in the document are viewed as separate elements, and each such element corresponds to a field in the batch. 1.2 Definition of Format, Subformat, and Field Description 1.2.1 F_o_r_m_a_t_ A f_o_r_m_a_t_ is a program for the Data Entry system. This program guides the keying of one or several given documents, and writes the formatted information to a batch on the disc. 1.2.2 S_u_b_f_o_r_m_a_t_ Each format is divided into a number of separate s_u_b_f_o_r_m_a_t_s_. Each subformat controls the keying of one part of the document, possibly the whole document, and writes out the data, in formatted form, on the disc as one record. Records produced with the same subformat have the same length, while records produced with different subformats may have different lengths. 1.2.3 F_i_e_l_d_ _D_e_s_c_r_i_p_t_i_o_n_ Each subformat consists of a number of f_i_e_l_d_ _d_e_s_c_r_i_p_t_i_o_n_s_ which describe the individual elements of a document. Each field description controls the keying of one such element: calculating, reformatting, and writing it out as a field in a record. 1.2.4 F_i_e_l_d_ _D_e_f_i_n_i_t_i_o_n_ _-_ _F_i_e_l_d_ _P_r_o_g_r_a_m_ A field description consists of a f_i_e_l_d_ _d_e_f_i_n_i_t_i_o_n_ and a number of program statements which are referred to collectively as a f_i_e_l_d_ _p_r_o_g_r_a_m_._ If we return to the previous example (Figure 1.1.3), then a format for the keying of such a document should look like this: FORMAT INVOI SUBFORMAT 1: customer field description date field description terms of payment field description customer no. field description \f payment to field description invoice no. field description SUBFORMAT 2: article name field description quantity field description unit price field description final price field description SUBFORMAT 3: total price field description Now, if one uses SUBFORMAT 1 once SUBFORMAT 2 as many times as there are article lines in the document SUBFORMAT 3 once - then all filled-in columns in a document of this kind can be read and processed as fields in a batch. 1.3 Definition of Subprogram - Table Special items in the format language are subprograms and tables. These are programmed and translated independently. They can be r_e_f_e_r_e_n_c_e_d_ _b_y_ _n_a_m_e_ from a format program or a subprogram. 1.3.1 S_u_b_p_r_o_g_r_a_m_ A s_u_b_p_r_o_g_r_a_m_ is a collection of program statements, which are executed when the subprogram is called (from a format program or a subprogram). 1.3.2 T_a_b_l_e_ A t_a_b_l_e_ is a collection of structured data which are referenced as one unit from a format program or a subprogram. 1.3.3 A_r_g_u_m_e_n_t_-_ _F_u_n_c_t_i_o_n_ A table is either sing-entried or multiple-entried. \f The 1st column is called a_r_g_u_m_e_n_t_: The 2nd and following columns are called f_u_n_c_t_i_o_n_s_. A single-entried table contains only one column (arguments). A table consisting of two columns (argument and one function) is said to be double-entried. Table data must be so structured that all columns are identical as to length and type. Examples on the use of tables are given in Section 6.6. 1.4 Definition of Register Each format program can command a number of registers (X01-X99). They can be used to transfer information from one subformat to another, or as working locations, or when transferring data to and from subprograms. The contents of user-defined registers can always be changed by a field program. Registers may be of different length. The format program can also access a number of pseudo-registers containing run-time information. These registers cannot be changed by the format program. 1.5 Definition of Fill-In-the-Blanks and Format Image The i_m_a_g_e_, or f_i_l_l_-_i_n_-_t_h_e_-_b_l_a_n_k_s_, facility is another special item contained in the system. 1.5.1 F_i_l_l_-_I_n_-_t_h_e_-_B_l_a_n_k_s_ Fill-in-the-blanks guidance assists while keying by displaying prompting messages on the screen. Let us look at example 1 again:a good guidance for keying subformat 2 will be the shown printouts. The place of the cursor will indicate the element to be keyed. article name:quantity: Unit price: final price: blanksblanks for keying final price \f Such printouts appear as fill-in-the-blanks (tags) on the screen. This means that there are blank spaces between the printouts and the specific columns are keyed in these blank spaces. 1.5.2 F_o_r_m_a_t_ _I_m_a_g_e_ _-_ _S_u_b_f_o_r_m_a_t_ _I_m_a_g_e_ A format may have a f_o_r_m_a_t_ _i_m_a_g_e_ attached. A format image is a program by which the fill-in-the-blanks are written to the oper- ator during keying. The image is sectioned so that each subformat has its s_u_b_f_o_r_m_a_t_ _i_m_a_g_e_. 1.5.3 I_m_a_g_e_ _P_a_g_e_ _-_ _F_i_l_l_-_I_n_-_t_h_e_-_B_l_a_n_k_s_ _M_a_s_k_ A subformat image may be further divided into several i_m_a_g_e_ _p_a_g_e_s_ each of which structures a f_i_l_l_-_i_n_-_t_h_e_-_b_l_a_n_k_s_ _m_a_s_k_, i.e., a scree, image. n\f 2 FORMAT - IMAGE - SUBPROGRAM - TABLE CODING SHEETS New formats, images, subprograms, and tables are coded on special coding sheets (documents), and the entering of these documents into the Data Entry system (by keying) is performed under format control, as with all other data. Batches created in this way are translated by calling the TRANSLATE supervisor program. After a correct translation the new format, subprogram, or table will be available for use in the system. In the following the coding sheets will be presented column by column, with those columns that require keying marked with an asterisk (*). 2.1 Format Coding Sheet and Image Coding Sheet 2.1.1 F_o_r_m_a_t_ _C_o_d_i_n_g_ _S_h_e_e_t_ The format coding sheet consists of two parts: subformat head, and field descriptions. See Figure 2.1.1 2.1.1.1 S_u_b_f_o_r_m_a_t_ _H_e_a_d_ Column 1*: Format name Min. 1 character, max. 5 characters. The 1st character must be a letter, the fol- lowing may be either letters or digits. The format name identifies the current format in the system, and must differ from all existing names of formats, sub- programs, tables, etc. Column 2*: Subformat name 1 character, letter or digit.The sub- format name must be unique in the format. The subformat name identifies the cur- rent subform meaning the subsequent row of descriptions.\f F_ Figure 2.1.1 \f Column 3: Protected Indicates whether the current subformat is protected against manual selection or not. N = no protection, i.e., the subformat can be selected manually. Y = protection, i.e., the subformat can only be selected by the format (through a SELECT statement). If this column is empty, then N is under- stood. Column 4: Comment Min. 0 characters, max. 74 characters. A comment can be used for example, to de- scribe the format/subformat. 2.1.1.2 F_i_e_l_d_ _D_e_s_c_r_i_p_t_i_o_n_. Columns 1-14 constitute the field definition, while column 15 is a field program part. Column 1: Field Min. 0 characters, max. 5 name characters. If field name is specified, the first character must be a letter and the fol- lowing either letters or digits. The field name identifies a field within the current subformat, and must be uni- que on subformat level. The 2nd, 3rd, and 4th columns describe the current field's position of the screen (by indicating first field position). Column 2: Max. 1 digit: min. value Page = 1, max. value = 8. Used to divide a record into a number of parts (pages), each of which consists of a number of fields which together make up the screen image. The pages are numbered from 1 up. When page is indicated, its value must be either equal to or greater than that of last indicated pagenumber, and it must furthermore be accompanied by the indication of line and position (i.e., columns 3 and 4).\f Column 3: Line Max. 2 digits: min. value = 1, max. value = number of data lines on screen. Indicates on which data line the field is to be entered on the current page. When line is indicated, page and posi- tion must also be stated (=2nd and 4th columns). Column 4: Position Max. 2 digists: min. value = 1, max. value = number of characters on screen line. Indicates position of first character of the field on current line, counting from left. The position number is limited so as to allow the whole field to fit into the remainder of the screen line. When position is indicated, page and line (=2nd and 3rd columns) must also be stated. If columns 2-4 are not keyed, one of the following will occur: - If there is sufficient space left on current line: the field is placed after the preceding field, leaving a blank position in between. - If there is not sufficient space left on current line: the field is placed on the next line, starting from the left-most position. - If there is not sufficient space left on the current screen image: the field is placed on the 1st data line of the next page, starting in the left-most screen position. - If the current field is the first field in the subformat: the field is placed on the 1st data line of the first page, start- ing in the left-most screen position. Column 5(*): Length Max. 2 digits: min. value = 0, max. value = 80. When length is greater than 0, the field length will be "length" = number of\f characters. When length = 0, only the program part (column 15) of a field description can be stated. When using a format, no field input is required, but the program part of such a field will be executed. When length is left blank, no other col- umns but the program part (= column 15) of the field can be stated, in which case this program part is treated as a contin- uation of the program part of the preced- ing field description. Column 6(*): Min. length Max. 2 digits: min. value = 0, max. value = length (see 5th column) of current field description. Indicates minimal number of characters to be keyed to the field: if min. length = 0, the field may be skipped. Indicated whenever length (column 5)'0. Column 7(*): Type Describes field type, i.e., which charac- ters should be keyed to the field. N = unsigned numeric. Allowable characters: 1. Digits 0 through 9. 2. Fill characters. The field will be treated as a posi- tive expression. SN = signed numeric. Allowable characters: 1. Digits 0 through 9. 2. Minus sign (preceding first digit). 3. Fill characters. When the minus sign is keyed, the field will be computed as a negative expression, otherwise as\f positive. A minus sign is stored in its keyed position, and occupies thus a field position that would be free if no minus sign were keyed (leading separate representation). SS = signed numeric. Allowable characters: 1. Digits 0 through 9. 2. Fill characters. When the field is terminated by the -ENTER key, it is treated as a nega- tive expression: when the ENTER key is used, the field is assigned a positive value. The negating operator is stored as an overpunch of the right-most chara- cter in the field - also called embed- ded trailing representation (0 becomes a , 1 becomes a J, 2 a K, 3 an L,etc.). AN = alphanumeric. Allowable characters: all non-con- trol characters. A = alphabetic. Allowable characters: 1. Letters A through Z. 2. . , - 3. Fill characters. The field is indicated when length (column 5) '0. Column 8 (*): Output position Max. 3 digits: min. value = 0, max. value = 255. The position of the field in the output records is indicated by a field number, which permits reformatting the field sequence from input. \f Fields with output position = 0 (n_o_ t_r_a_n_s_f_e_r_ _f_i_e_l_d_s_) are always placed after the last field in the output record. Such fields, though still stored in the output record (for possible rekeying) are not transferred by dump- or transfer programs. The first field in the output record has output position = 1. Only fields with a length (column 5) ' 0 are counted. Fields with length (column 5) = 0 are always placed after the last field in the output record. Indication of output position isrequired if length (column 5) ' 0. Column 9: r/l Indicates justification: R = right-justified L = left-justfied If the number of keyed characters is less than field length (column 5), the keyed characters are placed either in the right- most or in the left-most part of the field. Remaining positions are filled with fill characters (see next column specification!). No indication = automatic right-justifi- cation. Column 10: Fill characters Specifies fill characters to fill not keyed position in the field: = space 0 = zero * = asterisk If fill character is not indicated,\f spaces are understood. Column 11: Rekey Indicates rekeying of a field: Y = rekey field. N = do not rekey field. No indication implies rekeying. Column 12: Display Indicates whether an edited field shall be displayed on the screen or not. 'Editing' includes, among other things, justification and insertion of fill characters. N = do not display edited field. Y = display edited field (contents of output record field) justified and filled with fill characters. Example: Display = Y may be used to show input of a not keyed field. No indication of display implies N. Column 13: Kind Indicates field kind, that is: K = keyed field. Field may be keyed. N = not keyed field. No operator action required: the field contentsmay be computed by the fieldprogram. C = constant field. Field contains either the contens of the register specified in colum 14, or currently keyed field input. D = duplication field. Either the field contains the value of the register specified in column 14, or one keys in the current value when the field is encountered. In the latter case the register is changed to thekey- ed value. I = incrementation field. As fordupli- cation field, except that - if no data are keyed in - the register value + 1 is entered to both field and register. The field must be of\f of type "N" (column 7). When kind = C, D, or 1, indication of register (=column 14) is required. No indication of kind implies that kind =K. Column 14: Register Max. 2 digits: min. value = 1, max. value = 99. Specifies which register should be used to hold the field contents if field kind = C, D, or 1. Register may only be specified for fields with kind (column 13) = C, D, or 1. Column 15: Program statements Min. 0 characters, max. 890 characters. Contains a part of a field program. A field program consists of a number of these columns, which together form none, one, or several statements (see Section 3.7). These statements are used when, for instance, submitting current field to closer control than what is specified in columns 5 through 14. If a statement is to include a reference to a field, the corresponding field name (as speci- fied in its 1st column) must be indi- cated. If there is not enough space in a column to include the whole field program, the field program may be continued in the next column 15, provided the preceding columns 1 through 14 are left empty. A field program is considered to be concluded if a filled-in field descrip- tion (columns 1 through 14) or a new subformat is encountered, or if the format is concluded. If the format coding sheet is not large enough to hold the whole subformat,\f continue on a new format coding sheet, but leave the subformat head empty. 2.1.2 I_m_a_g_e_ _C_o_d_i_n_g_ _S_h_e_e_t_ The image coding sheet consists of two parts: subformat head, and tag descriptions. See Figure 2.1.2. 2.1.2.1 S_u_b_f_o_r_m_a_t_ _H_e_a_d_ Column 1*: Format name Min. 1 character, max. 5 characters. Format name must be identical to the name of the format where the current format image is used. Column 2*: Subformat name 1 character. The subformat name must correspond to the name of a subformat within the format that uses those tags which are listed up to the appearance of the next subformat head or the end of the tag description. Column 3: Comment Min. 0 characters, max. 74 characters. Comments are used to describe e.g. the screen layout. 2.1.2.2 T_a_g_ _d_e_s_c_r_i_p_t_i_o_n_. Together, the 1st, 2nd, and 3rd columns describe the screen position of current tag (by indicating 1st text posit- ion. Column 1*: Page Max. 1 digit: min. value = 1, max. value = 8. The tags of one subformat are hereby divided into a number of parts (pages). Each page contains as many tags as together create one screen image. The pages are numbered from 1 up. Tag descriptions belonging to the same page must appear in one sequence.\f Figure 2.1.2 \f The page numbers are printed in unbroken non-decreasing, sesquence. Column 2*: Line Max. 2 digits: min. value = 1, max. value = number of data lines on the screen. Indicates on which data line the actual text is to start (on current page). Column 3*: Position Max. 2 digits: min. value 1, max. value = number of characters on one screen line. Indicates position of the first character of current text on the current screen line. The position may not fill more than to allow the rest of the screen line to hold the whole text. Column 4*: Text Min. 1 character, max. 80 characters. This contains the tag which is to be used by the current subformat in the screen psotion specified by page, line, and position (that is, the 1st, 2nd, and 3rd columns). The following spaces (i.e., superfluous spaces to the right of text) are not included in the image. 2.2 Subprogram Coding Sheet The subprogram coding sheet consists of two parts: subprogram head, and subprogram parts. See Figure 2.2 2.2.1 S_u_b_p_r_o_g_r_a_m_ _H_e_a_d_ Column 1*: Subprogram name Min. 1. character, max. 5 characters. 1st character must be a letter, the foll- owing characters either letters or dig- its. A subprogram's name serves as its identification in the system and must differ from all existing formats, subprograms, tables, etc.\f Column 2: Comment Min. 0 characters, max. 74 characters. Comments may be used when, for instance, describing the subprogram. 2.2.2 S_u_b_p_r_o_g_r_a_m_ _p_a_r_t_ Column 1: Program statement Min. 1 character, max. 80 characters. Contains a part of a subprogram. A sub- program consists of a number of such col- umns, which together form one or more statements. (See Sections 3.7 and 3.8!).\f Figure 2.2\f Figure 2.3.1.\f 2.3 Table Coding Sheets 2.3.1 S_i_n_g_l_e_ _E_n_t_r_y_ _T_a_b_l_e_ _C_o_d_i_n_g_ _S_h_e_e_t_s_ A single entry table coding sheet consists of: table head with argument description, and argument part. See Figure 2.3.1. This coding sheet only applies to core-tables: coding of disc tables is performed on the disc table coding sheets (2.3.3). 2.3.1.1 T_a_b_l_e_ _H_e_a_d_ _W_i_t_h_ _A_r_g_u_m_e_n_t_ _D_e_s_c_r_i_p_t_i_o_n_ Column 1*: Table name Min. 1 character, max. 5 characters. The first character must be a letter, the following either letters or digits. The table's name serves as its idification in the system, and must differ from all existing formats, subprograms. tables, etc. Column 2*: Type = S, for S_ingle entry table. Column 3*: A-type This describes the argument type, thus: N = unsigned numeric AN = alphanumeric Column 4*: A-lgth Max. 2 digits: min. value = 1, max. value = 80. Gives the argument length. All arguments have the same length. 2.3.1.2 A_r_g_u_m_e_n_t_ _P_a_r_t_ Column 1*: Argument Min. 1 character, max. A-lgth characters. If A type= N: Right-justify the argument and fill not keyed position to the left of the argument with zeroes. AN: Left-justify the argument and fillnot\f Figure 2.3.2 \f keyed positions to the right of the argu- ment with blanks (). An argument may n_o_t_ stretch over more than one line. 2.3.2 D_o_u_b_l_e_ _E_n_t_r_y_ _T_a_b_l_e_ _C_o_d_i_n_g_ _S_h_e_e_t_ A double entry table coding sheet consists of: table head with argument description and function description, and argument part and function part. See Figure 2.3.2. This coding sheet only applies to core-tables: coding of disc tables is performed on the disc table coding sheets (2.3.3). 2.3.2.1 T_a_b_l_e_ _H_e_a_d_ _W_i_t_h_ _A_r_g_u_m_e_n_t_ _D_e_s_c_r_i_p_t_i_o_n_ _a_n_d_ _F_u_n_c_t_i_o_n_ _D_e_s_c_r_i_p_t_i_o_n_ Column 1*: Table name Min. 1 character, max. 5 characters. The first character must be a letter, and the following may be either letters or digits. The table name serves as its identi- fication in the system and must differ from all existing names of formats, sub- programs, tables, etc. Column 2*: Type = D, for D_ouble entry table. Column 3*: A-type Describes the argument type, thus: N = unsigned numeric AN = alphanumeric Column 4*: A-lgth Max. 2 digits: min. value = 1, max. value = 80. Indicates the length of argument. All arguments have the same length. Column 5*: F-type Describes the function type, thus: N = unsigned numeric AN = alphanumeric Column 6*: F-lgth Mag. 2 digits: min. value = 1, max. value = 80 \f Indicates the length of function. All functions have the same length. 2.3.2.2 A_r_g_u_m_e_n_t_ _a_n_d_ _F_u_n_c_t_i_o_n_ Column 1*: Argument Min. 1 character, max. A-lgth charac- ters. If A-type = N: Right-justify the argument and fill not keyed positions to the left of the argument with zeroes. AN: Left-justify the argument and fill not keyed positions to the right of the argument with blanks (). An argument may n_o_t_ stretch over more than one line. Column 2*: Function Min. 1 character, max. F-lgth charac- ters. If F-type = N: Right-justify the function and fill not keyed positions to the left of the function with zeroes. AN: Left-justify the function and fill not keyed positions to the right of the function with blanks (). A function may n_o_t_ stretch over more than one line. 2.3.3 D_i_s_c_ _T_a_b_l_e_ _C_o_d_i_n_g_ _S_h_e_e_t_. A disc table coding sheet consists of: table head with argument and function description, and argument part and function part. See Figure 2.3.3. 2.3.3.1 T_a_b_l_e_ _H_e_a_d_ _w_i_t_h_ _A_r_g_u_m_e_n_t_ _D_e_s_c_r_i_p_t_i_o_n_ _a_n_d_ _F_u_n_c_t_i_o_n_ _D_e_s_c_r_i_p_t_i_o_n_ Column 1*: Table name Min. 1 character, max. 5 characters. The first character must be a letter, and the following may be either letters or digits. The table name serves as it identification in the system and must be the name of the disc table holding the table. \f Column 2*: Type = M, for possibly M_ultiple entry table. Column 7*: No. of Functions A digit specifying the number of func- tions per argument: min. value = 0, max. value = 6. Zero means that the table is single-entried. Column 8*: A - type Describes the argument type, thus: N = unsigned numeric AN = alphanumeric Column 9(*): F1 - type Describes the type of first function, thus. N = unsigned numeric AN = alphanumeric Not filled in if no. of functions equals 0. Column 10(*): F2 - type Describes the type of third function (see column 9). Not filled in if no of func- tions less than 3. Column 11(*): F3 - type Describes the type of third function (see column 9). Not filled in if no. of func- tions less than 3. Column 12(*): F4 - type Describes the type of fourth function (see column 9). Not filled in if no. of functions less than 4. \f Figure 2.3.3 \f Column 13(*): F5 - type Describes the type of fifth function (see column 9). Not filled in if no. of functions less than 5. Column 14(*): F6 - type Describes the type of sixth function (see column 9). Not filled in if no. of functions less than 6. 2.3.3.2. A_r_g_u_m_e_n_t_ _a_n_d_ _F_u_n_c_t_i_o_n_ _P_a_r_t_ Column 1 (*): Operation Operation to be performed: I = I_nsert, the argument in column 2 on the same line and functions in fol- lowing lines are to be inserted in the table as one entry. U = U_pdate, the functions in following lines replace the functions of an existing entry identified by the argument specified in column 2 of the same line. D = D_elete, remove the entry identified by the argument specified in column 2 of the same line from the table. E = E_nd, specifies that the line is the last coding sheet. Column 2(*): Arguments If column 1 of the same line is filled and Functions in with an E then column 2 is empty. If column 1 of the same line is filled in with a D then column 2 is an argu- ment. If column 1 of the same line is filled in with 1 or U then column 2 is an argu- ment and the following lines contain the corresponding functions in column 2 (column 1 empty). The number of func- tions following the argument must corr- espond to the number specified in column 7 of the table head (see above). \f Each argument and function must contain at least one and at most 80 characters, however, the lengths must correspond to the characteristics with which the disc table has been created, see Users Guide part 2. An argument is specified as follows: If A - type = N: Right - justify the argument and fill not keyed positions to the left of the argument with zeroes. AN: Left - justify the argument and fill not key positions to the right of the argument with blanks (). An argument may n_o_t_ stretch over more than one line. A function is specified as follows: If Fx - type (x = function number) = N: Right - justify the function and fill not keyed positions to the left of the function with zeroes. AN: Left - justify the function and fill not keyed positions to the right of the function with blanks (). A function may n_o_t_ stretch over more than one line.\f 3 THE FORMAT LANGUAGE 3.1 On programming 3.1.1 W_h_a_t_ _I_s_ _A_ _P_r_o_g_r_a_m_?_ A program can be viewed as the exact description of the procedure whereby you solve a specific problem. Consider, for example, the problem of crossing a street without being overrun by a car. In a case like this it is not enough to know that you must "watch out before you cross the street", if you have not been confronted with precisely the same problem before. Therefore, the problem must be analyzed, which means that one must try to survey the parameters contained in the problem, and to assess their different roles therein. In order to be able to cross the street you must therefore know that a car might come, that it might come from left or right, and that it might prevent your getting across the street. Thus, a program must be a step by step description of how the parameters (operands) contained in a problem should be handled so as to arrive at the desired final stage from a given starting point. In the example of crossing a street one may choose as a starting point the situation where the program ignores the events leading up to that situation. As the final stage one selects the arrival at the opposite sidewalk. Written in ordinary language, such a program might look something like this: E_x_a_m_p_l_e_ _3_._1_._1_a_ 1. Look to the left. 2. Do you see a car? Yes: Go to point 3. No: Clear, go to point 5. 3. Is the car less than 200 meters away? Yes: Go to point 4. No: Clear, go to point 5. 4. Is the car parked? Yes: Clear, go to point 5. \f No: Go to point 1. 5. Look to the right. 6. Do you see a car? Yes: Go to point 7. No: Clear, go to point 9. 7. Is the car less than 200 meters away? Yes: Go to point 8. No: Clear, go to point 9. 8. Is the car parked? Yes: Clear, go to point 9. No: Go to point 1. 9. Walk to the opposite sidewalk. As suggested above, one could use another, preceding, program to describe how to reach the specific street that one is to cross, and a following program to specify what actions to take once one has crossed the street. Therefore, the starting situation could be altered a little. Let us say that, 1. You are standing at the curbline, and 2. You know that the street has two-way traffic or, if not, that it is a oneway street (with traffic from left or from right). The source of your information may be a previously executed pro- gram (its final stage), and in rewriting the program given in the example above (3.1.1a) you can insert the information under 2., so as to be able to decide which way to look: E_x_a_m_p_l_e_ _3_._1_._1_b_ 1. Does the street have two-way traffic? Yes: Go to point 1b. No: Go to point 1a. 1a. Does the street have one-way traffic from the left? Yes: Go to point 1b. No: One-way, from the right: Go to point 5a. 1b. Look to the left. . . . 5. Does the street have one-way traffic only? Yes: Clear from the left, go to point 9. No: Go to point 5a. 5a. Look to the right. \f . . . We could further extend the example'sprogram. It could, for example, count all cars passing from the right, it could register how many times one had looked to the left before the street was safe to cross, and so on. This information could be fed into a following program, e.g., for statistical use. All information that is available for a program in the starting situation is called i_n_p_u_t_ _p_a_r_a_m_e_t_e_r_s_, which, together with the program's own calculations, may influence the execution of the program. Information derived from a program is called o_u_t_p_u_t_ p_a_r_a_m_e_t_e_r_s_. 3.1.2 T_h_e_ _E_l_e_m_e_n_t_s_ _o_f_ _a_ _P_r_o_g_r_a_m_ A program consists of a number of statements. Every single state- ment's execution marks a step on the way from the program's starting situation to its final stage. The statements are written in a programming language, that is characterized by the firm rules that guide the formulation of a statement. In the examples 3.1.1a and 3.1.1b every step can be viewed as a program statement. The statements operate on a set of parameters (operands) that can be read and changed. In Example 3.1.1b point 1 can be viewed as the read-out of the input parameter, stating the direction of traffic. If the example had been extended also to register the number of passing cars, this number would be a parameter that would be changed during the course of the program, from zero at the starting situation to the actual number of cars at the final stage. The execution of the program begins with the execution of its first statement. This done, the next statement is executed, and so forth, until the program's last statement has been reached. As can be seen from the examples above, the statements of a program are not executed in unbroken order: some statements are skipped as a result of the answers that are given to the questions presented. \f 3.1.3 T_h_e_ _E_l_e_m_e_n_t_s_ _o_f_ _t_h_e_ _F_o_r_m_a_t_ _L_a_n_g_u_a_g_e_ There are two types of programs in the Format Language: f_i_e_l_d_ _p_r_o_ g_r_a_m_s_ and s_u_b_p_r_o_g_r_a_m_s_. A field program consists of those program statements that belong to a field description. A subprogram is a labelled collection of program statements, which are executed when referenced from a program. Subprograms are used if the repeating of the same sequence of statements in several programs is to be avoided. The operands for a program are called v_a_r_i_a_b_l_e_s_ and c_o_n_s_t_a_n_t_s_. A variable is a place for storing information that can later be called upon and may be subject to change. In the Format Language, the variables are fields and registers. A variable is referenced from a program statement by calling it by name. A field is refer- enced by using the name of a field description, by which the pro- gram is made capable of processing a keyed unit of a specific part of a document. Fields cannot be referenced from subprograms. A register is referenced by putting an "X" before its number. Registers in a given format are used to transfer information between programs, and to store intermediate results within programs. Variables may contain different kinds of values, e.g., numerical or alphabetical. A constant contains information that cannot be changed by the program, but is entered into calculations together with variables. Like variables, constants may contain different kinds of values. In the Format Language several constants may be assembled into a specified table, and can thus be referenced collectively from the program. 3.1.4 E_x_a_m_p_l_e_ _I_n_ _t_h_e_ _F_o_r_m_a_t_ _L_a_n_g_u_a_g_e_ P_r_o_b_l_e_m_: A document contains, among other things, the following elements: DATE OF PURCHASE DATE OF PAYMENT AMOUNT: The two dates are specified by year and month (format YYMM). Date of purchase may not come later than date of payment. If purchase date coincides with date of payment, the program calculates a discount. P_r_o_b_l_e_m_ _a_n_a_l_y_s_i_s_,_ _p_r_o_g_r_a_m_ _p_l_a_n_n_i_n_g_: \f The first field program controls the date of purchase, and uses as input parameter a field with a keyed four digit number (speci- fied in the field program's definition section). The second field program controls the date of payment in the same manner as the first field program it further compares the two dates. Thus the date of purchase will be one of the program's in- put parameters. Since these dates are identically checked, one can use a subpro- gram, with the date itself as the input parameter and a correct/- not correct indication as the output parameter. Month and year are separately checked: the year must be within the 70-80 (inclu- sive) interval, which is used as a constant. As for the amounts, these are not subject to special verification and a corresponding field description therefore involves only the definition section. Calculation of discounts is performed by the filed program of a 'not-keyed field' (meaning a field which receieves its value solely from the calculating done by the program). As input para- meters the program uses the two dates and the amount, and the resulting discount amount will appear in the field as the output parameter. The discount percentage is a constant. Example 3.1.4a shows how to write field descriptions, and in Example 3.1.4b you will find the subprogram that checks the date. The program statements will be discussed later in this manual. Here oly the following information is given: - "DEFINE X01 4" defines a register of length 4. - "COMPUTE X01 = KDATE" transfers the contents of a field to a register. - "PERFORM DCHEK" causes the subprogram DCHEK to be executed, after which the program continues with the next statement. - "ALARM "DATE OF PURCHASE WRONG"" causes the writing of an error message, whereupon the information must be keyed anew, and the filed program is again executed from the beginning. - "IF KDATE' BDATE", 'means "IF GREATER THAN". - "DISCOUNT = AMOUNT/100*3" places the result of an arithmetical expression in a field. The discount rate is 3 percent of the amount. \f Example 3.1.4a \f Example 3.1.4b \f 3.2 Character Set The character set for the format language consists of 50 charac- ters. These characters and their corresponding meanings are: C_h_a_r_a_c_t_e_r M_e_a_n_i_n_g_ 0,1,2,3,4,5,6,7,8,9 Digit A,B'C,D,E,F,G,H,I,J,K, L,M,N,O,P,Q,R,S,T,U, V,W,X,Y,Z Letter Space + Plus sign - Minus sign or hyphen * Asterisk / Stroke = Equal , Comma ; Semicolon " Quotation ( Left parenthesis ) Right parenthesis ' Greater than Less than : Colon The basic elements of the language are: names, arithmetic operators, relational operators, logical oper- ators, and punctuation symbols. The elements are explained in the following sections. 3.2.1 N_a_m_e_s_ A name is composed of a combination of characters. Allowable characters are: Letters: A through Z Digits: 0 through 9 A name must begin with a letter. Only the five leading characters are significant. Thus PERFORM is equivalent to PERFO, for example and PERFO is equivalent to PERFORMANCE; but IN is not equivalent to INCORRECT: \f There are 6 types of names: reserved names, user-defined field names, user-defined label names, user-defined subprogram names, user-defined table names, and user-defined subformat names. Reserved names have a special predefined meaning to the system; therefore, these must never be used as user-defined names. Reserved names are listed in Table 3.2.1-1 Some of the reserved names are verbs. Verbs identify statements in the format language and are used in field programs and sub- programs. The verbs allowed in each of the two programs are listed in Table 3.2.1-2. Table 3.2.1-1. L_i_s_t_ _o_f_ _R_e_s_e_r_v_e_d_ _N_a_m_e_s_ ALARM GIVING SET ALLOW GOTO SKIP ALPHANUMERIC IF SUBFORMAT AND IN THEN AT INVALID TO COMPUTE LIMIT VALID CONECT MOD X00 DEFIND MOVE X01 DISALLOW NOT . DISC NOTE X99 DISPLAY NUMERIC XBATCH DUP OR XDATE ELSE PERFORM XJOB END SEARCH XOPERATOR FIELD SELECT XTIME \f Table 3.2.1-2. L_i_s_t_ _o_f_ _R_e_s_e_r_v_e_d_ _V_e_r_b_s_ may be used in: V_e_r_b_ F_i_e_l_d_ _P_r_o_g_r_a_m_ S_u_b_p_r_o_g_r_a_m_ ALARM x x ALLOW x x COMPUTE x x CONNECT x x DEFINE x x DISALLOW x x DISPLAY x x DUP x x END x x END SUBFORMAT x x GOTO x x IF x x LIMIT x x MOVE x x NOTE x x PERFORM x x SEARCH x x SELECT SUBFORMAT x SET x SKIP x x 3.2.2 A_r_i_t_h_m_e_t_i_c_ _O_p_e_r_a_t_o_r_s_ The arithemetic operators are used to perform specific arithmetic operations. The used symbols and their operation are: + Addition - Subtraction * Multiplication / Division MOD Modulo NUMERIC Conversion of nonnumeric to numeric ALPHANUMERIC Conversion of numeric to nonnumeric 3.2.3 R_e_l_a_t_i_o_n_a_l_ _O_p_e_r_a_t_o_r_s_ Relational operators specify the type of comparisons to be made between two operands in relational conditions. These symbols and their meaning are: ' Greater than '= Greater than or equal to = Equal to \f Less than = Less than or equal to ' Not equal to 3.2.4 L_o_g_i_c_a_l_ _O_p_e_r_a_t_o_r_s_ Logical operators are reserved names that define a connection between operands. The reserved names and their use are: AND Logical "and" OR Logical "or" NOT Logical "not" 3.2.5 P_u_n_c_t_u_a_t_i_o_n_ _S_y_m_b_o_l_s_ The punctuation symbols used in the program statement section of a format program, and their names, are: Space ( Left parenthesis , Comma ) Right parenthesis ; Semicolon " Quotation mark : Colon 3.3 Operands The operands used in the format language are described in the following paragraphs. The operands are: Constants Registers Fields Registers and fields may be used with subscripts; this feature is described in section 3.3.4. Operands may be used as destination or as source, except constants which only may be used as source. Source means that the operand is "input parameter" to a statement. Destination means that the operand is "output parameter" from a statement. Operands may be numeric or nonnumeric. A numeric operand contains a numeric value. A nonnumeric operand contains a string of chara- cters. 3.3.1 C_o_n_s_t_a_n_t_s_ Constants are strings of characters which represent a specific value. There are two types of constants: numeric and nonnumeric. \f A numeric constant is composed of digits, and must contain at least one digit but not more than 80 digits. The value of a numeric con- stant is always positive. Negative values are obtained in the state- ments, where it is allowed, by preceding the numeric constant by a minus. Examples of valid numeric constants are: 198 50 091 Examples of invalid numeric constants are: -198 Sign is not allowed 1.5 Cannot contain a decimal point 9,85 No comma allowed A nonnumeric constant can contain any characters including those not in the format language character set, except quotation marks. The constant must be enclosed in quotation marks. A nonnumeric constant can be from 0 to 78 characters. Examples of valid nonnumeric constants: "MONTH IS GREATER THAN 12" "19876" "TYPE N FOR NO, Y FOR YES" " Example of invalid nonnumeric constant: "TYPE "N" FOR NO" Cannot contain quotation marks A nonnumeric constant may look like a numeric constant, but the two are not identical. They are both stored as characters, but a numeric constant is interpreted as a numeric value. Thus the numeric constant 00190 is equivalent to the numeric constant 190, but the nonnumeric constant "00190" is not equivalent to the non- numeric constant "190" or "190". 3.3.2 R_e_g_i_s_t_e_r_s_ Registers have been added to extend the possibilities of the language. Registers are normally used in three connections. They are used for transferring data from one record to another, for transferring data to and from a subprogram and for computations.\f Registers are defined by the DEFINE statement, see Section 3.7.1.5. The letter X followed by any number from 01 to 99 is used to name a register. As many registers as needed can be used in a format program. The numbers used need not be sequential, but should be sequential starting with 01 to conserve storage. Examples of valid register names: X01 X11 X99 Examples of invalid register names: X00 Digits not 01 to 99 X1 Too few digits X010 Too many digits A register contains eithre numeric or nonnumeric data. The type of data is dependent of the program statement, which had the reg- ister as destination last time (e.g., the MOVE statement makes the register nonnumeric, the COMPUTE statement numeric). Data are always stored as characters in the register. The length of a reg- ister is declared by a DEFINE statement and is the number of character positions in the register. The DEFINE statement must be executed before any other statement referring to that register. The DEFINE statement must be executed before any other statement referring to that register. The DEFINE statment gives no type to the register; the type is given first when the register is used as destination in a statement. It is allowed to change the type of a register during exectuion of the format program. If nonnumeric data are stored in a register, and the number of characters in the data is smaller than the register length, data are stored from left to right and the remaining positions in the register are filled with spaces. If the number of characters in the data is greater than the register length the right-most chara- cters are truncated. Numeric data are right-justified in the register, and remaining postiions are filled with zeroes if the data are created by the COMPUTE statement. The negating operator of data representing a negative value will be stored as for type SS (see 2.1.1.2). If the number of significant digits in the data is greater than the\f the register length, a runtime error will occur. Numeric data stored automatically in a register (automatic fields, see 4.4.2) will always be identical to the data stored in the field also with respect to justification, fill characters and representation of negating operator. An automatic field, of which the length of the register unequals the length of the field, will cause a runtime error when the field is encountered The system furthermore contains a number of pseudo-registers con- taining run-time information which may be accessed by programs. The pseudo-registers are predefined by the system their names belonging to the reserved names of the language. This means that these registers may be accessed without having been defined by DEFINE statements in the format program, and that they do not claim storage to be used. The contents of the pseudo-registers cannot be altered by the programs which means that they cannot occur: - On the left side of the equal sign in COMPUTE statements (see 3.7.1.3). - after the word GIVING in CONNECT and SEARCH statements (see 3.7.1.4 and 3.7.1.14) - after the word TO in MOVE statements (see 3.7.1.11). - in field definitions (see 2.1.1.2, column 14:register). Apart from these limitations the pseudo-registers may be used in all connections where registers are allowed as source operands. The operand type of the pseudo-registers is nonnumeric. The pseudo-registers are: length in n_a_m_e_ c_h_a_r_a_c_t_e_r_s_ t_y_p_e_ c_o_n_t_e_n_t_s_ XBATCH 5 AN Name of the batch in which processed data are stored. XDATE 8 AN Year, month, and day in the format: YY.MM.DD corresponding to the time\f at which a readout of the register occurs. XJOB 5 AN Name of the job to which the batch is belonging. XOPERATOR 3 AN Operator initials of key station operator. XTIME 8 AN Hour, minute, and second in the format: HH.MM.SS corresponding to the time at which a readout of the register occurs. Operator initials are the initials given by the key station oper- ator when work on a key station is initiated. For further details see Users Guide, Part 1, which also describes when and how name of batch and job are entered by the keying operator. 3.3.3 F_i_e_l_d_s_ Fields are numeric or nonnumeric depending on their type as specified in the field definition: F_i_e_l_d_ _D_e_f_i_n_i_t_i_o_n_ _t_y_p_e_ O_p_e_r_a_n_d_ _T_y_p_e_ N numeric SN numeric SS numeric AN nonnumeric A nonnumeric Current field is the field which field description contains the field program. Any field before (in the same subformat) and including current field is allowed as source operand in a field program. No field,, except current field, is allowed as destination operand and curr- ent field is only allowed as destination if it is not keyed (i.e., kind = N). The following rules apply to not keyed fields used as destination operands: 1. It is only allowed to store nonnumeric data in fields of type A or AN, and numeric data in fields of type N, SN, or SS. 2. When nonnumeric data are stored and the number of characters in the data is smaller than the field length, the data are left- or right-justified depending on the specification in the\f field definition, and the remaining positions are filled with the fill character specififed in the field definition. If the number of characters in the data is greater than the field length, the right-most characters are truncated. Then it is checked whether the field contents correspond with the type assigned in the field definition, otherwise a runtime error will occur (only applies for type = A). Examples of storing nonnumeric data: Field Justi- l_e_n_g_t_h_ T_y_p_e_ F_i_l_l_ f_i_c_a_t_i_o_n_ S_o_u_r_c_e_ F_i_e_l_d_ _c_o_n_t_e_n_t_s_ 6 A L "ABC" "ABC" 4 A L "ADDRESS" "ADDR" 6 A L "ABC" "ABC" 6 A R "ABC" "ABC" 6 A L "123" runtime error 3 AN R "JANUARY" "JAN" 10 AN R "JANUARY" "JANUARY" 6 AN L "123" "123" 3. When numeric data are stored and the number of significant digits (leading zeroes are ignored) is smaller than the field length, the data are left- or right-justified depending on the specification in the field definition, and the remaining posi- tions are filled with the fill character specified in the field definition. If the number of significant digits is greater than the field length a runtime error will occur. It is then checked whether the field contents correspond with the assigned type in the field definition, otherwise a runtime error will occur (only applies for type =N). Examples of storing numeric data: \f Field Justifi- l_e_n_g_t_h_ T_y_p_e_ F_i_l_l_ c_a_t_i_o_n_ S_o_u_r_c_e_ F_i_e_l_d_ _c_o_n_t_e_n_t_s_ 5 N 0 R 155 00155 5 N 0 R -50 runtime error 5 N 0 R 555555 runtime error 5 SN R -50 -50 5 SN R -50000 runtime error 5 SN 0 L -50 -5000 5 SS 0 R 59 00059 5 SS 0 R -55555 5555n 5 SS 0 R -51 0005j 3.3.4 S_u_b_s_c_r_i_p_t_s_ Subscripts are used to refer to individual characters or groups of characters in a register or a field. The syntax of subscripts is (notation is described in 3.4): numeric constant : numeric constant A single character is accessed by supplying one subscript. A group of characters is accessed by supplying the leftmost subscript fol- lowed by the rightmost subscript of a sequence of adjacent charac- ters in a register or field. A group of characters consists of two or more characters. Subscripts should be in the range 1 to the length of the register or the field, where 1 is the leftmost subscript. Examples of subscripting are: MOVE XDATE(4:5) TO MONTH, COMPUTE A = B(3) * B(5), COMPUTE X01(5) = 9, MOVE "DD" TO X03(7:8), If at run-time, the value of the subscript exceeds the size of the register or the field being subscripted, a runtime error will occur. When destination operands are supplied with subscripts, please notice the following rules: 1. Only the contents of the character position(s) specified by the subscript is changed. The justification and filling\f described in the preceding section are not executed. 2. A negative value cannot be assigned to a subscripted numeric operand. 3. A register must be initialized before it is used as destina- tion with subscript. The initialization may be performed by any statement which has the register as destination. The ini- tialization is necessary because when registers are used as destination with subscript, it is required that the type of the source and the type of the register concur. Example: If a register is used nonnumerically it may be in- itialized with a MOVE statment. MOVE " TO X01 and then used with subscript, e.g., MOVE "A" TO X01(1), MOVE "Z" TO X01(10), If a register is used numerically it may be initialized with a COMPUTE statement: COMPUTE X02 = 0 and then used with subscript, e.g., COMPUTE X02(1) = 5, COMPUTE X02(3) = 9, 4. It is not necessary to initialize a field before it is used as destination, because a not keyed field is always filled with the specified fill character before a field program is executed. 5. After a field is used as destination with subscript, the con- tents of the field are checked against the type of the field (only applies to type A), and a runtime error will occur if the contents and the type do not correspond. 3.4 Notation The notation used in the remainder of this section is described in the following paragraphs: \f 1. All words printed in capital letters belong to the language. They are referred to as "reserved names". 2. Variable entries which are to be supplied by the format pro- grammer are printed in lower case letters. 3. When punctuation or other special characters are printed, they are required. 4. Braces enclosing vertically listed items indicate that one and only one of the items is required. 5. Brackets are used to enclose a portion which is optional. 6. The ellipsis ... indicates that the preceding entity can occur one or more times in succession. 3.5 Arithmetic Expressions Arithmetic expressions (or shortly: expressions) are used in cert- ain program statements (the IF and COMPUTE statements, see Section 3.7). An arithmetic expression is composed of operands, parentheses and arithmetic operators according to certain rules which make an expression written almost as in the mathematical literature. A simple example of a statement containing an arithmetic express- ion is: COMPUTE X01 = X01 + X02, where "X01 + X02" is the expression the evaluation of it being the sum of values of register X01 and register X02. The following rules concerning the type of result of an arithmetic expression must be observed: 1. The evaluation of an arithmetic expression in COMPUTE state- ments must result in a numeric value. 2. A relation (see 3.6.1) may compare either two arithmetic expressions giving nonnumeric values or two arithmetic expre- ssions giving numeric values. \f The arithmetic operators allowed are: O_p_e_r_a_t_o_r_ M_e_a_n_i_n_g_ + addition called adding - subtraction operators * multiplication / division called multiplying MOD modulo operators ALPHANUMERIC convert numeric to nonnumeric called conver- NUMERIC convert nonnumeric to numeric sion operators The most simple arithmetic expression consists of merely one numeric operand. More complex arithmetic expressions may be composed by: 1. separating two or more operands by one of the arithmetic operators; 2. preceding one operand with one of the adding operators (e.g., COMPUTE X01 = +5, COMPUTE X01 = X01); 3. Subexpressions, enclosed in parentheses, may be used as an operand. The rules for composing arithmetic expressions are: fieldnamefieldname fieldname (subscripts)fieldname (subscripts) NUMERICregister + NUMERIC register + register (subscripts)-register (subscripts) - nonnumeric constant*nonnumeric constant / MOD numeric constant numeric constant NUMERIC (expression) NUMERIC (expression) fieldname fieldname (subscripts) ALPHANUMERIC register register (subscripts) numeric constant (expression) \f The following rules concerning conversion operators must be obeyed: 1. The entity (fieldname, register, constant, or parenthesed expression) following the NUMERIC operator must be of non- numeric type. An operand to be converted by NUMERIC must only contain digits and fill characters and the conversion cannot result in a negative value (negating operator not allowed). 2. The entity following the ALPHANUMERIC operator must be of numeric type. Examples of arithmetic expressions are: X01 FLD1 59 +X02(1) -59 NUMERIC X10 ALPHANUMERIC FLD5 X01*FLD X04*NUMERIC XDATE (7:8) X01 + X02)/2 ALPHANUMERIC (NUMERIC X06*3) FLD1 MOD 10 + FLD2 MOD 10 (FLD1(1)*2+FLD1(2)*3)/(FLD(1)+FLD(2)) ((A+B) * (C+D) + (A+B)/2) MOD 10 An arithmetic expression is evaluated in the following order: 1 (first): Subexpression in parentheses 2 : Conversion operators (ALPHANUMERIC, NUMERIC) 3 : Multiplying operators (*,/,and MOD) 4 (last) : Adding operators (+ and -) When a sequence of operators has the same priority, the operators are executed in order of their occurence from left to right. An example of evaluating an expression: Consider the expression: -(A+B)* (C-D)/2 \f First the subexpressions in parentheses are evaluated. A is added to B giving a temporary result, namely R1, and D is subtracted from C giving another temporary result R2. The expression may now be shown as: -R1 * R2 /2 Now the multiplying operators are executed in order of their occur- rence from left to right, therefore R1 is multiplied to R2 giving the temporary result R3, and the expression may be shown as: -R3 /2 The second multiplying operator is executed: R3 is divided by 2 giving R4. Finally, R4 is negated, and the evaluation is compl- eted. The following examples show the evaluation of divisions: e_x_p_r_e_s_s_i_o_n_ r_e_s_u_l_t_ e_x_p_r_e_s_s_i_o_n_r_e_s_u_l_t_ 7/3 2 7 MOD 3 1 7/(-3) - 2 7 MOD (-3) 1 (-7)/3 - 2 (-7) MOD 3 - 1 (-7/(-3) 2 (-7) MOD (-3) - 1 3.6 Conditions Conditions are used in the so.called conditional statements (the IF statement, see Section 3.7). A condition causes the path of control to be altered depending upon whether the condition is true or false. A simple example is the following statement: IF TOTAL X01 THEN COMPUTE X02 = X02 + 1, The condition is "TOTAL X01". If TOTAL is less than X01, the condition is true and the new value of X02 is computed. If TOTAL is not less than X01, the condition is false and control is trans- ferred to the next statement following the IF statement. In the format language the following types of conditions are allowed: relations, validity conditions, and table conditions. \f A condition may be either simple or compound. A simple condition is a relation, a validity condition or a table condition. A com- pound conditon is composed of conditions, parantheses, and logical operators. 3.6.1 R_e_l_a_t_i_o_n_ A relation is a comparison of two operands, either of which can be a field name, a register, a constant, or an arithmetic expre- ssion. The operands are separated by a relational operator which specifies the type of comparison to be made between the two operands. The allowable relational operators and their corres- ponding meanings are: R_e_l_a_t_i_o_n_a_l_ _o_p_e_r_a_t_o_r_ M_e_a_n_i_n_g_ ; greater than ;= greater than or equal to = equal to = less than or equal to less than ; not equal to The syntax of a relation is: field name field name (subscripts) field name (subscripts) registerrelational op.register register (subscripts)register (subscripts) constantconstant arithmetic expression arithmetic expression The following rules apply to relational conditions: 1. A numeric operand can only be compared with another numeric operand. 2. A nonnumeric operand can only be compared with another non- numeric operand. 3. Comparisons of numeric and nonnumeric operands are not allowed When needed, however, the conversion operators NUMERIC and ALPHANUMERIC may be used to convert the type of an operand. \f Examples of relations: X01 ' = 0 X01 = X02 X01 * 2 - A = X02 D = "JENSEN" (A + B) ' 3 X05 = "TEXT" X03(1) * 2 ' = 10 (A(1) + A(2) MOD 10 = 0 ALPHANUMERIC FLD = "*****" YEAR = XDATE (1:2) 3.6.1.1 C_o_m_p_a_r_i_s_o_n_ _o_f_ _N_u_m_e_r_i_c_ _O_p_e_r_a_n_d_s_ If the operands are numeric the respective values of the operands are compared. 3.6.1.2 C_o_m_p_a_r_i_s_o_n_ _o_f_ _N_o_n_n_u_m_e_r_i_c_ _O_p_e_r_a_n_d_s_ The characters used in non- numeric operands are ordered according to their position in a sequence of (all) characters. The relation between two characters is determined by their positions in the sequence of characters. The character sequence in ascending order is: (space) ! # < % & " ( ) * + - . 0 through 9 : ; = ' ? Æ \f A through Z When nonnumeric operands are of equal length (i.e., they contain the same number of character positions), characters in correspon- ding positions of the two operands are compared starting with the left-most position and proceeding to the right-most position. If all the characters are the same through the last position, the operands are considered equal. If a pair of unequal characters is encountered, the position in the character sequence is determined for each character. The operand containing the highest character position is considered to be the greatest of the two operands. See the examples below! When nonnumeric operands are of unequal length (i.e., they do not contain the same number of character positions), the longest oper- and is treated as if the right-most characters were truncated, to make it the same length as the other operand. The comparison is then made as though they were the same length. Examples of comparing two nonnumeric operands A and B: TRUE A B RELATION EXPLANATION "JENSEN" "HANSEN" A ' B Operands are of equal length. Characters are compared from left to right. J comes after H in the character sequence. "FIELD" "FIELDS" A = B The right-most character is truncated in B. "29" "199" A ' B The right-most character is truncated in B, and 2 follows 1 in the character sequence. "39" "029" A B 0 comes after space in the character sequence. "HANSEN" "HANSON" A B Characters are compared from left to right, the first pair of unequal characters is E and O, and E is preceding 0 in the character sequence. \f 3.6.2. T_a_b_l_e_ _C_o_n_d_i_t_i_o_n_ A table condition is used to search a table for a specific argu- ment. The syntax of a table condition is: field name field name (subscripts) register IN table name register (subscripts) constant The table name identifies the table in the library of tables used The table may be either a single.entried or a double-entried core table, but not a DISC table (see Section 5.3). The arguments in the table, specified by table name, are searched for a match against the operand preceding the word IN. If a match is found the condition is true, otherwise the condition is false. The operand preceding IN and the arguments in the table must be of the same type (i.e., either numeric or nonnumeric). The methods for comparing operands as described in Sections 3.6.1.1 and 3.6.1.2 are also used when evaluating a table condition. Examples of table conditions: X01 IN TABL1 FLD IN CTABL FLD(1) IN CTABL 3.6.3 V_a_l_i_d_i_t_y_ _C_o_n_d_i_t_i_o_n_ The validity condition determines whether a field is valid or invalid. The syntax of a validity condition is: VALID field name INVALID Every field has an associated validity flag, which can be expli- citly set to valid or invalid by the SET statement (see Section 3.7.1.16). Unless changed by a SET statement, the validity flag of a field is invalid if an error has been detected and not corrected, otherwise the validity flag is valid. \f 3.6.4. C_o_m_p_o_u_n_d_ _C_o_n_d_i_t_i_o_n_s_ Conditions, parentheses, and logical operators may be combined to form a compound condition. The logical operators and their meanings are: L_o_g_i_c_a_l_ _O_p_e_r_a_t_o_r_ M_e_a_n_i_n_g_ OR logical disjunction AND logical conjunction NOT Logical negation The syntax of a compound condition using the AND or OR operator is: AND AND (condition) OR (condition) OR (condition) The syntax of a compound condition using the NOT operator is: NOT (condition) The results of the relationships between two conditions A and B are: A B NOT (A) (A) AND (B) (A) OR (B) true true false true true true false false false true false true true false true false false true false false Additional pairs of parentheses, enclosing subconditions, may be used to specify the order in which the compound conditions are to be evaluated. The compound conditions are evaluated in the following order: 1 (first) : Arithmetic expressions 2 : Relational operators / table operator 3 : Subconditions in parentheses 4 : Logical NOT operator 5 : Logical OR operator 6 (last) : Logical AND operator When a sequence of operators has the same order, the operators\f are executed in order of their occurrence from left to right. Examples of compound conditions and their evaluation: NOT (A ' B) First the relational condition A ' B is evaluated, then the result is negated. (X01 = X02) AND (A IN TAB1) First the relational condition preceding the word AND is eval- uated, then the table condition following AND, and finally the AND operator is executed. NOT ( (X01 ' A) OR (X01 B)) First the relational conditions preceding and following the word OR are evaluated, then the OR operator and finally the NOT oper- ator. NOT (X01 ' A) OR (X01 B) First the relational condition following the word NOT is eval- uated, and the result is negated, then the relational condition following the word OR is evaluated, and finally the OR operator is executed. 3.7 Format Language Statements A statement is the basic unit of a field program or a subprogram. Each statement begins with a verb and describes some action to be taken. Normally this is an action which could not be specified in the checkbox part of the format coding sheet. The statements are separated by commas, and a program is termi- nated by a comma. A field program consists of none, one or more statements. In the format language there are two categories of statements: conditional statements and unconditional statements. A condit- ional statement is one which contains some conditions that are tested to determine the path to be taken in the feild program (the IF statement). An unconditional statement is one which\f specifies an unconditional action to be taken. 3.7.1 U_n_c_o_n_d_i_t_i_o_n_a_l_ _S_t_a_t_e_m_e_n_t_s_ 3.7.1.1 A_L_A_R_M_ _S_t_a_t_e_m_e_n_t_. The ALARM statement is used to display error messages on the message part of the keystation screen. The syntax of the ALARM statement is: nonnumeric constant register ALARM register (subscripts) field name field name (subscripts) The ALARM statement displays the contents of the operand on the second line (the message part) of the keystation screen. State- ments following the ALARM statement are not executed, and the operator must either correct or bypass the field. Examples of the ALARM statement: ALARM "FINAL PRICE NOT OK"' CONNECT "BATCH OUT OF BALANCE, DIFF=" TO X01 GIVING X02, ALARM X02, 3.7.1.2 A_L_L_O_W_ _a_n_d_ _D_I_S_A_L_L_O_W_ _S_t_a_t_e_m_e_n_t_s_. The ALLOW and DISALLOW statements check current field for specific values, the ALLOW statement spec ifies allowable values, and the DISALLOW statement specifies in- correct values. The syntax for these statements is either: ALLOW + numeric constant + numeric constant - - DISALLOW nonnumeric constant nonnumeric constant or ALLOW DISALLOW DISC table name In the second form of the ALLOW/DISALLOW statement table name is a name which identifies the table in the library of core tables (the DISC option is not used) or in the library of DISC tables (the DISC option is used). The table may be either single or mul- tiple entried. Current field is checked against the table arguments. \f The type of the constants following the word ALLOW or DISALLOW, or the type of table arguments must correspond with the type of current field. The methods for comparing numeric and nonnumeric operands are described in Sections 3.6.1.1 and 3.6.1.2. In the ALLOW statement, if the contents of the current field are not one of the specified values, the statements following the ALLOW statement are not executed, and the operator must correct or bypass the field. In the DISALLOW statement, if the contents of the current field are one of the specified values, the statements following the DISALLOW statement are not executed, and the operator must correct or bypass the field. Examples of the ALLOW and DISALLOW statements: ALLOW "HANSEN" "JENSEN", ALLOW 0 125 512, ALLOW CTABL' where CTABL is the name of a CORE table ALLOW "A" "ST" "XYZ", DISALLOW DISC TAB01, where TAB01 is the name of a DISC table DISALLOW -2 -1 0 +1 +2, 3.7.1.3 C_O_M_P_U_T_E_ _S_t_a_t_e_m_e_n_t_. The COMPUTE statement is used for arithmetic calculations. The syntax of the COMPUTE statement is: current field name COMPUTE current field name (subscripts) = arithmetic expression register register (subscripts) The expression is evaluated (see Section 3.5) and the result is stored in the operand preceding the equal sign. The current field is allowed as destination only if it is a not keyed field and numeric in type. Please note that nonnumeric operands containing only digits and fill characters may be entered in expressions by converting them to numeric types with the conversion operator NUMERIC. \f Examples of the COMPUTE statement: COMPUTE A1 =0 COMPUTE X01 = X01 + PRICE, COMPUTE MONTH = DATE(3) * 10 + DATE (4) COMPUTE X01(1) = F1, COMPUTE X01(2) = X04(5), COMPUTE FLD = FLD + 1, COMPUTE X03 = NUMERIC X02 + 1, COMPUTE X01 (6:7) = F1 (8:9), N_o_t_i_c_e_: The second example of the COMPUTE statement shows how you can make a total of a field (named PRICE) in a register. Each time PRICE is keyed the statement shown is executed and at the end of the registration it will hold the total. 3.7.1.4 C_O_N_N_E_C_T_ _S_t_a_t_e_m_e_n_t_. The CONNECT statement is used to connect two items and to store the resulting character string. The syntax of the CONNECT statement is: field name field name current field name (subscripts)field name (subscripts)field CONNECT registerTOregisterGIVINGname register (subscripts)register (subscripts)register constant constant The operands preceding and following the word TO are concatenated in left-to-right order. The resulting character string is stored in the operand following the word GIVING. Current field is only allowed as destination if it is a not keyed field and nonnumeric in type. The source operands can be either numeric or nonnumeric; if an operand is numeric it is interpreted as a nonnumeric char- acter string. Examples of CONNECT statements: CONNECT A TO B GIVING X01, where A = "ABC" and B = "DEF" causes X01 = "ABCDEF". CONNECT "AMOUNT = " TO A1 GIVING X01, where A1 = 512 causes X01 = "AMOUNT = 512" CONNECT FLD TO " GIVING X01, where the lengths of FLD and X01 are equivalent, causes X01 = contents of FLD. If FLD is numeric in type this construction may be usesd to convert the contents of FLD from numeric to nonnumeric type. \f CONNECT "" TO X01 GIVING X01, This construction will shift the contents of X01 one position to the right and a space will be stored in the first position of X01. 3.7.1.5. D_E_F_I_N_E_ _S_t_a_t_e_m_e_n_t_. The DEFINE statement is used to define the length of a register in character positions. The syntax of the DEFINE statement is: DEFINE register numeric constant The numeric constant defines the register length in character positions. The upper limit for the register length is 255 char- acter positions, but to conserve storage the register size should be as small as possible. The length of a register must be defined by a DEFINE statement before the register is used in any other statement, or before the register is used in connection with automatic duplication, insertion or incrementation (i.e., kind = D, C, or 1). It is only allowed to redefine a register, if it is equivalent in length to the first definition. Example of the DEFINE statment: DEFINE X01 1, N_o_t_i_c_e_: The pseudo-registers mentionned in section 3.3.2 are pre-defined. The define statement is only used for defining registers named X01 - X99. 3.7.1.6 D_I_S_P_L_A_Y_ _S_t_a_t_e_m_e_n_t_. The DISPLAY statement is used to display operator information on the message part of the keystation screen. The syntax of the DISPLAY statement is: nonnumeric constant register DISPLAY register (subscripts) field name field name (subscripts) The DISPLAY statement displays the contents of the operand on the second line (message part) of the keystation screen, and it will be displayed until some other message to the second line occurs. The display statement can be used for simple fill-in-the-blanks keying and for debugging format programs by displaying register contents. \f Examples of the DISPLAY statement: DISPLAY "KEY YOUR INITIALS", DISPLAY X01, 3.7.1.7 D_U_P_ _s_t_a_t_e_m_e_n_t_. (Not yet available) The DUP statement is used to simulate activation of the DUP control key. The syntax of the DUP statement is: DUP numeric constant FIELDS The numeric constant defines the number of following Constant, Duplication, and Incrementation fields to be created as if the DUP control key was activated. If the number of fields referenced to a field beyond the record a runtime error will occur as will be the result if a Keyed field is encountered before the speci- fied number of fields have been treated. Otherwise the statements following the DUP statement are not executed and the action specified by the statement is performed. Examples of DUP statement: DUP 1 FIELD IF FLD = X01 THEN DUP 3 FIELDS, N_o_t_i_c_e_: If an error, calling upon operator intervention, occurs before the number of fields have been treated then the action specified by the DUP statement is interrupted and a message will be displayed on the key staton display screen as would be the case if the DUP key had been pressed the same number of times as specified by the statement. 3.7.1.8 E_N_D_ _S_t_a_t_e_m_e_n_t_. The END statement is used to terminate a format or a subprogram. It must physically be the last statement of the format or the subprogram. The syntax of the END statement is: END 3.7.1.9 E_N_D_ _S_U_B_F_O_R_M_A_T_ _S_t_a_t_e_m_e_n_t_. The END SUBFORMAT statement is used to terminate any subformat except the last subformat, which is terminated by the END statement. When required, the END SUBFORMAT statement must physically be the last statement in the subformat. The syntax of the END SUBFORMAT statement is: END SUBFORMAT \f 3.7.1.10 G_O_T_O_ _S_t_a_t_e_m_e_n_t_. The GOTO statement is used to transfer control from one part of the program (that is, a field program or a sub- program) to another statement in the same program. The syntax of the GOTO statement is: GOTO label A statement may be labeled by assigning it a name followed by a colon (additional labels are allowed). The label is used in a GOTO statement to pass control to the statement after the label. Labels must be defined within the program that contains the ref- erence to the label, and a GOTO statement cannot reference a label in another program. Examples of labels and the GOTO statement: IF X01 0 THEN GOTO ERROR, - - ERROR: ALARM "BATCH OUT OF BALANCE", AGAIN: IF X01 =0 THEN GOTO NEXT, COMPUTE X01 = X01 - 1, - GOTO AGAIN, - NEXT: 3.7.1.11 L_I_M_I_T_ _S_t_a_t_e_m_e_n_t_. The LIMIT statement is used to check current field against a range of values. The syntax of the LIMIT statement is: LIMIT + numeric constant + numeric constant - - The LIMIT statement is only allowed if current field is numeric in type. The second value must be greater than or equal to the first value. The range includes the smallest and the largest value. If the check falls, the statements following the LIMIT statement are not executed, and the operator must either correct or bypass the field. \f Examples of the LIMIT statement: LIMIT 1000 5000, LIMIT -500 999, LIMIT -510 -509, LIMIT -1 11, LIMIT 0 0, 3.7.1.12 M_O_V_E_ _S_t_a_t_e_m_e_n_t_. The MOVE statement is used for moving nonnumeric data from one place to another, such as from one field to another The syntax of the MOVE statement is: field namecurrent field name field name (subscripts) current field name (subscripts) MOVE nonnumeric constantTO register registerregister (subscripts) register (subscripts) The operand preceding the word TO is moved to the operand follow- ing the word TO. Both operands must be nonnumeric in type. Current field name is only allowed as destination if it is a not keyed field. Examples of the MOVE statement: MOVE "TEXT" TO X02, MOVE X01(1) TO FLD1(3), MOVE X03 TO FLD4, MOVE FLD(1) TO FLD(2), 3.7.1.13 N_O_T_E_ _S_t_a_t_e_m_e_n_t_. The NOTE statement is used to write a commentary which is shown on the source listing but is not used in the syst- em. The syntax of the NOTE statement is: NOTE character string The system ignores the character string following the word NOTE up to the first comma or semicolon. Observe the following rules about the NOTE statement: 1. The character string may contain any characters including those not in the format language character. 2. The character string may proceed through more than one line. \f 3. If quotation marks are used in the character string they must occur in pairs on a line. 4. The NOTE statement must not be the last statement before ELSE (because there is no comma or semicolon before ELSE, see Section 3.7.2.1 about the IF statement). 5. The character string may contain any reserved name. 6. The character string may be empty. Examples of the NOTE statement: NOTE CHECK DATE, NOTE THIS FIELD CONTAINS THE SALES PRICE, NOTE IF X01 '0 THEN FIELD 1 IS CORRECT, NOTE "JENSEN" IS AN INVALID NAME, NOTE "JENSEN" IS AN INVALID NAME. BUT "HANSEN" IS OK; NOTE, N_o_t_i_c_e_: A field program must not end with a label, because labels are preceding statements. If a label is wanted at the end of a field program, a NOTE statrement with an empty character string may be used as last statement. 3.7.1.14 P_E_R_F_O_R_M_ _S_t_a_t_e_m_e_n_t_. A PERFORM statement is used to pass control from a field program to a subprogram, or from one subprogram to another subprogram. The syntax of the PERFORM statement is: PERFORM subprogram name The subprogram name must be in the subprogram library (see Sect- ion 5.2). Return from the subprogram is made to the statement following the PERFORM statement. The PERFORM statement may occur as the last statement in a field program, in which case further statements are not required. See further in Section 3.8 about subprograms. An example of a PERFORM statement is: PERFORM CHE10, \f 3.7.1.15 S_E_A_R_C_H_ _S_t_a_t_e_m_e_n_t_. The SEARCH statement is used to search a table for a specified argument and if the search is successful, to stor the function(s) of the argument, otherwise if the search is unsuccessful, to perform a specific action. The syntax of the SEARC statement is: field name field name (subscripts) SEARCHregister IN DISC table name register (subscripts) constant * current field name GIVING current field name (subscripts) register register (subscripts) AT END unconditoinal statement Table name identifies the table in the library of the core tables (the DISC option is not used) or in the library of DISC tables (the DISC option is used). The table must not be single-entried. Using the operand following the word SEARCH the table is searched for a match against the arguments of the table. If the search is successful, the function(s) of the argument which matched will be stored in the operand(s) following the word GIVING, and the unconditional statement following AT END will not be executed. Double-entried core-tables can only contain one function per argument, i.e. only one operand must be specified following the word GIVING. If the table is a disc-table with more than one function per argument then as many operands as the number of functions per argument must be specified following the word GIVING. The first function corresponding to the argument will then be stored in the first operand specified, the second function in the second oper- and specified etc. To prevent unwanted functions from being stored, an asterisk may be specified instead of one or more operands following the word GIVING. The place of an asterisk among the operand(s) defines the\f unwanted function(s). If the search is unsuccessful, control is transferred to the uncon- ditional statement following the words AT END, and the operand(s) after the word GIVING will not be changed. The source operand must be of the same type as the table argu- ments. Current field is only allowed as destination if it is a not keyed field, and if it is of the same type as the table functions. Examples of the SEARCH statement: SEARCH CUSNO IN CTABL GIVING X01 AT END ALARM "CUSTOMER NUMBER NOT KNOWN", SEARCH FLD1 IN ATABL GIVING FLD4 AT END GOTO ERROR, SEARCH FLD(1) IN ATABL GIVING X01 AT END COMPUTE X01 = 0, SEARCH ART NO IN DISC ARTTB GIVING * X01 X13** AT END ALARM "ARTICLE NUMBER NOT KNOWN", NOTE ONLY 2ND AND 3RD ARGUMENT OUT OF 5 ARE STORED, SEARCH CUSNO, IN CTABL GIVING* AT END ALARM "CUSTOMER NUMBER NOT KNOWN", N_o_t_i_c_e_: If the search is unsuccessful no value is stored in the destination operand(s). 3.7.1.16 S_E_L_E_C_T_ _S_t_a_t_e_m_e_n_t_. The SELECT statement is used to change subformat under program control. The syntax of the SELECT statement is: SELECT SUBFORMAT subformat name The SELECT statement may appear only in the last field program in a subformat. The statements following the SELECT statement are not executed, and the subformat change is made. Examples of the SELECT statement: SELECT SUBFORMAT 2, IF X01 = 0 THEN SELECT SUBFORMAT E, \f 3.7.1.17 S_E_T_ _S_t_a_t_e_m_e_n_t_. The SET statement is used to set the field status to valid or invalid. The syntax of the SET statement is: SET field name VALID INVALID The validity flag of the specified field is set valid or invalid, based upon the selected option. Examples of the SET statement: SET FLD1 VALID, IF TOTAL ' X01 THEN SET A INVALID, N_o_t_i_c_e_: The field status will n_o_t_ be replayed, i.e. once a field status is changed (in)valid it is treated as if it was (in)valid. 3.7.1.18 S_K_I_P_ _S_t_a_t_e_m_e_n_t_. The SKIP statement is used to make an automatic skip to a forward field. The syntax of the SKIP statement is: SKIP numeric constant FIELDS The numeric constant defines the number of fields to be skipped, which must be greater than 0. If the number of fields reference to a field beyond the record a runtime error will occur, other- wise the statements following the SKIP statement are not executed and the skip action is performed. The skipped fields are filled with fill characaters and their field programs are not executed. Examples of the SKIP statement: SKIP 1 FIELD, IF FLD ' 10 THEN SKIP 2 FIELDS, 3.7.2 C_o_n_d_i_t_i_o_n_a_l_ _S_t_a_t_e_m_e_n_t_ 3.7.2.1 I_F_ _S_t_a_t_e_m_e_n_t_. The IF statement is a conditional statement. It is used to make a path through the field program, depending on the result of the evaluation of the specified condition. The syntax of the IF statement is: IF condition THEN sentence ELSE sentence The condition following the word IF is evaluated. The the con- dition is true, the sentence following the word THEN is executed. Control is then passed to the next statement after the\f IF statement, unless the sentence contains a GOTO statement, in which case control is passed to the GOTO label. If the condition is false, the sentence following THEN is skipped and the sentence following the word ELSE is executed, or, if the ELSE option is omitted, the next statement after the IF statement is executed. The IF statement may occur as last statement in a field program, in which case no following statement is required. A sentence contains one or more statements, separated by a semi- colon, and terminated with a comma or the word ELSE. A sentence following the word THEN may contain any statement except a conditional statement. A sentence following the word ELSE may contain any statement including a conditional statement. N_o_t_i_c_e_: 1. Neither comma nor semicolon is allowed immediately before the word ELSE. 2. A sentence following the word THEN is terminated when the word ELSE or a comma is encountered. 3. A sentence following the word ELSE is terminated when the first comma is encountered. Examples of the IF statement: IF NOT (TOTAL = X04) THEN "ALARM TOTAL PRICE NOT OK" ELSE DISPLAY "END OK", IF X01 '0 THEN COMPUTE X02 = X02 + A; COMPUTE X01 = X01 - 1, IF X01 X02 THEN COMPUTE X02 = X02 - A ELSE COMPUTE X02 = X02 + A; COMPUTE X03 = X03 - 1, IF A ' B THEN GOTO C, NOTE NEXT STATEMENT CHECKS IF A PREVIOUS (NUMERIC) FIELD ONLY CONSISTS OF FILL CHARACTERS (I.E. HAS BEEN SKIPPED), IF ALPHANUMERIC FLD5 = "******" THEN SKIP 2 FIELDS,\f 3.8 Subprograms A subprogram is a program that is called from another program, by using the PERFORM statement. Control is transferred to the first statement in the subprogram, and returned to the calling program by the END statement in the subprogram. 3.8.1 S_t_a_t_e_m_e_n_t_s_ _I_n_ _S_u_b_p_r_o_g_r_a_m_s_ The statements allowed in subprograms are: ALARM (field name not allowed as operand) ALLOW (the DISC table option is not allowed COMPUTE (field names not allowed as operands) CONNECT (field names not allowed as operands) DEFINE DISALLOW (the DISC table option is not allowed) DISPLAY (field name not allowed as operand) DUP END GOTO IF (validity condition and field names as operands are not allowed) LIMIT MOVE (field names not allowed as operands) NOTE PERFORM SEARCH (the DISC table option is not allowed) SKIP N_o_t_i_c_e_: 1. A subprogram must end with an END statement. 2. A subprogram cannot call itself in a PERFORM statement. 3.8.2 O_p_e_r_a_n_d_s_ _I_n_ _S_u_b_p_r_o_g_r_a_m_s_ Only registers and constants are allowed as operands in state- ments in subprograms. The register names refer to the same regis- ters as in the field programs, and a register may be used both in field programs and in subprograms. Registers are used for transferring data to and from subprograms, as the format language contains no possibilities of defining sub- programs with parameters. \f Example: Consider a problem, where you want a check-digit control in a numeric field. You program the check in a subprogram, for example C0001 CHECK-DIGIT CONTROL - X01 = CUSTOMER NUMBER IF ((X01 (1) * 5 + X01 (2) * 4 + X01 (3) * 3 + X01 (4) * 2 + X01 (5) * 1) MOD 11 ' 0 THEN ALARM "INCORRECT CUSTOMER NUMBER", END, The corresponding field program may look as follows: CUSNO 5 ON 1 COMPUTE X01=CUSNO, PERFORM C0001, \f 4 EXECUTION OF FORMAT PROGRAMS 4.1 Selecting Subformat After invoking a format the system is set ready to execute the first subformat. The same subformat is run through cyclically until a new sub- format is selected. A subformat can be selected manually by using the SUBFORMAT con- trol key, or it can be program-selected by execution of a SELECT SUBFORMAT statement. 4.2 Terminating a Format Program A format program is terminated by executing an END statement. 4.3 Execution of Subformats The field descriptions in a subformat are executed sequentially. After the initial sequential execution of all field descriptions in a subformat follows a cyclical repetition starting with the subformat's first field description, and so on. This sequential process can be interrupted by a SKIP statement, or by using the RECORD RELEASE or the FIELD BACK control key. By using the SKIP statement the execution of one or several sub- sequent field descriptions in a subformat can be skipped. Pressing the RECORD RELEASE control key will cause the remaining field descriptions of a subformat to be skipped, provided this is allowed - see Section 4.4.6. Pressing the FIELD BACK control key will cause a backward step in the field sequence of a subformat - though not beyond the current record. 4.4 Execution of a Field Description The execution of a field description is dependent on the field definition, the field input and previous skip instructions. There is a number of possible alternatives: \f * The field is a KEYED field. * The field is an AUTOMATIC field. * The field is a NOT KEYED field (including 0-length fields). * The field has been skipped by a SKIP statement. * The field has been skipped by the ENTER key, i.e., no data input * The field has been skipped by the RECORD RELEASE key. * The field has been skipped by the BYPASS key. 4.4.1 K_e_y_e_d_ _F_i_e_l_d_s_ If a field is keyed (i.e. kind = K), the following steps will be executed in the named order: * Right/left justification and insertion of fill characters. * Length check. * Minimum length check. * Type check. * Execution of the field program. 4.4.2 A_u_t_o_m_a_t_i_c_ _F_i_e_l_d_s_ There are three kinds of automatic fields: DUPLICATE fields (i.e. kind = D), CONSTANT fields (i.e. kind = C), INCREMENT fields (i.e. kind = 1). 4.4.2.1 D_u_p_l_i_c_a_t_e_ _F_i_e_l_d_s_. Two possibilities are open: 1. Keying the field; 2. Duplicating the field. Keyed fields are executed as specified in 4.4.1. Subsesquently, * the field's contents are transferred to the register defined in the field definition. Un equal length of field and register cause a runtime error. Pressing the DUPLICATE control key will cause the following to happen: \f * The contents of the register specified in the field description are transferred to the field. Un equal length of field and register cause a runtime error. * A typecheck is performed. * Execution of the field program. * The contents of the field are transferred to the corresponding register. 4.4.2.2 C_o_n_s_t_a_n_t_ _F_i_e_l_d_s_. There are two possibilities: 1. Keying the field; 2. Duplicating the field. Keyed fields are executed as specified in 4.4.1. Pressing the DUPLICATE control key will result in the field being executed as a DUPLICATE field, cf. 4.4.2.1. The contents of the field will n_o_t_ be transferred to the register after the execution of the field program. 4.4.2.3 I_n_c_r_e_m_e_n_t_ _F_i_e_l_d_s_. There are two possibilities: 1. Keying the field; 2. Duplicating the field. Keyed fields are executed as specified in 4.4.1. Subsequently, * the field's contents are transferred to the register defined in the field definition. Unequal length of field and register cause a runtime error. Pressing the DUPLICATE control key will have the following result: * The contents of the register specified in the field definition are transferred to the field. Unequal length of field and reg- ister cause a runtime error. * The field is incremented by 1. \f * A typecheck is performed. * Execution of the field program. * The contents of the field are transferred to the corresponding register. 4.4.3 N_o_t_ _K_e_y_e_d_ _F_i_e_l_d_s_ NOT KEYED fields are fields with kind = N or length = 0. Such fields will have not input during registration. The following is performed: * Insertion of fill characters. * Execution of the field program. 4.4.4 F_i_e_l_d_s_ _S_k_i_p_p_e_d_ _b_y_ _S_K_I_P_ If a field is skipped by using the SKIP statement, the following will occur: * Insertion of fill characters. * No execution of the field program. * Register corresponding to duplicate or increment fields will n_o_t_ be updated. 4.4.5 F_i_e_l_d_s_ _S_k_i_p_p_e_d_ _b_y_ _E_N_T_E_R_ If a field is bypassed by simply pressing the ENTER key, the foll- owing will occur: * Minimum length check, i.e. if minimum length is greater than zero, and error message appears and the field has to be keyed. Otherwise, the following is performed: * Insertion of fill characters. * No execution of the field program. * Registers corresponding to duplicate or increment fields will n_o_t_ be updated. 4.4.6 F_i_e_l_d_s_ _S_k_i_p_p_e_d_ _b_y_ _R_E_C_O_R_D_ _R_E_L_E_A_S_E_ Fields skipped by pressing the RECORD RELEASE key will be executed in accordance with the field's definition. 4.4.6.1 F_i_e_l_d_s_ _w_i_t_h_ _K_i_n_d_ _K_E_Y_E_D_,_ _D_U_P_L_I_C_A_T_E_,_ _C_O_N_S_T_A_N_T_,_ _I_N_C_R_E_M_E_N_T_. Fields with kind KEYED, DUPLICATE, CONSTANT, INCREMENT are executed as fields skipped with ENTER (see Section 4.4.5). \f * If the minimum length of the field is not zero, an error mess- age appears, and the field must be keyed. Subsesquently, RECORD RELEASE is stopped, and normal execution is resumed in KEY, REKEY, or EDIT mode. 4.4.6.2 F_i_e_l_d_s_ _w_i_t_h_ _K_i_n_d_ _N_O_T_ _K_E_Y_E_D_. If the skipped field is of the NOT KEYED kind the following will happen: * Insertion of fill characters. * Execution of the field program. 4.4.7 F_i_e_l_d_s_ _S_k_i_p_p_e_d_ _b_y_ _B_Y_P_A_S_S_ The BYPASS control key is used to bypass fields that one has given up keying correctly. * The field will retain the contents it had before activating the BYPASS key, if the field has been keyed. * The field program is not executed. * Registers corresponding to duplicate and increment fields are n_o_t_ updated. 4.4.8 E_x_e_c_u_t_i_o_n_ _o_f_ _a_ _F_i_e_l_d_ _P_r_o_g_r_a_m_ The statements in a field program are executed sequentially. The whole field program is executed. However, any error detected through ALLOW, DISALLOW, or LIMIT, as well as execution of an ALARM, DUP, SKIP, or SELECT statement will cause the field pro- gram to be interrupted after such a statement. The sequential processing of a field program can be interrupted by a GOTO statement. 4.5 Field Flags During exeuction of a field description the field is assigned two flags, which are independent of each other. They are: Validity flag Skipped flag. 4.5.1 V_a_l_i_d_i_t_y_ _F_l_a_g_ This flag has two values: VALID INVALID \f An INVALID flag is assigned to a field which * is skipped by the BYPASS key, or * is set INVALID by a SET statement, or * is a "NOT KEYED" field containing an error, or * is a keyed field containing an error, that has not yet been corrected. In other cases the field gets a VALID flag. If a field in a record has an INVALID flag, the record will also get an INVALID flag. You may ask for a field's validity flag in an IF statement. 4.5.2 S_k_i_p_p_e_d_ _F_l_a_g_ This flag has three values: NOT SKIPPED SKIPPED SKIPPED BY STATEMENT A SKIPPED flag is given to a field which * is skipped by the ENTER key, or * is skipped by the BYPASS key, or * is skipped by the RECORD RELEASE key. A SKIPPED BY STATEMENT flag is given to a field which * is skipped by the SKIP statement. Otherwise, the field gets a NOT SKIPPED flag. We say the field is skipped if it has a SKIPPED flag or a SKIPPED BY STATEMENT flag and the field program is n_o_t_ executed. 4.5.3 F_l_a_g_s_ _f_o_r_ _R_E_K_E_Y_ For fields specified as "REKEY YES" the flags in REKEY mode are set as for KEY mode when the fields are rekeyed. A field speci- fied as "REKEY NO" gets normally the same flags as the corres- ponding old field. But depending on the old field flags for "REKEY NO" fields some special actions occur: If the old field validity flag is INVALID, the old field is not used as field input but an error message appears and the field must be keyed as if it were specified as "REKEY YES". \f If the old field skipped flag is SKIPPED BY STATEMENT and the field will not again be skipped by the SKIP statement, an error message appears and the field must be keyed as if it were speci- fied as "REKEY YES". 4.5.4 F_l_a_g_s_ _f_o_r_ _E_D_I_T_ When fields are keyed in EDIT mode the flags are set as for KEY mode. When searching in EDIT mode the fields are normally given the same flags as the corresponding old fields. But depending on the old field flags some special actions occur: If the old field validity flag is INVALID, the old field is not used as input, but the searching stops with an error message. If the old field skipped flag is SKIPPED BY STATEMENT and the field will not again be skipped by the SKIP statement, the old field is not used as input, but the searching is stopped with an error message. 4.6 Registers Registers may be assigned directly in the field program, or indir- ectly when used for automatic fields (kind: duplicate or increment. In the latter case the field is not transferred to the register until after execution of the field program, so that the contents of the register will be e_x_a_c_t_l_y_ the same as the contents of the field. 4.7 Replay When the format program is executed during keying, the format is said to be "playing" the batch. The format execution sesquence and the contents of the registers may be dependent on what is keyed. Therefore, a register of which the contents are affected by what is keyed must be changed whenever the field affecting it is changed. To revise the register contents and bring them up to date, the entrie batch must be "replayed" from start up to the point where the change is made. To save time during replay pict- ures of the registers are frequently saved in the batch, and the replay is actually performed from the nearest preceding register picture. \f Replay occurs: * when the RECORD BACK key is used. * when the FIELD BACK key is used. * when the CLEAR key is used. * when the SUBFORM key is used. * when the RECORD key is used. * when an error is detected during format program execution and a register has been changed in the format program. * when keying or rekeying is reopened after the ESCAPE key has been used. Be aware that the status of fields will not be replayed. 4.8 Execution of IMAGE The execution of the format image belonging to a given format is given by the execution of the format itself. In selecting subformat the corresponding subformat image is auto- matically used. If a subformat image consists of only one page, the fill-in-the- blanks mask will be replaced during the run of the subformat. This replacement occurs as each new page is specified in the field definitions.\f 5 ENTERING NEW FORMATS, SUBPROGRAMS, AND TABLES The keying of new formats, subprograms, or tables is controlled by a standard format. The result is a batch, which can be edited, saved, listed, etc., in the same way as with all other batches in the Data Entry system. Before entering new formats or subprograms in the system all ref- erenced subprograms and tables must have been entered. The entering of formats, subprograms, and tables is guided by the supervisor program TRANSLATE, with the exception of DISC tables which are treated separately. TRANSLATE controls if the source batch is correctly structured and, if so, translates it into internal form. The name of the translated file is then included in the current library, after which the new format, or subformat, or table, can be referenced by its name. 5.1. New Formats The format text of the coding shetts is keyed under the control of the standard format FORM. The keying of tags written on complementary coding sheets is controlled by the standard format IMAGE. Both standard formats support fill-in-the-blanks guidance. The FORM standard format contains 3 subformats (see Appendix IV): H - reads subformat head belonging to the new format; F - reads field description belonging to the new format; E - terminates the batach (format text). The format coding sheets are interpreted by FORM in the following way: \f 1st subformat is H - read by H automatic selection of F - read by F - read by F - read by F automatic selection of H - read by H automatic selection of F - read by F - read by F - read by F automatica- lly termin- ated by E * Such automatic selection of subformats is performed only if this statement is indicated exactly as above, meaning that the statement must begin in the 1st position in column 15, that there must be one, and only one, space between END and SUB- FORMAT, and that the words SUBFORMAT and END must be immedia- tely followed by a comma. Subformat H contains 5 field descriptions, which check the following: \f 1. FORMAT NAME (AN) The first character of the FORMAT NAME must be a letter from "A" - "Z": 2. SUBFORMAT NAME (AN) must be a letter from "A" - "Z" or a digit. 3. PROTECTED (A) "Y", "N", or "" 4. COMMENT (AN) No check. 5. Field description No check; automatic selection of sub- (not keyed field) format F. Subformat F contains 16 field descriptions, with the first 15 receiving input from the columns of the format coding sheets, while the 16th is a not keyed (0-length) field for consistency checks of the first 15 field descriptions. The following checks are performed. 1. FIELDNAME (AN) The first character of FIELDNAME must be a letter from "A" -"Z", or FIELD- NAME = "". 2. PAGE (N) When PAGE is keyed as SPACE ENTER two field descriptions are automatically skipped (that is, neither PAGE nor LINE or POSITION are specified); else the following checks are made: PAGE must be a number from 1 to 8, and must, further- more, be greater than or equal to the last defined PAGE of the current subfor- mat. 3. LINE (N) LINE Is a number from 1 to 21. 4. POSITION (N) POSITION is a number from 1 to 80. 5. LENGTH (N) When LENGTH is defined as 0 (zero) or as a SPACE ENTER' an automatic skipping occurs to the 15th field description (PROGRAM STATEMENTS); else the following check is made: LENGTH must be a number from 1 to 80. 6. MIN. LENGTH (N) When LENGTH is defined as 0 (zero) or\f equal to LENGTH, and has to be a number from 0 to 80. 7. TYPE (A) "N", "SN, "SS", "AN", or "A". 8. OUTPUT POSITION (N) OUTPUT POSITION is a number from 0 to 255. 9. R/L (A) "L", "R", or "" 10. FILL (AN) "", "0", or "*" 11. REKEY (A) "Y", "N", or "" 12. DISPLAY (A) "N", "Y", or "" 13. KIND (A) "", "D", "C", "I", "N" or "K"; furthermore, TYPE must be N", if KIND = "1". 14. REGISTER (N) REGISTER is a number from 1 to 99. 15. PROGRAM STATEMENTS No checks. (AN) 16. Field description If LENGTH = "", or LENGTH = 0: only (not keyed field) PROGRAM STATEMENTS may be specified. The following applies if LENGTH '0: - Either PAGE, LINE, and POSITION are all specified, or none of them. - MIN.LENGTH, TYPE, and OUTPUT POSITION are all specified, or none of them - If REGISTER is n_o_t_ specified, then KIND is either "N", "K", or "". - If REGISTER is specified, then KIND is either "C", <"D", or "I". When PROGRAM STATEMENTS start with "END SUBFORMAT,", subformat H is automatically selected. When PROGRAM STATEMENTS start with "END,", subformat E is automatically selected. Subformat E consists of one field description, with a field definition describing a not keyed (0-length) field, and the field program is solely an END statement.\f In addition to normal error messages (length, type, limit, etc.),the following alarm texts may appear when using the standard format FORM: From subformat. Column CURRENT PAGENO LESS THAN PREVIOUS PAGENO F.2 ERROR IN CHECKBOX CONTENTS F.16 ILLEGAL FIELD NAME F.1 ILLEGAL FORMAT NAME H.1 ILLEGAL SUBFORMAT NAME H.2 KIND "1" ONLY ALLOWED IF TYPE = "N" F.13 MIN.LENGTH GREATER THAN FIELD LENGTH F.6 The standard format IMAGE contains 3 subformats (see Appendix IV). H - reads subformat head belonging to the new format image; F - reads tag description; E - terminates batch (format image text). The format image coding sheets are interpreted by IMAGE in the following way: \f 1st subformat is H - read by H automatic selection of F - read by F - read by F - read by F manual selec- tion of H - read by H automatic election of F - read by F - read by F - read by F manual selec- tion of E ter- minates the batch Subformat H contains 4 field descriptions, where the following checks are made: 1. FORMATNAME (AN) The first character of the FORMAT-NAME must be a letter from "A" to "Z". 2. SUBFORMAT NAME (AN) Is a letter from "A" to "Z", or a digit. 3. COMMENT (AN) No check. 4. Field description No check; automatic selection of subfor- (not keyed field) mat F.\f Subformat F contains 4 field descriptions, where the following checks are made: 1. PAGE (N) PAGE must be a number from 1 to 8, and must, furthermore, be greater than or equal to the last defined PAGE of the current subformat. 2. LINE (N) LINE is a number from 1 to 21. 3. POSITION (N) POSITION is a number from 1 to 80. 4. TEXT (AN) No check. Subformat E consists of one field description, with a field defin- ition describing a not keyed (0-length) field, and the field pro- gram is solely an END statement. In addition to normal error messages (length, type, limit, etc), the following alarm texts may appear when using the standard format IMAGE: From subformat. Column CURRENT PAGENO LESS THAN PREVIOUS PAGENO F.1 ILLEGAL FORMAT NAME H.1 ILLEGAL SUBFORMAT NAME H.2 When the created batches are considered to be correct, translation of the format is initiated by activating the supervisor program TRANSLATE (see Users Guide): TRANSLATE FORM form-batch image-batch Remember that all referenced subprograms and tables must be known to the system before starting the format translation. Once the format is translated they are no longer needed. When the format has been correctly translated, the format name is included in the format library.\f 5.2 New Subprograms The subprogram text of the coding sheets is keyed under the con- trol of the standard format SUBPR. The standard format supports fill-in-the-blanks guidance. The SUBPR standard format contains 3 subformats (see Appendix IV): H - reads subprogram head; P - reads a part of a subprogram; E - terminates the batch (subprogram text). The subprogram coding sheets are interpreted by SUBPR in the following way: 1st subformat is H - read by H automatic selection of P - read by P - read by P - read by P automatically terminated by E. * Automatic selection of subformats is accomplished only if this statement is indicated exactly as above. That is, the statement should start in the 1st position, and the word END should be immediately followed by a comma. \f Subformat H contains 3 field descriptions, with the following checks to be made: 1. SUBPROGRAMNAME (AN) The first character of the SUBPRO- GRAMNAME must be a letter from "A" to "Z". 2. COMMENT (AN) No check. 3. Field description No check; subformat P is automatic- (not keyed field) ally selected. Subformat P consists of one field description, with the following operation: 1. PROGRAM STATEMENTS (AN) No check; subformat E is automatic- ally selected if PROGRAM STATEMENTS start with "END,". Subformat E consists of one field description, with a field def- inition describing a not keyed (0-length) field, and the field program being solely an END statement. In addition to normal error messages (length, type, limit, etc) the following alarm text may appear when using the standard for- mat SUBPR: From subformat. Column ILLEGAL SUBPROGRAM NAME H.1 When the created batch is considered to be correct, translation of the subprogram is initiated by activating the supervisor pro- gram TRANSLATE (see Users Guide). TRANSLATE SUBPROGRAM subpr - batch Remember that all referenced subprograms and tables must be known to the system before starting translation of the subprogram. Once the translation is finished they are no longer needed. When the subprogram has been correctly translated, it is included in the subprogram library.\f 5.3 New Tables 5.3.1. N_e_w_ _C_o_r_e_ _T_a_b_l_e_s_ The keying of the table text from the coding sheets is controlled by the standard format TABLE. The standard format supports fill- in-the-blanks guidance. The TABLE standard format contains 15 subformats (see Appendix IV): H - reads columns 1 - 6 of table head. M - reads column 7 of table head. T - reads columns 8 - 14 of table head. 1 - reads table element, Single entry table, A-type = N; 2 - reads table element, Single entry table, A-type = AN; 3 - reads table elements, Double entry table, A-type = N, F-type = N; 4 - reads table elements, Double entry table, A-type = N, F-type = AN; 5 - reads table elements, Double entry table, A-type = AN, F-type = N; 6 - reads table elements, Double entry table, A-type = AN, F-type = AN; C - stores a control word (DISC TABLE) in the batch and selects subformat O; O - reads operation and selects subformat S; S - selects subformat A, or N, or O; A - reads disc table element of type AN and selects subformat S; N - reads disc table element of type N and selects subformat S; E - terminates batch (table text). Subformats M,T,C,O,S,A,N, and E which conern disc tables (poss- ibly M_ultiple entry tables) are explained in section 5.3.2. The table coding sheets are interpreted by TABLE in one of the following two ways (see Appendix IV) when the table is a core- table: \f 1. S_ingle entry table 1st subformat is H - read by H automatic se- lection of sub- format 1 or 2 - read by 1 or 2 - read by 1 or 2 - read by 1 or 2 Manual selec- tion of E ter- minates batch. 2. D_ouble entry table 1st subformat is H - read by H automatic se- lection of sub- format 3, 4, 5, or 6 - read by 3, 4, 5, or 6 - read by 3, 4, 5, or 6 Manual selec- tion of E ter- minates batch.\f Subformat H contains 7 field descriptions, with the following checks to be made: 1. TABLENAME (AN) The first character in TABLENAME must be a letter from "A" to "Z". 2. TYPE (A) "S" or "D" or "M" If TYPE = "M" the next four field descriptions are skipped. 3. ARGUMENTTYPE (A) "N" or "AN" (A-TYPE) 4. ARGUMENTLENGTH (N) ARGUMENTLENGTH must be a number (A-LGTH) from 1 to 80. If TYPE = "S" the next two field descriptions are skipped. 5. FUNCTIONTYPE (A) "N" or "AN" (F-TYPE) 6. FUNCTIONLENGTH (N) FUNCTIONLENGTH must be a number (F-LGTH) from 1 to 80. 7. Field description No check; depending on TYPE, ARGU- (not keyed field) MENTTYPE and FUNCTIONTYPE a subfor- mat from 1 through 6 or M is auto- matically selected. Subformats 1 and 2 contain one field description each, with field type being N an AN, respectively - otherwise no check performed. Subformats 3, 4, 5, and 6 contain 2 field descriptions each, with field types being N/N, N/AN, AN/N, and AN/AN, respectively - other- wise no check is performed. Subformat E consists of one field description, with a field def- inition describing a not keyed (0-length) field, and the field program is solely an END statement. In addition to normal error messages (length, type, limit, etc) the following alarm text might appear when using the standard format TABLE: \f From subformat. Column ILLEGAL TABLE NAME H.1 When the created batch is considered to be correct, translation of the table is initiated by activating the supervisor program TRANSLATE (See Users Guide) TRANSLATE TABLE table-batch When the table has been correctly translated, the table name is included in the table library. 5.3.2 D_i_s_c_ _T_a_b_l_e_s_ When using a table with many table elements, it is sometimes nec- essary to set up the table as a disc table. A disc table also features the possibility of up to seven table columns (one argu- ment - six functions) where as a core table can consist of at most two columns. The structure of the table (number of columns, type and length of each column, largest number of entries) is set up with the help of supervisor program CREATE which creates a table consisting of empty entries and which includes the table name in the disc table library. The entering of data to the table is accomplished with the help of supervisor program DISCTABLE. This program checks if the table text is correctly structured, and translates the data into table entries. The translation, during which the entries are stored in a hash-organized way, is usually a time-consuming process, but it will, on the other hand, enable quick checks to be made on the existence of certain elements, even in cases involving very large tables. Please note, that it is possible to insert, update (replace), or to delete, elements in the translated table also with the help of supervisor program DISCTABLE, so as to avoid repeating the entire translation procedure. The table text is either keyed to a batch under the control of the standard format TABLE, or it may be stored on a magnetic tape generated by another computer. The subformats of format TABLE are listed in section 5.3.1, the\f interpretation of the coding sheets takes place in the following way: 1st subformat is H - read by H automatic selection of subformat M - read by M automatic selection of subformat T - read by T. The subformat is automatically reselected up to six times if required (number of functions) automatic selection of subformat O - read by O automatic selection of subformat A or N - read by A or N automatic selection of subformat A or N if following lines contain function(s) - read by A or N subformat A or N is automatically reselected as long as functions follow where upon subfor- mat O is selected - read by O - read by O automatic selection of subformat E.\f Subformat H and E are explained in section 5.3.1 Subformat M contains three field descriptions with the following checks to be made: 1. Field description No check, used for register definition. (not keyed field) 2. NO. OF FUNCTIONS (N) NO. OF FUNCTIONS must be a number from (NO. OF F'S) 0 to 6. 3. Field description No check, used for computations (e.g. (not keyed field) the number of times to execute subformat T); automatic selection of subformat T. Subformat T contains two field descriptions: 1. TYPE (A) "N" or "AN" (A-TYPE; F1,2,3,4,5, 6,-TYPE) 2. Field description No check, used for determining if keying (not keyed field) is to continue under control of this sub- format or if subformat C is to be sel- ected (depends on NO. OF FUNCTIONS). Subformat C consists of one not-keyed field which stores the next "DISCTABLE" in the batch so that compatibility with a magnetic tape (see section 5.3.2) is achieved. Subformat O contains two fields: 1. OPERATION (A) "I" or "J" or "D" or "E" (OP) 2. Field description No check, not keyed (0-length) field (not keyed field) selecting subformat E if OPERATION = "E" or, if not, selecting subformat S. Subformat S consists of one not keyed (0-length) field which selects subformat A or N if entered from O. If entered from A then one of these subformats are reselected if a function is to be read, otherwise subformat O is selected. \f Subformats A and N contain one field description each, with field type being AN and N, respectively - otherwise no check is perfor- med. If the table text is stored on magnetic tape, this must have the following format: The record format of the file must be variable, blocked type (IBM VB format, max. 512 bytes), and the coding of characters must be in accordance with the ASCII or EBCDIC alphabets. The first two records are used for identification: record 1, 5 bytes : table name, fill characters: space. record 2, 9 bytes : the text DISC TABLE. The following records concern the entries of the table. An insertion of a table entry is accomplished by a sequence of 2 - 8 records: record 1, 1 byte: the text 1 record 2, max. 80 bytes : argument of entry record 3, max. 80 bytes : function 1 . . . record 8, max. 80 bytes : function 6 If the table is single-entried then an inserton consists of only two records. If the table is multiple entried, the number of rec- ords following record 2 corresponds to the number of functions per table entry. A table entry is updated (replaced) by supplying the following sequence of 2 - 8 records: record 1, 1 byte: record 2, max. 80 bytes : argument of entry record 3, max. 80 bytes : function 1 . . . record 8, max. 80 bytes : function 6 \f The number of necessary records is as for insertion al a_l_l_ ele- ments of the entry are replaced. A table entry is deleted from the table by a sequence of 2 rec- ords: record 1, 1 byte: record 2, max. 80 bytes : argument of the entry The last record in the file must be a one-byte record containing the text E. The arguments and functions must conform the structure of the table with respect to type and length, see also section 2.3.3. The table text translation is performed by activating the super- visor program DISCTABLE through one of the calls below (see Users Guide): DISCTABLE BATCH.batchname (if the table text is keyed under control of the TABLE format) DISCTABLE MTx.filenumber ASCII (if the table text is stored on magnetic tape in ASCII code; x = tape station no.) DISCTABLE MTx.filenumber EBCDIC (if the table text is stored in EBCDIC code). \f 6 PROGRAMMING HINTS This section describes the special facilities of the system, how they are programmed, and how they work when the finished format is used for keying. 6.1 Screen Processing Screen processing is understood as covering all information given by the format program on the utilization of the screen's data area. The first lines on the screen are always reserved for the system. As an aid to registration it is possible to specify tags, and it is likewise possible to specify the keying position of the single units on the screen. Screen processing, cn, however, also be ent- irely left to the system. 6.1.1 S_c_r_e_e_n_ _P_r_o_c_e_s_s_i_n_g_ _A_s_s_i_g_n_e_d_ _T_o_ _t_h_e_ _S_y_s_t_e_m_ In case one chooses to leave screen processing entirely to the system, the columns PAGE, LINE, and POSITION in the definition sections of a_l_l_ field descriptions are left unkeyed. The system will then utilize the screen in such a way that LENGTH in the definition sections of the field descriptions assigns the number of screen positions that are set aside for keying to the field. - The f_i_r_s_t_ _f_i_e_l_d_ _o_f_ _t_h_e_ _s_u_b_f_o_r_m_a_t_ is keyed in the left most pos- ition of the first data line on the screen. This field is de- fined as the first field on the s_u_b_f_o_r_m_a_t_'_s_ _f_i_r_s_t_ _p_a_g_e_. - If there is sufficient space on the current line, one proceeds to key the n_e_x_t_ _f_i_e_l_d_ on this line, leaving one blank position before the field. - If there is not enough space left on the current line, the n_e_x_t_ f_i_e_l_d_ is keyed on the following line, starting with the left most position. - If there are no more lines available, the next field is keyed from the left most position on the first data line of the screen, which then makes this field the first field on the\f s_u_b_f_o_r_m_a_t_'_s_ _n_e_x_t_ _p_a_g_e_. Previous to keying this field the screen's input section is blanked. E_x_a_m_p_l_e_ _6_._1_._1_ A subformat starts with the following field descriptions: FLD1 10 FLD2 15 FLD3 4 FLD4 75 FLD5 5 Keying positions on the screen will be subsequently appear as follows: STATUS LINE MESSAGE LINE FLD1 FLD2 FLD3 FLD4 FLD5 6.1.2 E_s_t_a_b_l_i_s_h_i_n_g_ _K_e_y_i_n_g_ _P_o_s_i_t_i_o_n_s_ In order to specify where on the screen every single unit of a subformat is to be keyed, the operator fills in: PAGE, LINE, and POSITION in the definition section of the field descriptions. The system will process this information in the following way: - A s_u_b_f_o_r_m_a_t_'_s_ _f_i_r_s_t_ _f_i_e_l_d_ will be keyed from the screen pos- ition specified under LINE and POSITION in the first field description (PAGE is here, as a rule, specified as 1). This field is the first field on the s_u_b_f_o_r_m_a_t_'_s_ _f_i_r_s_t_ _p_a_g_e_. - If PAGE has the same value in the next field description as in the preceding one, the n_e_x_t_ _f_i_e_l_d_ is keyed from the screen pos- ition specified under LINE and POSITION. - If PAGE has a higher value in the next field description than in the preceding one, the screen is blanked, and the next field is keyed starting in the screen position specified under LINE and POSITION. This field is then the first field of the s_u_b_f_o_r_- m_a_t_'_s_ _n_e_x_t_ _p_a_g_e_. \f When planning the keying positions the programmer uses a screen layout form on which he marks out the keying positions and from which the LINE and POSITION values can be read and used when completing the definition sections of the field descriptions. E_x_a_m_p_l_e_ _6_._1_._2_a_ Screen layout: CUSTOMER DATE NO. ARTICLE NO. QUAN- TITY UNIT PRICE AMOUNT Field descriptions: CUSTN 1 2 1 5 DATE 1 2 7 6 ARTIN 1 4 9 6 QTY 1 5 11 4 UPRIC 1 6 9 6 AMOUN 1 7 7 8 Within the same subformat it is possible to combine field descrip- tions with PAGE, LINE, and POSITION filed out, with not completed field descriptions. Thus, if the system encounters a field description where no infor- mation is given, the keying positions will be calculated according to the formula presented in Section 6.1.1. Such field descriptions must therefore be adapted to programmer-selected keying positions, bearing in mind that these might cause the system to shift page. The system does not permit overlapping. \f E_x_a_m_p_l_e_ _6_._1_._2_b_ The field descriptions below will give the same result as the field descriptions presented in Example 6.2.2a (now, PAGE, LINE, and POSITION are not filled out in the DATE column). CUSTN 1 2 1 5 DATE 6 ARTIN 1 4 9 6 QTY 1 5 11 4 UPRIC 1 6 9 6 AMOUN 1 7 7 8 6.1.3 D_e_f_i_n_i_n_g_ _T_a_g_s_ Tags are normally specified only in connection with those formats where the keying positions are defined by the programmer himself (see above). Therefore, tags must be coordinated with keying positions, not only as far as the screen positions are concerned, but also with a view to possible page-shifts in the subformat. Every individual tag within a subformat will then be characterized by PAGE, LINE, and POSITION (see IMAGE Coding Sheet, Section 2.1.2). The system utilizes the tag information in the following way: - On selection of a new subformat or a new page within a subformat the screen is blanked and a_l_l_ tags belonging to the new page in the subformat are laid out in their specified screen positions before keying is started to the first field of the page. - When the first field of a subformat is going to be keyed, the keying positions but not the tags will be blanked if last used tags are the same as those belonging to the first page of the subformat. This is, for instance, the case with subformats which contain only one page and are repeatedly executed. When devising tags and establishing their position in relation to the keying positions, the programmer uses the screen layout form.\f E_x_a_m_p_l_e_ _6_._1_._3_a_ Extending Example 6.1.2a to include tags gives the following screen layout: NUMBER DATE CUSTOMER DATE NO. ARTICLE ARTICLE NO. QUANTITY QUAN- TITY PRICE UNIT PRICE AMOUNT AMOUNT Tag specifications: 1 1 1 NUMBER DATE 1 4 1 ARTICLE 1 5 1 QUANTITY 1 6 1 PRICE 1 7 1 AMOUNT E_x_a_m_p_l_e_ _6_._1_._3_b_ This example shows how a format, at the start of registration, can display a screen image which serves as a keying instruction to the operator. The format's first subformat might look as follows: EXAMP 1 N THE SUBFORMAT IS USED AS A GUIDE 1 16 1 1 O AN O SELECT SUBFORMAT 2, END SUBFORMAT, \f matching tags: EXAMP1 GUIDE 1 1 1 FORMAT EXAMP. 1 3 1 THE FORMAT IS USED FOR KEYING INVOICES 1 5 1 SUBFORMAT 1 : SHOWS THIS GUIDE 1 6 1 (MAY BE ACTIVATED DURING KEYING, TOO). 1 7 1 SUBFORMAT 2 : HEAD OF INVOICE, SELECTED BY THE OPERATOR 1 8 1 AT THE START OF A NEW INVOICE. 1 9 1 SUBFORMAT 3 : LINES OF INVOICE, ASUTOMATICALLY SELECTED 1 10 1 AFTER SUBFORMAT 2. 1 11 1 SUBFORMAT 4 : END OF BATCH, SELECTED BY THE OPERATOR 1 12 1 AFTER LAST INVOICE. 1 14 1 PRESS THE ENTER KEY WHEN YOU WANT TO START KEYING. 1 15 1 (THE KEYING WILL START IN SUBFORMAT 2, AUTOMATICALLY). The record that the operator creates when pressing the ENTER key contains only one field, a so-called no-transfer field (OUTPUT POSITION = 0). Such a field will be skipped when the batch is transferred to a main computer. The following final notes on the subject of tags should be added: 1. No tags are attached to a format until the format is entered into the system by activating the supervisor program TRANS- LATE (see Chapter 5). When using this format later on, the operator may, however, at the start of registration, command the registration to be executed without tags. (See Users Guide on Control Commands!) 2. When dealing with subformats that entirely rely on system-est- ablished keying positions, the available space for tags is limited to what might be left of the lower section of the screen. With such subformats, one may use, for example, DIS- PLAY statements as a primitive form of tags. \f 6.2 Reformatting Reformatting means storing the units of a document in a different order than the keying order. Reformatting is done by specifying suitable values for "OUTPUT POSITION" in the definition section of the field descriptions: E_x_a_m_p_l_e_ _6_._2_ A document contains, among others, the following information: date customer no.: article no.: quantity: The information is typed from left to right, but the preferred storing sequence on the record might be the following: Field 1Field 2 Field 3 Field 4 article no. customer no. date quantity The field descriptions are therefore filled out as follows: DATE . . . . . . 3 . . . . . . CUSTN . . . . . . 2 . . . . . . ARTIN . . . . . . 1 . . . . . . QTY . . . . . . 4 . . . . . . The programmer should be careful when specifying output position in order to avoid "gaps" in the subformat (leaving, for example, output position 2 empty, while defining output positions 1 and 3. 6.3 Automatic Insertion 6.3.1 N_o_t_ _K_e_y_e_d_ _F_i_e_l_d_s_ A not keyed field does not require keying, but is assigned its value solely by the program part of the field description. Such fields can be used to insert, for example, constant values, or results of calculations, or the contents of a register, as values in the record. \f E_x_a_m_p_l_e_ _6_._3_._1_ DTYPE 2 2 A 1 N MOVE "AA" TO DTYPE, NOTE TYPE OF DOCUMENT, TOTAL 10 10 N 12 N COMPUTE TOTAL = TOTAL + AMOUNT, DATE 6 6 N 17 N COMPUTE DATE = X05, Note especially the field description "DATE". The register X05 may have been assigned a value at the outset of registration of a specific sequence (typically a subformat that is only used once in a sequence). The date is thereby made available to all sub- formats during registration. One should take care to control that the register is not used for other programs, for instance, appear- ing in "REGISTER" in the definition section of a field descrip- tion. 6.3.2 C_o_n_s_t_a_n_t_ _F_i_e_l_d_s_ A constant field is assigned the value of a register when the operator activates the DUPlicate key. The contents of the regis- ter are initialized by the program part of a field description. When a constant field is executed the first time, it is essential that the register specified in the definition section of the field description be assigned a value prior to execution, or it will not be possible for the operator to press the DUP key. This is frequently done at the start of the registration of a specific sequence in subformats that are executed only once within the sequence. Where the contents of the register are preserved throu- ghout the registation of a sesquence, they may not be used for other purposes. If the operator does not use the DUP key for a constant field, the keying takes place as normal. Such keying does not change the contents of the register. \f E_x_a_m_p_l_e_ _6_._3_._2_ Subformat 1: DATE 6 6 N 1 COMPUTE X02 = DATE, MOVE ' ' TO X03, Subformat 2: DATE 6 6 N 12 C02 CODE 4 1 AN 17 C03 The value of the DATE field in Subformat 2 will be the value reg- istrated in Subformat 1, and the CODE field is filled with spaces when pressing the DUP key at these two fields. 6.4 Automatic Duplication Duplication means assigning a certain field the same value as for the corresponding field in the preceding record. Duplication is accomplished by utilizing duplication fields. A duplication field is one that is assigned the value of a reg- ister when the operator presses the DUP key. If, by contrast, the operator uses normal keying routines, the keyed data will be in- put to both field and register. The DUP key cannot be used with duplication fields, if the spec- ified register has not yet been assigned any value; this is the normal case when first executing a duplication field, and the operator must therefore key the field input, which by this action also will be stored in the register. The use of a register should be limited to one duplication field in a subformat; the register should not be changed by program statements. \f E_x_a_m_p_l_e_ _6_._4_ A document is filled out as follows: CUSTOMER NO ARTICLE NO QUANTITY 5002 30 12 5002 992 1 3111 992 97 3111 992 33 4001 30 14 The matching subformat: EXAMP 2 CUSTN 4 4 N 1 D01 ARTIN 3 2 N 2 D02 AMOUN 5 1 N 3 0 END SUBFORMAT, The effect of DUP on the fourth line, first field, will be the input of 3111 as customer number in the record, if this number is keyed in the corresponding position in the third record. 6.5 Automatic Incrementation Automatic incrementation means that a field is assigned the value of some previously keyed value increased by 1. Automatic incrementation uses increment fields. An increment field has the same function as a duplication field (see Section 6.4), except that the corresponding register is increased by 1 by activating the DUP key. The keying of an increment field causes also the corresponding register to be changed. \f E_x_a_m_p_l_e_ _6_._5_ A document is filled out as follows: TYPE INFORMATION 1 INFORMATION 2 1 1250 20 2 900 1992 3 4 11 77 The matching subformat: EXAMP 2 TYPE 1 1 N 1 I01 INF1 4 1 N 2 INF2 4 1 N 3 END SUBFORMAT, On the first line of the field TYPE "1" is keyed, on the next DUP, the third line is left empty, and on the fourth "4" is keyed. 6.6 The Use of Tables Tables are used in programs during calculations when an operand may contain one out of so many values that a comparison of the current value with every single possible value, by program stat- ements, would be an insurmountable task (as for instance, using IF and ALLOW/DISALLOW with constants representing allowed/disal- lowed values). Therefore, the values are gathered together in a table and can thus be referenced collectively by a single program statement. The use of tables ensures another advantage in that they can be utilized by different programs. There are two types of tables: 1. If one only wants to find out if a certain value exists, a single-entried table is used, listing all possible values.\f 2. If the operation not only involves establishing the existence of a certain value (argument), but also the access to an ass- ociated value (function), a multiple-entried table is used, which contains all possible arguments together with their assigned values. When used for registration, a format is taken from the disc and placed in the internal core together with the referenced tables. In the case of very long tables, it is therefore recommended to create so-called DISC tables, in order to save space in the comp- uter. A DISC table will a_l_w_a_y_s_ be stored on the disc only. Please also notice that core tables cannot contain more than two columns (single-entried or double-entried) where as DISC tables can cont- ain up to seven columns (six functions per argument). See Chapter 5 for further details! E_x_a_m_p_l_e_ _6_._6_ A document contains, among other things, the following units: MONTH: DAY: DATE: Corresponding field descriptions: MONTH 9 1 AN 10L IF NOT (MONTH IN MTABL) THEN ALARM "MONTH IS WRONG", DAY 9 1 AN 11L IF NOT (DAY IN DTABL) THEN ALARM "DAY IS WRONG", DATE 2 1 N 12 IF DATE 1 THEN ALARM "DATE IS WRONG", IF MONTH VALID THEN SEARCH MONTH IN MTABL GIVING X01 AT END ALARM "SYSTEM ERROR" ELSE COMPUTE X01 = 31, IF DATE 'X01 THEN ALARM "DATE IS WRONG", \f Two tables are referenced: one single-entried and one double-entried DTABL AN 9 MTABL AN 9 N 2 MONDAY JANUARY TUESDAY 31 WEDNESDAY FEBRUARY THURSDAY 29 FRIDAY MARCH SATURDAY 31 SUNDAY NOVEMBER 30 DECEMBER 31 Note that MTABLE in "MONTH" actually serves as a single-entried table. If MTABL were a disctable (though inconvenient with respect to its size) instead of a core table then the following changes had to be made in the program statements in above field descriptions: 1. The statement in MONTH must be replaced by the following (disctable not allowed in table condition): SEARCH MONTH IN DISC MTABL GIVING* AT END ALARM "MONTH IS WRONG", 2. The fourth line of DATE must be replaced by: SEARCH MONTH IN DISC MTABL \f The table would be coded like this: MTABL 1 AN N j JANUARY 31 j FEBRUARY 29 j MARCH 31 j NOVEMBER 30 j DECEMBER 31 E 6.7 Partial Rekeying In order to save time when rekeying it might often be appropriate to rekey only certain units of certain documents. This procedure is controlled by the column "REKEY" in the definition sections of the field descriptions. If the REKEY column is keyed N (for No), the corresponding field is skipped when rekeying. \f The table would be coded like this: MTABL 1 AN N j JANUARY 31 j FEBRUARY 29 j MARCH 31 j NOVEMBER 30 j DECEMBER 31 E 6.7 Partial Rekeying In order to save time when rekeying it might often be appropriate to rekey only certain units of certain documents. This procedure is controlled by the column "REKEY" in the defini- tion sections of the field descriptions. If the REKEY column is keyed N (for No), the corresponding field is skipped when rekey- ing. As a rule, fields containing important information will always be rekeyed, if the information can not be thoroughly checked at the initial keying stage by the use of tables, LIMIT statements or the like. Take, for example, amounts included in the sum total: if the total turns out to be false, one does not know if the keying error occurred when the total was keyed or is hidden among the amounts added up. \f 6.8 The Use of Pseudo-Registers The pseudo-registers described in section 3.3.2 enable a format to read out information about the nevironment as it looks when the format is used for registration. The information may for example be stored in the batch for trace purposes. Consider a format which, at the start of a registration, outputs name of job and name of batch together with the time of registration start-up. Once stored the information will also be available to the computer to which the batch is transferred for further processing.\f APPENDIX I REQUIRED SPACE IN CORE FOR FORMATS, SUBPROGRAMS AND TABLES The following sizes are all defined in bytes. In some cases length is defined as an interval (lower limit - upper limit); a definition section may, for instance, at best fill 15 bytes and at worse 16 bytes. format head 16 + 4 * number of subformats subformat head 8 definition section 15-16 image head 4 + 4 * number of subformats image of subformat head 4 + 2 * number of pages image page 1 + 5 * number of texts + length of texts P_r_o_g_r_a_m_ _p_a_r_t_ field reference 3 register reference 2 constant 2 + constant length subscript 1 table (not DISC table) 1-2 (1st reference of table) + table length table (not DISC table) 3 (subsequent references) DISC table 34-35 label reference 3-4 subformat reference 2 translated subprogram as for normal program part translated table (not DISC table) 6 + number of arguments * (length of one argument + length of one function) +,-,+,/,MOD,',=,,', =,'= 1 AND, OR, NOT, VALID, INVALID, IN 1 \f COMPUTE - = 1 MOVE - TO 1 CONNECT - TO - GIVING 2 SEARCH - GIVING - AT END 9-11 LIMIT 1 ALLOW 1-3 DISALLOW 1-3 GOTO 1 SELECT SUBFORMAT 1 DISPLAY 1 ALARM 1 DEFINE - length 3 END 1 END SUBFORMAT 0 NOTE 0 PERFORM (1st reference of subprogram 9-12 + subprogram length PERFORM (subsequent references) 4-5 DUP-FIELDS 3 SKIP - FIELDS 3 IF - THEN 4-5 IF - THEN - ELSE 8-10 SET 1 Study the example on the opposit page!\f EXPL 1 REQUIRED SPACE - 1 F1 1 0 N 1 DEFINE X01 1, COMPUTE X01=F1, PERFORM CHECK, 0 SELECT SUBFORMAT 2, END SUBFORMAT, EXPL 2 REQUIRED SPACE - 2 0 DISPLAY X01, F1 1 0 N 0 COMPUTE X01 = F1, PERFORM CHECK, 0 END, Translated, this format requires the following number of bytes: format head (16 + 4 * 2) 24 subformat 1: subformat head 8 1st field description: definition section 15-16 DEFINE - 13 X01 (register reference)2 COMPUTE - =1 X012 F1 (field reference)3 PERFORM CHECK*) (9 12 + 50) 5_9_-_6_2_ 85-89 _________ *) The subprogram CHECK is assumed to require 50 bytes. 2nd field description: definition section 15-16 SELECT SUBFORMAT 1 2 (subformat reference) 2 END SUBFORMAT 0_ _ _ _ _ 1_8_-_1_9_ 111-116 \f subformat 2: subformat head 8 1st field description: definition section 15-16 DISPLAY 1 X01 2_ _ _ _ _ 18-19 2nd field description: definition section 15-16 COMPUTE - = 1 X01 2 F1 3 PERFORM CHECK 4_-_5_ _ _ 25-27 3rd field description: definition section 15-16 END 1_ _ _ _ _ 1_6_-_1_7_ 6_7_-_7_1_ Total number of bytes: 2_0_2_-_2_1_1_ In other words, the translated format will require something between 202 and 211 bytes. \f «eof»