/*REXX*/
/*--- SSORT -- PCREXX/REGINA/OOREXX/ROO/R4 - (not BREXX) -------------*/
/*             MS/PCDOS/Windows/Unix/Linux - Shell Sort (.003809 Sec) */
/*             Donald Shell - 1959                                    */
/*--------------------------------------------------------------------*/
CALL DGEN                                    ;/*Create Array to Sort  */
CALL ASHOW                                   ;/*Array Before Sort     */
SAY COPIES('-',40)
ST = TIME('E')                               ;/*Start Elpased Timer   */
CALL SHELLSORT                               ;/*Sort Array            */
ET = TIME('E')                               ;/*Get Elapsed Time      */
CALL ASHOW                                   ;/*Array After Sort      */
SAY "TOOK "ET" SECONDS"                      ;/*Display Elapsed Time  */
EXIT
/*--- SSORT ----------------------------------------------------------*/
SHELLSORT: PROCEDURE EXPOSE AA.
  N = AA.0
  I = N % 2
  DO WHILE I \== 0
     DO J = I + 1 TO N
        K = J
        P = K - I                                   /*P: Previous Item*/
        ZED = AA.J
        DO WHILE K >= I+1 & AA.P > ZED
           AA.K = AA.P
           K = K - I
           P = K - I
        END; /*WHILE K=I+1*/
        AA.K = ZED
     END; /*J*/
     IF I == 2 THEN
        I = 1
     ELSE
        I=I * 5 % 11
  END; /*WHILE*/
RETURN
/*--------------------------------------------------------------------*/
ASHOW: PROCEDURE EXPOSE AA.
  DO J = 1 FOR AA.0
     SAY J" "AA.J
  END
RETURN
/*--------------------------------------------------------------------*/
DGEN:
AA.= ""                                         ;/*Init Array to null.*/
AA.1   = "Ogden River         "
AA.2   = "Weber River         "
AA.3   = "Perdido River       "
AA.4   = "Chattahoochee River "
AA.5   = "Tennessee River     "
AA.6   = "Colorado River      "
AA.7   = "Mississippi River   "
AA.8   = "St. Francis River   "
AA.9   = "Poteau River        "
AA.10  = "Arkansas River      "
AA.11  = "Red River           "
AA.12  = "Byram River         "
AA.13  = "Pawcatuck River     "
AA.14  = "Delaware River      "
AA.15  = "Potomac River       "
AA.16  = "Savannah River      "
AA.17  = "Chattooga River     "
AA.18  = "Tugaloo River       "
AA.19  = "Nephi River         "
AA.20  = "Snake River         "
AA.21  = "Wabash River        "
AA.22  = "Ohio River          "
AA.23  = "Great Miami River   "
AA.24  = "Des Moines River    "
AA.25  = "Big Sioux River     "
AA.26  = "Missouri River      "
AA.27  = "Tug Fork River      "
AA.28  = "Big Sandy River     "
AA.29  = "Pearl River         "
AA.30  = "Sabine River        "
AA.31  = "Monument River      "
AA.32  = "St. Croix River     "
AA.33  = "Piscataqua River    "
AA.34  = "St. Francis River   "
AA.35  = "St. John River      "
AA.36  = "Pocomoke River      "
AA.37  = "Palmer River        "
AA.38  = "Runnins River       "
AA.39  = "Montreal River      "
AA.40  = "Detroit River       "
AA.41  = "St. Clair River     "
AA.42  = "St. Marys River     "
AA.43  = "Brule River         "
AA.44  = "Menominee River     "
AA.45  = "Red Bed River       "
AA.46  = "Bois de Sioux River "
AA.47  = "Pigeon River        "
AA.48  = "Rainy River         "
AA.49  = "Alma River          "
AA.50  = "St. Louis River     "
AA.51  = "Halls River         "
AA.52  = "Salmon Falls River  "
AA.53  = "Connecticut River   "
AA.54  = "Arthur Kill River   "
AA.55  = "Kill Van Kull River "
AA.56  = "Hudson River        "
AA.57  = "Rio Grande River    "
AA.58  = "Niagara River       "
AA.59  = "St. Lawrence River  "
AA.60  = "Poultney River      "
AA.61  = "Catawba River       "
AA.62  = "Blackwater River    "
AA.63  = "Columbia River      "
AA.64  = "Mosiah River        "
AA.65  = "Platte River        "
AA.66  = "Pudre River         "
AA.67  = "Virgin River        "
AA.68  = "Santa Clara River   "
AA.69  = "Kanab River         "
AA.70  = "Paria River         "
AA.71  = "San Juan River      "
AA.72  = "Escalante River     "
AA.73  = "Dirty Devin River   "
AA.74  = "Freemont River      "
AA.75  = "Price River         "
AA.76  = "Duchesne River      "
AA.77  = "Uinta River         "
AA.78  = "White Rocks River   "
AA.79  = "Strawberry River    "
AA.80  = "Kane Springs River  "
AA.81  = "Dolores River       "
AA.82  = "Jordan River        "
AA.83  = "Raft River          "
AA.84  = "Gallatin River      "
AA.85  = "Madison River       "
AA.86  = "Yellowstone River   "
AA.87  = "Gardner River       "
AA.88  = "Lemer River         "
AA.89  = "Wind River          "
AA.90  = "Red Bird River      "
AA.91  = "LIttle Big Horn     "
AA.92  = "Shoshone River      "
AA.93  = "Greybull River      "
AA.94  = "Tongue River        "
AA.95  = "Niobrara River      "
AA.96  = "Chyenne River       "
AA.97  = "Sweatwater River    "
AA.98  = "Laramie River       "
AA.99  = "Encampment River    "
AA.100 = "Medicine Bow River  "
AA.101 = "Green River         "
AA.102 = "Blacks Fork River   "
AA.103 = "Yampa River         "
AA.104 = "Greys River         "
AA.105 = "Hoback River        "
AA.106 = "Gros Ventre River   "
AA.107 = "Lewis River         "
AA.108 = "Heart River         "
AA.109 = "Bear River          "
AA.110 = "Belle Fourche River "
AA.111 = "Salt River          "
AA.112 = "Lehi River          "
AA.113 = "Fall River          "
AA.114 = "Gibbon River        "
AA.115 = "Lamar River         "
AA.116 = "Nowood River        "
AA.117 = "Cumberland River    "
AA.118 = "Brigham River       "
AA.119 = "Pond River          "
AA.120 = "Mud River           "
AA.121 = "Barren River        "
AA.122 = "Gasper River        "
AA.123 = "Rough River         "
AA.124 = "Tradewater River    "
AA.125 = "Laurel River        "
AA.126 = "Kentucky River      "
AA.127 = "Licking River       "
AA.128 = "Blood River         "
AA.129 = "Dix River           "
AA.130 = "Nolin River         "
AA.131 = "Rock Castle River   "
AA.132 = "Wolf River          "
AA.133 = "Bull River          "
AA.134 = "Half Moon River     "
AA.135 = "Wilmington River    "
AA.136 = "Odingsell River     "
AA.137 = "Vernon River        "
AA.138 = "Canoochee River     "
AA.139 = "Belfast River       "

/*--- Determine Array Size ---*/
DO AC=1 UNTIL  AA.AC==""; END
AC = AC - 1
AA.0 = AC

RETURN