APPLICATION NOTE #118 MARK AND RETURN TO MARK Rev. 01 When you are working with a long file, you may want to move to a different part of your document, perhaps to check a cross-reference, and then quickly return to the starting point. This application note describes two simple programs you can use to mark your current spot and then later return to that spot. CREATING THE PROGRAMS You need to create two separate programs: one that marks your spot and another that returns you to that spot. The first program, which we'll call MARK.PGM, saves the current character position in a Save/Get. Let's create this program. 1. Create a new program file. Type: F5nep mark.pgm 2. Press: Ctrl-F9 (to switch to expanded display) 3. Type: <>>> This program uses Save/Get 1. You can use any Save/Get key you want, but you should reserve the selected key for use with this program. 4. Store the program file. Now let's create the second program, RETURN.PGM. This program uses the JMP command to move the cursor to the character position stored in Save/Get 1 (or whatever key you have reserved for this application). 1. Create a new program file. Type: F5nep return.pgm 2. Press: Ctrl-F9 (to switch to expanded display) 3. Press: Scroll Lock (to turn record mode on) 4. Press: F5 5. Type: jmp <> Result: When you run this program, it places the contents of Save/Get 1 on the command line after the JMP command. If you used a different Save/Get key when you created MARK.PGM (in the SX command), be sure to modify the PV command to match it. 6. Press: Scroll Lock (to turn record mode off) 7. Press: 8. Store the program file. RUNNING THE PROGRAM To use the mark and return to mark procedure: 1. Assign the programs to available Save/Get keys. (Don't use the Save/Get key you reserved in the previous procedure. That key is used to store the character position; the keys you are assigning in this step are used to store the programs.) For example: Type: F5ldpm mark.pgm,m and Type: F5ldpm return.pgm,r 2. When you want to mark a spot so you can return to it later: Press: Alt-M 3. Move the cursor to whatever area you want, either before or after the spot you marked. 4. When you are ready to return to the spot you marked in step 2: Press: Alt-R Result: The cursor moves to the character position you previously marked. Note #1 Edited Text. MARK.PGM counts the number of characters from the start of the file to the point at which you run the program. RETURN.PGM moves the cursor not to a particular word, but to a particular character number. If you mark a spot and then add or delete text between that spot and the beginning of the file, you alter the character count. When you later run RETURN.PGM, the cursor moves not to the word that you originally marked, but to the word currently at the character position you saved. Note #2 Startup File. To make sure your program is always loaded, you could put the LDPM command in your startup file. Note #3 Additional Information. For more information about the commands used in this application note, refer to your XyWrite Reference Guide.