The Museum of HP Calculators

HP Forum Archive 15

[ Return to Index | Top of Index ]

How to alphabetically sort an alpha XM-file (HP-41)
Message #1 Posted by Geir Isene on 29 Jan 2006, 8:15 a.m.

What is the best, most efficient way of alphabetically sorting an ascii exended memory file on the HP-41?

      
Re: How to alphabetically sort an alpha XM-file (HP-41)
Message #2 Posted by Raymond Del Tondo on 29 Jan 2006, 10:40 a.m.,
in response to message #1 by Geir Isene

Have you tried the SORTFL function of the CCD module?

            
Re: How to alphabetically sort an alpha XM-file (HP-41)
Message #3 Posted by Geir Isene on 29 Jan 2006, 10:53 a.m.,
in response to message #2 by Raymond Del Tondo

Good tip. Don't have the CCD (waiting for it). I would however need a routine that doesn't use functions outside a standard HP-41CX (to make my upcomming PDA program usable for most people).

            
Re: How to alphabetically sort an alpha XM-file (HP-41)
Message #4 Posted by Geir Isene on 30 Jan 2006, 1:54 a.m.,
in response to message #2 by Raymond Del Tondo

It seems the SORTFL function only sort data registers in XM.

                  
Re: How to alphabetically sort an alpha XM-file (HP-41)
Message #5 Posted by Ángel Martin on 30 Jan 2006, 7:11 a.m.,
in response to message #4 by Geir Isene

That's right, SORTFL can only deal w/ data files (or matrix files if you've changed its file type previously). ASCII files are trickier in that each record can have multiple "registers" (7-words each), thus the file type change trick won't work in this case.

No substitute to plain old RPN programming in this case, or so it looks.

Best,

ÁM

                        
Re: How to alphabetically sort an alpha XM-file (HP-41)
Message #6 Posted by Geir Isene on 30 Jan 2006, 7:36 a.m.,
in response to message #5 by Ángel Martin

Excuse my ignorance: Matrix files, what's that?

                              
Re: How to alphabetically sort an alpha XM-file (HP-41)
Message #7 Posted by Valentin Albillo on 30 Jan 2006, 8:20 a.m.,
in response to message #6 by Geir Isene

Geir Isene posted: "Excuse my ignorance: Matrix files, what's that? "

    They're files created by the Advantage ROM, which can directly create and use matrices stored in extended memory. This way you use no numeric registers at all to store matrices, greatly simplifying most matricial programs.

    In some cases your program can run even using no numeric registers at all (and no 'synthetic' registers M,N, etc., either), this is, even with SIZE 000. See my 62-line, SIZE 000 Nth-degree Polynomial Fit program featured in my Datafile article Long Live the Advantage ROM !

Best regards from V.
      
Re: How to alphabetically sort an alpha XM-file (HP-41)
Message #8 Posted by Geir Isene on 3 Feb 2006, 4:40 p.m.,
in response to message #1 by Geir Isene

Here we go (sorts only ascii files with records of max 24 characters - that's all I need for the "HP-41: The Reminder"-program):

001 *LBL "FLSORT"
002  LBL 01
003  0
004  SEEKPT
005  SF 25
006  GETREC
007  SF 05
008  FC? 25
009  GTO 03
010  SF 25
011  LBL 02
012  ASTO 05
013  GETREC
014  FC? 25
015  GTO 03
016  5
017  ENTER
018  ASTO X
019  X>NN?
020  GTO 02
021  CF 05
022  DELREC
023  RCLPT
024  1
025  -
026  SEEKPT
027  INSREC
028  1
029  +
030  SEEKPT
031  GTO 02
032  LBL 03
033  FC?C 05
034  GTO 01
035  CLA
036  CLST
037  SEEKPT
038  END

Edited: 4 Feb 2006, 3:02 a.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall