Unisort

Authors

Publication

Pub Details

Date

Pages

See all articles from SUM v3 n8

“UNISORT” is a universal sort program. It will do numeric as well as alpha sorts. It is a utility program in that it has no defined areas – they must be entered. The program receives input to sort from tape and will output the same. Sorted data is saved in K$. The only holds are:

  1. Max columns to sort is 32
  2. Program uses 2056 bytes
  3. Sort output will be in this order:
    • Numeric
    • Cap Alpha
    • Sm Alpha
  4. File name max 6 chars.

Type program in just as shown. For tape save of program, enter GOTO 9000 (will save three times) then rewind tape and tape verify.

Load program as “UNISORT”. Once loaded, enter RUN and answer the prompts.

  • 1st enter ROW count – if the array is DIM(ed) (100,30), ROW count is 100.
  • 2nd enter COLUMN count – if an array is DIM (ed) (100,30), COLUMN count is 30
  • 3rd enter END sort column – if area to be sorted is columns 10 to 18, END column is 18.
  • 4th enter BEG sort column – if area to be sorted is columns 10 to 18, BEG column is 10.

Next request will be to enter array file name – max 6 positions.

Note: at the end of the sort, a prompt will ask if you want to SAVE or PRINT. PRINT will scroll the the sorted columns in sequence on the screen till done and then return to the prompt. Each save is done three times.

Products

 

Media

 

Image Gallery

Source Code

     1 REM "Universal Sort - #/Alpha"
     5 CLS : PRINT "SORT-EMORY"
    10 PRINT "Enter ROW count Tl.": INPUT a: PRINT AT 1,25;a
    15 PRINT "Enter COLuMN count Tl.": INPUT b: PRINT AT 2,25;b
    18 PRINT "Prog. max 32 Column Sort"
    20 PRINT "Enter End Sort Column": INPUT c: PRINT AT 4,25;c
    25 PRINT "Enter Beg Sort Column": INPUT d: PRINT AT 5,25;d
    26 PRINT "Sort output will be in order by NUMERIC-ALPHA"
    30 PRINT "If input is correct then      press 1 if not press 2"
    35 IF INKEY$="1" THEN GO TO 100
    40 IF INKEY$="2" THEN GO TO 5
    45 GO TO 35
   100 CLS : PRINT "Enter 6-pos file name or less": DIM F$(1,6): INPUT F$(1)(1 TO 6): DIM K$(a,b)
   105 CLS : PRINT "Load File-ready-press enter": PAUSE 32800: CLS
   110 LOAD F$(1)(1 TO 6) DATA K$()
   115 PRINT "File Loaded-Press Enter": PAUSE 32800: CLS : GO TO 1000
   130 PRINT "Load Recorder w/blank tape     will save twice-press enter": PAUSE 32800: CLS
   135 SAVE F$(1)(1 TO 6) DATA k$(): SAVE F$(1)(1 TO 6) DATA K$()
   140 PRINT "Rewind tape for VERIFICATION    press enter when ready": PAUSE 32800: CLS
   145 VERIFY F$(1)(1 TO 6) DATA K$(): VERIFY F$(1)(1 TO 6) K$()
   150 PRINT "Verification of sort completed": STOP
  1000 DIM X$(a,b): DIM Y$(1): DIM P$(1,32): CLS
  1010 LET e=c-d: LET e=e+1
  1015 LET q=c
  1020 CLS : LET w=31
  1021 LWET w=w+1
  1023 IF w<33 or w>47 THEN GO TO 1026
  1025 GO TO 1021
  1026 IF w<58 or w>64 THEN GO TO 1028
  1027 GOTO 1021
  1028 IF w<91 or w>95 THEN GOTO 1030
  1029 GO TO 1021
  1030 PRINT AT 1,17;w;" ";CHR$ w
  1031 IF w=123 THEN GO TO 1080
  1035 LET Y$=CHR$ w
  1040 FOR n=1 TO a
  1041 IF K$(n)(d to c)=P$(1)(1 TO e) THEN GO TO 1050
  1045 IF k$(n)(q)=Y$ THEN GO TO 1060
  1050 NEXT n
  1055 GO TO 1021
  1060 FOR m=1 TO a
  1065 IF X$(m)(d TO c)=P$(1)(1 TO e) THEN LET X$(m)(1 TO b)=KL$(n)(1 to b): GO TO 1050
  1070 NEXT m
  1075 CLS : PRINT "Run ERROR-Restart Fr Beg.": STOP
  1080 DIM K$(a,b)
  1085 FOR n=1 TO a
  1090 LET K$(n)(1 TO b)=X$(n)(1 TO b)
  1095 NEXT n
  1100 DEIM X$(a,b)
  1105 LET q=q-1
  1110 IF q=d-1 THEN PRINT "Sort Ended-Press Enter": PAUSE 32800: CLS : GO TO 2000
  1115 GO TO 1020
  2000 CLS : PRINT "Press 1 to SCREEN Prt Sorted    Columns 2 to SAVE File"
  2005 IF INKEY$="1" THEN CLS : GO TO 3000
  2010 IF INKEY$="2" THEN CLS : GO TO 130
  2015 GO TO 2005
  3000 CLS
  3005 FOR n=1 to a
  3010 PRINT K$(n)(d to c)
  3015 NEXT n
  3020 PRINT "Print Ended-Press Enter": PAUSE 32800: CLS : GO TO 2000
  9000 SAVE "UNISORT": SAVE "UNISORT": SAVE "UNISORT"
  9005 PRINT "REWIND-press enter": CLS
  9010 VERIFY "UNISORT": VERIFY "UNISORT": VERIFY "UNISORT"
  9015 LIST
Scroll to Top