Edit macro SORTG Edit macro SORTG Author: David McRitchie formatted on 1995/04/01 06:54 for assistance contact: D. McRitchie DMcRitchie@hotmail.com -------------------------------------------------------------------------------- Macro name. SORTG users. PDF EDIT users type. Edit Macro resides in SYS1.TSOCLIST -------------------------------------------------------------------------------- SORTG Edit macro SORTG -------------------------------------------------------------------------------- related edit commands SORT invoked clists REFORMAT and @SEQ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- SORTG Sort Groupings of Data within PDF edit -------------------------------------------------------------------------------- The SORTG edit macro allows sorting of records as groups of records having dif- ferent formats within each group providing that the first record of each group has a specific format. This edit macro is designed to sort lines which are not displayed and have a different format along with their associated lines which are displayed and appear earlier. The function of %SORTG is to sort a group of lines together, where only the first line of each group of lines contains the information required for sorting. The displayed lines will own the undisplayed lines below them. If you merely want to sort lines you should be using the SORT command. Invoking %SORTG -------------------------------------------------------------------------------- Since square brackets are not available, optional material is enclosed in European brackets <...>. ISREDIT SORTG label-range sort-pair < ... sort-pair > -------------------------------------------------------------------------------- 1. label-range, indicates that two line pointers are required to indicate a range of lines for the sort operation. Pointers must be a labels. Specify- ing one line pointer is invalid. 2. sort-pair, indicates a pair of columns for sorting. 3. LEAVE, (not a normal choice of options) will retain at the far right side of the records the actual material that was used for sorting. Ordinarily this information is created internally for use by the edit macro and then wiped out. 4. NOSORT, (not a normal choice of options) will create and retain at the far right side of the record the column pair(s) chosen. No sort will be done. No sequence numbers added. LEAVE option is turn on to retain added mate- rial. The following return codes may be issued: 1 - Normal completion, places cursor on command line. 4 - Made an error in usage. other - not limited to the above Requirements 1. A label range is required, two labels nor more no less. Error Message LABEL ... 2. Within the label range you must have NX and X lines. Error Message INVALID USAGE -- X LINES MISSING. 3. The NX lines will be used for sorting based on columns designated. Error message -- COLUMNS? -- START and END COLUMNS REQUIRED. Error message -- ENTER START AND END COLS -- BOTH START AND END COL MUST BE PRESENT. 4. The X lines will be carried as a group of lines beginning with the first previous NX line down to and including the line before the next NX line. 5. There must be sufficient space to the right of all lines to include the line number (6 bytes) plus the designated sort fields. For example, SORTG .a .b 23 24 20 21, requires 10 bytes to be blank at the far right of all lines within the range .a .b. If your data will not fit you may have to perform your work in a text library with a larger Record Length (LRECL). Error message -- RIGHT COLS -- Rightmost columns nn -- nn NOT BLANK. 6. When you invoke %SORTG, if the first line in the range is not displayed (X) the edit macro will continue leaving those lines at the beginning intact. You may see the following warning message: TOP PORTION NOT SORTED. Also produces a NOTELINE indicating Top Lines not sorted, since not displayed at start. All lines within the range .labf .labl are displayed when %SORTG ends. Limitations 1. Most limitations and requirements of the SORT command used in EDIT apply. 2. Since the use of BOUNDS would otherwise interfere with SORTG, they are turned off after checking has completed and restored upon completion. 3. The descending option available to the SORT is not available in SORTG. 4. Sequence numbers probably okay since DATA-WIDTH is used and clists see only data area. NOTE lines may show columns differing from EDIT display. Examples The function of %SORTG is to sort a group of lines together, where only the first line of each group of lines contains the information required for sorting. The displayed lines will own the undisplayed lines below them. We want to rearrange the following data so that the dates in col 20-24 will be in chronological order. The records below each date line are associated with the date record above them. All related lines in a date group are to moved to- gether when sorting occurs. -------------------------------------------------------------------------------- Page REPEATNX1 SYSTECH NOTICE -- CLISTS EDIT---- IS03.SHARE.TEXT(EDITXXXX) - 01.00 - COLUMNS 001 124 COMMAND ===> SCROLL ===> CSR ****** **************************** TOP OF DATA ***************************** .A 001 a x 000002 b 000003 c y 000004 d 000005 e z 000006 f =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7 000007 aaa 05/90 000008 aaa 000009 abbbb 04/90 000010 abbbb 000011 ccccc 06/90 000012 ccccc 000013 dddddd 01/90 000014 dddddd 000015 eeeeee-1 02/90 000016 eeeeee -2 000016 eeeeee -3 ****** ************************* BOTTOM OF DATA ***************************** commands issued before next screen appears COMMAND ===> x all COMMAND ===> f 22 '/' all EDIT---- IS03.SHARE.TEXT(EDITXXXX) - 01.00 - COLUMNS 001 124 COMMAND ===> SCROLL ===> CSR ****** **************************** TOP OF DATA ***************************** ------ - - - - - - - - - - - - - - - - - - - 6 LINE(S) NOT DISPLAYED 000001 aaa 05/90 ------ - - - - - - - - - - - - - - - - - - - 1 LINE(S) NOT DISPLAYED 000002 abbbb 04/90 ------ - - - - - - - - - - - - - - - - - - - 1 LINE(S) NOT DISPLAYED 000003 ccccc 06/90 ------ - - - - - - - - - - - - - - - - - - - 1 LINE(S) NOT DISPLAYED 000004 dddddd 01/90 ------ - - - - - - - - - - - - - - - - - - - 1 LINE(S) NOT DISPLAYED 000005 eeeeee-1 02/90 ------ - - - - - - - - - - - - - - - - - - - 2 LINE(S) NOT DISPLAYED ****** ************************* BOTTOM OF DATA ***************************** The X lines (not displayed) above DO NOT contain date information. The SORTG edit macro will move groups around so that the dates are in order, and the asso- ciated undisplayed lines following will move as a group. Note that the lines at the top do not have date displayed lines above them so they are treated as hav- ing blank dates. The use of dates is strictly an example. The sorting will be on the NX (displayed) lines and the X (undisplayed) lines below them will be included as a group with the previous undisplayed line. commands issued before next screen appears COMMAND ===> SORTG .a .zl 23 24 20 21 EDIT---- IS03.SHARE.TEXT(EDITXXXX) - 01.00 - COLUMNS 001 124 COMMAND ===> SCROLL ===> CSR ****** **************************** TOP OF DATA ***************************** .A 001 a x 000002 b 000003 c y 000004 d 000005 e z =NOTE= *WARNING** TOP LINES FROM .A NOT SORTED, SINCE NOT DISPLAYED AT START. ALL LINES WITHIN RANGE .A THRU .ZL ARE DISPLAYED UPON COMPLETION OF %SORTG. 000006 f 000007 dddddd 01/90 000008 dddddd 000009 eeeeee-1 02/90 000010 eeeeee -2 000011 eeeeee -3 000012 abbbb 04/90 000013 abbbb 000014 aaa 05/90 000015 aaa 000016 ccccc 06/90 000017 ccccc =NOTE= ..ENDED .A .XL 1 241 23 24 20 21 .... yy/mm/dd yy.ddd hh:mm:ss ****** ************************* BOTTOM OF DATA ***************************** -------------------------------------------------------------------------------- Maintaining a list of members in an INDEX for a dataset Many of our Partitioned datasets contain an INDEX member containing a list of members and descriptions. Usually they have the name of "$" as this is the first membername that a dataset can contain. TSOMODEL.PUBLIC.TEXT uses INDEX for its INDEX member. The SORTG edit macro allows names within the member to be sorted carrying each carrying along it's descriptive information. Update directions for TSOMODEL.PUBLIC.TEXT(INDEX) for use by authorized persons when the INDEX member has not been maintained. 1. You must be in edit within member INDEX 2. Add names of members this library not in member INDEX ===> @DIR 'TSOMODEL.PUBLIC.TEXT' LISTMEM XFIND(1) 3. Describe new additions placing into proper format you may use SPLIT screen to view members to be described. 4. Insure that all information fits in columns 1-70 (1-71). 5. To sort old and new information keeping groups intact ===> x all -- exclude lines from display ===> f 1 9 ':' all -- find lines with control info ===> sortg 1 9 .zf .zl -- control is columns 1 0 of nx lines Example of content of TSOMODEL.PUBLIC.TEXT(INDEX) The index file, entries are listed in alphabetical order. $PRINT: JCL to print members of a PDS ARCHIVE: bulletin -- TSODA datasets kept for 180 days instead of 45 days BASIC: Formatted Manual -- VSPC to TSO BASIC BASIC120: Formatted Man- ual -- INTRO to BASIC/MVS 1.2.0 ... ... TSOFORM: Form to be completed to request a TSO data set be backed-up for 7 years. Use SCRIPT to process. (GT12 GB12, 6lpi) USE7171: How to use the 7171 with different termi- nals Note: review the comments at the front of the document prior to printing, or it won't print correctly. The original source document is in IS02.TSOCONV.TEXT(USE7171), you may SCRIPT a current copy in page mode from there. VSAM: VSAM CISIZE is now calculated differently -------------------------------------------------------------------------------- Special Features for ASCII data transformation Some special features have been added to make for a consistency between EBCDIC characters on MVS and ASCII characters on PC's. 1. The digits will sort after alphabetics in ASCII to simulate the sort using EBCDIC. This is accomplished by translating the sort area x'40' through x'49' to x'F0' through x'F9' before the sort, and restoring to x'40' to x'49' after sorting. This could impact the non official ASCII characters above 127 (X'7F'). 2. The sort will treat all characters uppercase. -------------------------------------------------------------------------------- Internal Aspects Internal aspects describes how the CLIST (macro/clist/exec) functions. This in- formation is particularly useful to someone who may need to design a similarly functional edit macro. It may also provide additional insight to the user. 1. Validity checks are made before data is changed. 2. Since the use of BOUNDS would interfere with SORTG, they are turned off af- ter checking has completed and restored upon completion. 3. A reformat will be done internally of the data creating a new sort field on the right hand side based on the NX lines and the indicated sort fields. The last noteline is a carryover. 4. The X lines receive the sort information from the previous NX line within the label range. 5. Following the new sort field are the six byte sequence number based on the original line arrangement. The purpose of this is to effect an EQUALS sort- ing where lines that are otherwise equal in collating sequence will appear in their original order. The six byte sequence numbers are not added with NOSORT is in effect. 6. See special features for ASCII data transformation.