Moving or Deleting Text in XyWrite APPLICATION NOTE #217 This application note describes three programs (DELGRAF.PGM, MOVGRAF.PGM, and DELLINE.PGM) which make it easy to move or delete blocks of text. These programs can be used in XyWrite III Plus, Version 3.54 and later. DELGRAF.PGM and MOVGRAF.PGM are similar programs. They each search an open file for a string of text that you have specified. When the string has been located, the paragraph where it was found is defined. At this point, DELGRAF.PGM deletes the paragraph. MOVGRAF.PGM moves the paragraph to the file in the previous window. DELLINE.PGM is similar to DELGRAF.PGM in that it defines and deletes text after searching for a string. However, DELLINE.PGM deletes only the line containing the string, not the entire paragraph. These programs allow you to quickly and easily create files that contain only those items that meet the criteria you specify. For example, say you have a file that contains a mailing list of magazine subscribers and you wish to create a second list containing only those subscribers who share a common zip code. You can use MOVGRAPH.PGM to extract the items you need from the main list by searching for a certain zip code (or range of zip codes using wildcards). When the names and addresses of all the subscribers who have the zip code(s) you specified have been moved to another file, you will have created a subset of the main list. Similarly, you can use DELLINE.PGM and DELGRAF.PGM to edit a list of items by searching for, and deleting, unwanted entries. INSTALLATION After you have obtained copies of the three programs (which are available through XYQUEST's Technical Services Department), copy them from disk to the directory in which you have installed XyWrite. RUNNING THE PROGRAMS Because all three programs will alter your original files, we recommend making backup copies of your files before starting. The procedure for running DELGRAF.PGM and DELLINE.PGM is the same, as shown below: 1. Call the file you want to search. 2. Press Ctrl°Home to move the cursor to the beginning of the file. 3. Issue the RUN command, and specify the program name and the text you are searching for. For example: Type: F5°run delgraf.pgm,0182N° Result: The program DELGRAF.PGM searches through the displayed file for the first occurrence of a five-digit number 01820 through 01829. When it finds it, it defines and deletes the paragraph (or sentence) that includes it. The program then resumes the search until all the paragraphs or sentences that contain the specified range of numbers have been deleted. The procedure for running MOVGRAF.PGM includes an additional step: 1. Set the NW (New Window) default to 1. Type: F5°d nw=1°° 2. Call the file you want to move the text into. 3. Call the file you want to search. 4. Issue the RUN command. For example: Type: F5°run movgraf.pgm,part-time°° Result: MOVGRAF.PGM searches the displayed file for all occurrences of the phrase ``part-time'' and moves each paragraph containing ``part-time'' into the file displayed in the previously accessed window. Note #1 Window Sequence. If you are using more than two windows, MOVGRAF.PGM will move the text to whichever window was most recently accessed. Note #2 Mail Merge Data. To use the DELGRAF or MOVGRAF programs on a Mail Merge data file, you must modify the field and record separators in the file. The default field separator is a carriage return; it should be any other character. The default record separator is two carriage returns; it should be one. Refer to Chapter 5 of the XyWrite III Plus Reference Guide for information on changing field and record separators. PROGRAM CONTENT DELGRAF.PGM, MOVGRAF.PGM, and DELLINE.PGM are reproduced below. Remember, if you plan to recreate these programs yourself, you must follow the rules for creating a XyWrite program file. For more information, refer to Chapter 5 of the XyWrite III Plus Reference Guide. DELGRAF.PGM ˙AELBstart˙AFBC se /˙AEAS˙AF/XC ˙AEIF˙AEER˙AF˙AF ˙AEGLdone˙AF˙AEEI˙AFRP ˙AEGLstart˙AF˙AELBdone˙AF BC DONE ˙AEPRdone˙AFEX MOVGRAF.PGM XD ˙AELBstart˙AFBC se /˙AEAS˙AF/XC ˙AEIF˙AEER˙AF˙AF ˙AEGLdone˙AF˙AEEI˙AFDP AS MV AS XD ˙AEGLstart˙AF ˙AELBdone˙AFBC DONE ˙AEPRdone˙AFEX DELLINE.PGM ˙AELBstart˙AFBC se /˙AEAS˙AF/XC ˙AEIF˙AEER˙AF˙AF˙AEGLdone˙AF˙AEEI˙AF RL ˙AEGLstart˙AF˙AELBdone˙AFBC DONE ˙AEPRdone˙AFEX