KPS - KEYPUNCH SIMULATOR VS1.0 03-JAN-79 The purpose of this program is to simulate the functions of the keypunch using a terminal. KPS is a very simple editor with the added special functions of keypunches. These functions in- clude the use of 'program cards' and a 'dup' key, allowing input of a fixed field nature where keypunch functions make the typing task easier. Upon initialization, KPS makes a copy of the input file in- cluding the necessary data to link through the file. Thus, large files will take longer on start-up. The same is true on exit from KPS. However, for some large edits KPS may prove to be more flex- ible than EDI since there are no block-mode constraints. Throughout this write-up references are made to the DEC edi- tor EDI. Scince KPS and EDI commands are very similar, it may be useful to refer to the EDItor manual for more in-depth descrip- tions of the commands. Initiating KPS The PDS command line to start KPS is as follows: PDS> KPS filespec1[/DC=filespec2] where filespec1 is the input filespec. Some part of the filespec must be entered. The default fi- lespec is X.DAT. If the file does not exist, it will be cre- ated and KPS will go directly into Insert mode, like EDI. filespec2 is the 'drum card' file. The default filespec is DRUM.PRG. If filespec2 is omitted, KPS will attempt to find DRUM.PRG. There is no error message if filespec2 is not found or if DRUM.PRG is not found. If the command line is empty KPS will prompt for the filespec with: KPS> filespec1[/DC=filespec2] KPS - KEYPUNCH SIMULATOR -2- VS1.0 03-JAN-79 Drum Card File and Control characters The drum card file is created using EDI or KPS. There can be 9 program cards in the file. The maximum length of each card, ex- cluding commented lines, is 80 columns. The drum card file is checked for length of record, number of records, and validity of control characters. No logic checks are made. Program cards are read sequentially from the drum card file. The first card or line in the file being program 1, the 2nd being program 2 etc. A drum card may be 'commented out' by placing a ';' in column one. Thus,if you wanted to use only programs 1 and 6, you could have four lines of filler, each beginning with ';' followed by any text. If programs 2-5 are referenced in KPS, each will be equivalent to an all blank program card. The control characters used to describe a program card do not carry over from the keypunch specifications and are unique to KPS. Their definitions follow: 'A' Field definition - Alpha mode (A-Z, caps only) are valid. 'a' Field continuation - Alpha mode. 'N' Field definition - Numeric mode (0-9, '.,+-') are valid. 'n' Field continuation - Numeric mode. ' ' Field definition - All characters are valid. '&' Field continuation - All characters. 'D' Auto duplication of what is in dup buffer. 'S' Auto skip to next non 'S' character. Examples: Auto dup cols 1-6, skip to col 11, set for date field entry, de- fine 2 alpha fields, 15 cols and 10 cols, and skip to end of card. DDDDDDSSSSNn&nn&nnAaaaaaaaaaaaaaaAaaaaaaaaaSSSSSSS... A typical 8E10.0 format. &&&&&&&&& &&&&&&&&& &&&&&&&&& &&&... When in insert mode, if a character is entered which is invalid for the field description on the program card, the bell is sounded to indicate the error. KPS - KEYPUNCH SIMULATOR -3- VS1.0 03-JAN-79 KPS Editing Commands The current command processor is extremely simple and will inspect only the first character of the line to determine the com- mand. An effort was made to make the commands as much like EDI as was reasonable. Not all EDI commands are implemented. The current line is normally printed after every command which moves the line pointer. If KPS does not understand the input, it responds with a question mark (?). If a command at- tempts to move the line pointer beyond the top or end of the file, [*TOF*] or [*EOF*] messages are printed to indicate the condition. There are no such things as blocks in KPS. When a command refers to [n] lines, [n] can be +/-32767 or +/-* where * means all, like in EDI. KPS always prompts with an asterisk (*) when in edit mode, like EDI. There is no case conversion in KPS. UPPER always comes out UPPER and lower always comes out lower. In the following command descriptions, '/' represents a del- imiter, a delimiter being any character with ASCII value greater than "40 (blank). Tabs are not considered delimiters. The strings may use up to 5 'don't care' sequences ( 3 or more dots) in string search patterns. These are valid in the 'L' command and in string1 of the 'C' command. Strings may also be null, like in EDI. KPS - KEYPUNCH SIMULATOR -4- VS1.0 03-JAN-79 Command Summary A/string Append string Appends 'string' to the end or the current line. The trail- ing delimiter is optional. Note that trailing blanks will always be stripped. *A/This is THE END *A; LAST; B Bottom of file This positions the line pointer to the last line in the file. The line is printed. *B C/string1/string2[/ n1 n2] Change string1 to string2 Change string1 to string2 n1 times per line for n2 lines. The line pointer will be left at the last line searched, un- like PAste in EDI. The trailing delimiter must be present if n1 is specified. Both trailing delimiter and n1 must be pre- sent if n2 is specified. n1 and n2 must be separated by a blank(s). *C/THIS/THAT *C//COLUMN ONE *C/...Bad data/ this is ok data/ *C"ab...cde...xyz"alphabet"* 10 *C;FOR/LIST;FOR;* * *C//Every line / 1 * D[n] Delete n lines If n is positive the current line and the next n-1 lines will be deleted, the pointer being left at the next line. If n is negative the previous n lines will be deleted, pointer being left at the next previous line. If n is omitted, 1 is as- sumed. *D *D12 *D-* E [filespec] Exit KPS KPS is terminated, the input file is closed and the edit is copied out to [filespec]. The input filespec is used to fill in any or all parts of [filespec] which are omitted. Like EDI Exit. *E *E LEN.OUT *E OUTPUT F Flush scratch file buffers This will copy out any modified in core buffers to the two temporary files used in KPS. It effectively saves the edit up to this point. In the event of abnormal termination (never!), the edit can be easily recovered. A nominal flush is issued by KPS after initialization. *F KPS - KEYPUNCH SIMULATOR -5- VS1.0 03-JAN-79 Insert mode functions I[/string] Insert mode Enter insert mode. Insert mode is where the special keypunch functions are enabled, like selection of program cards and use of the duplication key. Upon entry to insert the dup buffer is loaded with the contents of the current line. Program cards do not apply to the immediate mode of the in- sert command. Special character functions in insert mode { left bracket, dup key When typed the corresponding character from the dup buffer is transfered to the current line. The bracket character was chosen for dup because it is next to the repeat key on DEC terminals. tab key or ^I In program 0 mode standard DEC (mod 8) tabbing is imple- mented, i.e. the tab character is moved to the input record, rather than tabbing with spaces. In program 1-9 mode the effect is the same as the skip key on key- punches. KPS will skip to the next field definition as indicated on the current program card. Program 1-9 skips fill with blanks. carriage return Same as release key on keypunch. Terminates current re- cord. Note that carriage return in column 1 causes exit out of insert mode, as it does in EDI (see ^Z). delete key Deletes characters from input line. Standard DEC imple- mentation. Note that delete will have no effect on auto-skip or auto-dup fields unless you change program cards (program 0). ^R control R Retype current input line. Standard DEC implementation. ^U control U Reset or erase current line. Standard DEC implementa- tion. ^Z control Z Return to edit mode, leave insert mode. This can be typed anywhere on the line, but the line it is entered on will not be inserted into the file. Thus if you have a program card that auto skips and dups you can exit in the middle of the 'card' without shifting program cards. KPS - KEYPUNCH SIMULATOR -6- VS1.0 03-JAN-79 Insert mode functions (cont.) Program card control operations (escape sequences) Program cards and program card print functions are initiated by escape sequences. Note that an escape sequence may be typed at any point. The program mode is initially set to 0, but on subsequent entries to insert, the program mode is as it was on the last exit from insert mode. 0 escape zero This selects program 0. Program 0 is generated by KPS and is an all blank record. It is equivalent to EDI in- sert mode (see ) or a keypunch where the star-wheels are raised. The dup key will function in program 0 mode. 1-9 escapes 1 through 9 Selects one of the user drum control program cards. C escape C Print out card column numbers. D escape D The card columns , current program number, and the cur- rent program card are printed. V escape V Turn verification (echo) of escape sequences on or off. Initially off. When off only those sequences in error are printed. If on all escape sequences are echoed and followed by a ^R. KPS - KEYPUNCH SIMULATOR -7- VS1.0 03-JAN-79 K Kill Kill KPS session. Closes the input file but does not update the file with any changes made during KPS. The temporary files are deleted. Like EDI kill. *K L/string Locate string Locate the pattern specified in string. Begin searching in the line following the current line. *L/find...this....pattern/ *L;any old thing N[n] Next nth line Positions the line pointer to the next nth line. If n is om- itted 1 is assumed. The line pointed to at the completion of next is printed. Like EDI NextPrint. *N *N 350 *N-5 O[+n] Overlay Deletes n lines and enters insert mode, effectively overlay- ing n lines. Note that n can only be positive. The first line deleted is read into the dup buffer. Like EDI's Overlay command. *O *O3 P[n] Print Print n lines, if n is omitted or n is 1 the current line is printed but the line pointer does not move. Like EDI Print, but KPS also prints in reverse direction. *P *P* *P-25 T Top Position to top of file. KPS is actually pointing to the header record rather than the first line in the file. This is so we can insert lines before the first line. Like EDI Top. *T X[filespec] Exit KPS The input file is deleted and the edited copy of the file goes to the next version of the input filespec, or to the file specified by [filespec]. Like EDI's CDL. *X *X TMP.DAT KPS - KEYPUNCH SIMULATOR -8- VS1.0 03-JAN-79 Special key functions in KPS edit mode Carriage return Advance one line and print the current line,like EDI. Escape key Same as N-1, like escape in EDI. ^Z Control Z Exit KPS. Like the E command with [filespec] omitted. Same as ^Z in EDI.