Edit macro SORTCR Edit macro SORTCR Author: David McRitchie formatted on 1995/04/01 06:54 for assistance contact: D. McRitchie DMcRitchie@hotmail.com -------------------------------------------------------------------------------- Macro name. SORTCR users. SCRIPT users type. Edit Macro resides in SYS1.TSOCLIST, and in IS03.SPF2.MACROS fo r use on SPF/PC -------------------------------------------------------------------------------- SORTCR List of words sorted vertically -- useful in SCRIPT -------------------------------------------------------------------------------- related DUADD SCRIPT ".du add" sorted and reflowed related clists SORTEM and REFORMAT -------------------------------------------------------------------------------- The SORTCR command takes a word list and sorts the words removing duplicate words and then reformats the list into vertical columns, each column being the same length. -------------------------------------------------------------------------------- ISREDIT SORTCR {flow} ISREDIT SORTCR {flow length} ISREDIT SORTCR {lptr-range} ISREDIT SORTCR {lptr-range flow length} -------------------------------------------------------------------------------- Options: flow option default is 70 e.g. ===> SORTCR 70 The resulting sorted word list will fit within the column specified. length of all words will be 10 e.g. ===> SORTCR 70 10 The length of words in the list will be at least this length. The default is the length of the longest word encountered. required labels .sortflabel required at beginning of a contiguous word list section. .sortxlabel required immediately after the end of the contiguous word list section. This convention was in- tended to permit the group to consist of a single line, and the retention of of both labels for immediate reuse. If the group consists only of one line please repeat the .sortf line before invoking SORTCR. Examples SORTCR The default flow option of 70 will be used. All words in the word list will be realigned from the required line labels ".sortf" through the line before the required line label ".SORTX". The default length of each word will be ten. SORTCR 75 The specified flow option of 75 will be used. All words in the word list will be realigned from the required line labels ".sortf" through the line before the required line label ".SORTX". The default length of each word will be ten. SORTCR 75 12 The length of each word will be 12. SORTCR .A .B 75 12 The specified flow option of 75 will be used. All words in the word list will be realigned from the required .sortf label specified as ".A" through the line before the required .SORTX label specified as ".B". The length of each word will be 12. Before use of SORTCR There are 48 entries in the before but since the "936" and the "937" are repeated there are only 44 unique entries, and it is the number of unique entries which appears as a note comment in the verification. EDIT --- xxxx.xxxx.xxxx(xxxxxx) - 01.32 --------------- columns 001 124 COMMAND ===> sortcr 75 000003 this line is before included area and is ignored =cols> ----+----1----+----2----+----3----+----4----+----5----+----6----+--- -7--- .sortf A AA AAA B BB BBB C CC 000005 CCC D DD DDD EEEFGHI EEFGHI EFGHI ZZZA 000006 ZZZAA ZZZAAA ZZZB ZZZBB ZZZBBB ZZZC ZZZCC ZZZCCC 000007 333A 333AA 333AAA 333B 333BB 333BBB 333C 333CC 000008 333CCC 927 928 929 930 931 932 933 000009 934 935 936 936 937 937 937 937 .SORTX ------ this line is not included ------------- After use of SORTCR EDIT --- xxxx.xxxx.xxxx(xxxxxx) - 01.32 --------------- sortcr FINISHED OK COMMAND ===> 000003 this line is before included area and is ignored =cols> ----+----1----+----2----+----3----+----4----+----5----+----6----+ ----7- 000004 A BBB DD ZZZA ZZZBBB 333AA 333C 929 934 000005 AA C DDD ZZZAA ZZZC 333AAA 333CC 930 935 000006 AAA CC EEEFGHI ZZZAAA ZZZCC 333B 333CCC 931 936 000007 B CCC EEFGHI ZZZB ZZZCCC 333BB 927 932 937 000008 BB D EFGHI ZZZBB 333A 333BBB 928 933 .SORTX ------ this line is not included ------------- =note sortcr process 44 -- 44 entries into 9 columns x 5 rows flow=75 73 Before leaving the examples. It should be pointed out that when the number of entries is less than the maximum entries by at least the number of rows used that the number of columns actually used will be less than the calcu- lated number of columns that could fit. EDIT---- IS03.SHARE.TEXT(EDITXXXX) - 01.00 - COLUMNS 001 124 COMMAND ===> SCROLL ===> CSR ****** **************************** TOP OF DATA *************************** ** =NOTE= 18:45:41 ===> SORTCR 60 =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6 000001 a c e g i k m o A C E G I K M O 000002 bb dd ff hh jj ll nn pp BB DD FF HH JJ LL NN PP 000003 .* =NOTE= SORTCR processed 32 entries into 20 Cols X 1 rows, F=60 L=2 b=2 e=4 =NOTE= with 32 entries into 2 rows, 16 cols out of the 20 will be used =NOTE= Entries could be increased to 40 and still fit within flow limit ****** ************************* BOTTOM OF DATA *************************** ** Internal Aspects: 1. Verifies that pointers .sortf and .SORTX, or their equivalent ex- ist and that .sortf is first. 2. A new pointer named .sortl is created for the line before .SORTX If a .sortl would conflict with .sortl then the .sortf line is first repeated to create sufficient separation. 3. A new line is created by reproducing .sortl and labelling as .sortr; retaining data before column 9, it will serve to pattern the last line (.sortl) when doing text flow. 4. Repeats the .sortl line creating .sortr to aid in text flow 5. Separates each word so each appears on one line 6. Sorts between .sortf and .sortr 7. Removes duplicates from .sortf through .sortr (cannot result in loss of .sortr because of unique data in column one). Invokes code copied from the edit macro REMDUPS as if for "REMDUPS .sortf .sortr". 8. Loops to fill out the calculated number of rows required 9. Removes "³" previously added with change all .sortf .sortl '³' ' ' 10. Deletes lines after required rows and before .sortx Potential Problems: Assuming data does not contain "|", and that ASCII data does not include x'f0' through x'F9' because am using these characters for some transformations. Changes for SPF/PC: not work in SPF/PC yet but based on SORTEM these plus perhaps other things will have to be jerry-rigged. Had to recover line labels when lines are rewritten and when TFLOW is used. A far cry from TSO usage.