home *** CD-ROM | disk | FTP | other *** search
-
-
- September 17, 1991 RPSORT Examples Page i
-
- Table of Contents
- -----------------
-
- Suggestion On How To Use This Document 1
- General Rules For Entry Of Parameters 1
- Cautionary Note On Specifying The Output File To RPSORT 1
-
- Examples That Could Be Executed By The DOS SORT 2
- 1. RPSORT As A Filter 2
- 2. Sending Output To The Screen 2
- 3. Specifying A Sort Key 2
- 4. Reverse (Descending) Sort 2
- 5. Using Pipes With RPSORT. 2
-
- Examples Of General Interest 3-8
- 6. Using RPSORT Not As A Filter 3
- 7. Fixed Length Records 3
- 8. Multiple Input Files 3
- 9. ASCII (Case Sensitive) Sort 3
- 10. Reverse (Descending) Sort 3
- 11. Reverse ASCII Sort 4
- 12. Specifying Key Length 4
- 13. Specifying Key Length But No Start Column 4
- 14. Multiple Sort Keys 4
- 15. Another Example Of Multiple Sort Keys 4
- 16. Sort DIR Listing With Multiple Sort Keys 5
- 17. Make ASCII Sequence The Default 5
- 18. Make Reversed (Descending) Sort The Default 5
- 19. Make Both ASCII And Reversed The Default 6
- 20. Delete Null Lines 6
- 21. Delete Lines/Records With Duplicate Keys 6
- 22. Delete Lines/Records If They Are Completely Identical 6
- 23. Specify Drive For Temporary Files 6
- 24. Ignore Ctrl-Z And Use The Entire File 7
- 25. Suppress Copyright And Successful Completion Messages 7
- 26. Put Error Messages In A File 7
- 27. Suppress Copyright Message And Put Error Messages In A File 7
- 28. Tell RPSORT To Ignore Any Ctrl-Break From The Keyboard 7
- 29. Expanding Tabs In A File 8
-
- Examples Of Special Interest To Computer Programmers 9-11
- 30. C Language String As Sort Key 9
- 31. Mixing C Language Strings And Regular Strings 9
- 32. Turbo Pascal String As Sort Key 9
- 33. Mixing Turbo Pascal Strings And Regular Strings 9
- 34. Make C Language Strings The Default 10
- 35. Make Turbo Pascal Strings The Default 10
- 36. Signed Binary Integer As Sort Key 10
- 37. Turbo Pascal String And Signed Binary Integer 10
- 38. Unsigned Binary Integer As Sort Key 11
- 39. 80x87 Floating Point Number As Sort Key 11
- 40. BASICA & GWBASIC Floating Point Number As Sort Key 11
- 41. Turbo Pascal Real Number As Sort Key 11
-
- List Of Various Compiler And Interpreter Numeric Data Types 12
-
-
-
- September 17, 1991 RPSORT Examples Page 1
-
-
- Usage: RPSORT [/Q] [/Eerrfile] [/]? [inputfile[+inputfile]]
- [outputfile] [/A] [/B] [/C] [/D] [/Fnnnn] [/N] [/P]
- [/R] [/Td] [/Z] [sort key defin. . .]
-
- Sort key defin syntax: /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
-
-
- Suggestion On How To Use This Document
-
- The syntax for RPSORT is simpler than the forbidding usage specification,
- above, might suggest. There are three kinds of parameters:
-
- . Filespecs. For the input to RPSORT you can have either a single
- filespec or a list of filespecs separated by plus signs. For the
- output only a single filespec is allowed.
-
- . Switches. These are a slash followed by a letter indicating the type
- of switch. Some switches also include a number, filespec or drive.
-
- . Sort key definitions. These are a slash followed by a plus sign ("/+")
- and one or more attributes which define a sort key.
-
- In this document, I start with the simplest examples and build up to
- examples that include several parameters. Eventually every type of
- parameter that RPSORT supports appears at least once.
-
- Many of the parameters are only described once or twice when they first
- appear in examples. Though they may be used in subsequent examples they
- will not be described there. Therefore, I suggest that the best idea
- would be to scan the examples in order rather than skipping around to
- topics of interest.
-
-
- General Rules For Entry Of Parameters
-
- . All parameters may be entered in upper or lower case as you choose. As
- far as RPSORT is concerned, there is no difference.
-
- . The parameters may be entered in any sequence except as noted in the
- discussion of some RPSORT examples.
-
- . In the commands below, I separate the parameters with spaces for clarity.
- RPSORT generally accepts spaces between parameters but does not require
- them except as noted in the discussion of some RPSORT examples.
-
-
- Cautionary Note On Specifying The Output File To RPSORT
-
- . If you specify a filespec, for the output, whose path and filename are
- the same as that for an existing file, the latter will be replaced by the
- output from RPSORT. If this is what you want, fine, but if you don't
- want to lose the existing file then use a different name for the output.
-
-
-
- September 17, 1991 RPSORT Examples Page 2
-
-
- Usage: RPSORT [/Q] [/Eerrfile] [/]? [inputfile[+inputfile]]
- [outputfile] [/A] [/B] [/C] [/D] [/Fnnnn] [/N] [/P]
- [/R] [/Td] [/Z] [sort key defin. . .]
-
- Sort key defin syntax: /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
-
-
- Examples That Could Be Executed By The DOS SORT
-
- The first five examples are commands that could be executed by DOS SORT
- but RPSORT does them much faster and can do them for much larger files.
-
-
- 1. RPSORT is here used as a filter which is the only option for the DOS
- SORT. No sort key is defined, so the sort key is the entire line.
- The default for RPSORT and the only option for the DOS SORT is that:
-
- . The input is a text file consisting of lines each ending with a CRLF
- (i.e. a carriage return and a line feed.)
- . The sort key is case insensitive. Lower case letters sort equal to
- upper case letters and foreign letters, punctuation and currency
- symbols sort equal to their American English equivalents.
-
- RPSORT <MYINPUT.DAT >C:\MYSORTED.DAT
-
-
- 2. No output file is specified, so output goes to the screen. You must
- specify an input file for RPSORT. Unlike the DOS SORT, it doesn't
- accept input data from the keyboard.
-
- RPSORT <MYINPUT.DAT
-
-
- 3. The sort key starts at column 12 and consists of the rest of the line.
- This is the only option for the DOS SORT and the default for RPSORT.
- One sort key is listed which is all that the DOS SORT allows.
-
- RPSORT /+12 <D:\MYDIR\INPUT.TXT >D:\OTHERDIR\SORTED.DAT
-
-
- 4. The /R switch tells RPSORT to do a reverse (descending) sort. The
- sort key starts at column 23.
-
- RPSORT /R /+23 <DATA.TXT >SORT.TXT
-
-
- 5. Sorts a DIR listing by the file extension (extension is at column 10)
- and lists one page at a time. The output of the DIR command is piped
- to RPSORT the output from RPSORT is piped to the MORE command. If you
- sort the default directory, the listing might include two strange file
- names. These are temp files created by DOS to hold data being piped.
-
- DIR C:\*.* | RPSORT /+10 | MORE
-
-
-
- September 17, 1991 RPSORT Examples Page 3
-
-
- Usage: RPSORT [/Q] [/Eerrfile] [/]? [inputfile[+inputfile]]
- [outputfile] [/A] [/B] [/C] [/D] [/Fnnnn] [/N] [/P]
- [/R] [/Td] [/Z] [sort key defin. . .]
-
- Sort key defin syntax: /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
-
-
- Examples Of General Interest
-
-
- 6. RPSORT does not have to be used as filter. The files can be specified
- without redirection. You must always enter the input filespec first
- and the output filespec second. The sort key starts at column 4 and
- consists of the rest of the line.
-
- RPSORT /+4 MYINPUT.TXT D:\DATADIR\SORTOP.DAT
-
-
- 7. RPSORT can sort fixed length records. The /F75 switch says that the
- input consists of records each 75 bytes long. It is not required that
- the records end with a CRLF but if they do, the record length given by
- the /F switch must include the two bytes for the CRLF. The sort key
- starts at column 13 and consists of the rest of the record.
-
- RPSORT /F75 /+13 B:INPUT.DAT SORTED.DAT
-
-
- 8. For the input, you can list muliple filespecs separated by plus signs.
- No spaces are allowed between the input filespecs only plus signs.
- RPSORT combines the input files and sorts them as one. The combined
- sorted output is then written to the single output file.
-
- RPSORT INPUT1.DAT+C:\MYDIR\INPUT2.DAT+INPUT3.DAT OUTPUT.DAT
-
- Note that wildcard characters (* or ?) are not allowed in any filename.
-
-
- 9. The sort key starts at column 7 of the 90 byte record. This is an
- ASCII (case sensitive) sort as indicated by the A in the sort key
- definition.
-
- The sequence is per the ASCII value assigned to each character. This
- puts the digits 0 through 9 before any letters and puts all of the
- upper case letters before any of the lower case letters.
-
- RPSORT /F90 /+7A DATA.DAT SORT.DAT
-
-
- 10. The sort key starts at column 11 of the line. It will be sorted in
- the descending case insensitive sequence as indicated by the R in the
- sort key definition. This is also called a descending sort.
-
- RPSORT /+11R MYIP.DAT B:MYSORT.DAT
-
-
-
- September 17, 1991 RPSORT Examples Page 4
-
-
- Usage: RPSORT [/Q] [/Eerrfile] [/]? [inputfile[+inputfile]]
- [outputfile] [/A] [/B] [/C] [/D] [/Fnnnn] [/N] [/P]
- [/R] [/Td] [/Z] [sort key defin. . .]
-
- Sort key defin syntax: /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
-
-
- Examples Of General Interest (continued)
-
-
- 11. The sort key starts at column 6 of the 60 byte record. It will be
- sorted in the descending ASCII (case sensitive) sequence as indicated
- by the A and R attributes in the sort key definition.
-
- RPSORT /F60 /+6AR IP1.DAT+IP2.DAT OP.DAT
-
-
- 12. An ASCII sort key starts at position 11 of the line and is 7
- characters long. A colon followed by a number, in a sort key
- definition, represents the length of the sort key.
-
- RPSORT /+11:7A DATA1.DOC+B:DATA2.DOC SORTDATA.DOC
-
-
- 13. The case insensitive sort key starts at column 1, by default, because
- the starting column is not given in the sort key definition. The key
- is 9 bytes long.
-
- RPSORT /F80 /+:9 INPUT.DAT OUTPUT.DAT
-
-
- 14. You can list as many sort keys definitions, as you like, provided they
- fit within the command line (maximum of 127 bytes). The first sort
- key is 6 bytes starting at column 13, the second is an 8 byte ASCII
- key at column 1 and the third a 4 byte key at column 19.
-
- A sort involves comparing two lines at a time in order to sequence
- them correctly. RPSORT compares two lines by comparing the sort keys
- in the same order as their listing in the command line.
-
- The first unequal compare, if any, determines the sequence of the two
- lines. If all the sort keys are equal then the lines are sequenced
- per their positions in the input file.
-
- RPSORT /+13:6 /+:8A /+19:4 DATA1.TXT+DATA2.TXT SORT.TXT
-
-
- 15. Another example of multiple sort keys this time for a fixed length
- record. The first sort key uses the descending ASCII sequence, the
- second uses the case insensitive sequence and the third uses the
- descending case insensitive sequence.
-
- RPSORT /F50 /+15:3AR /+4:7 /+21:9R INPUT.DAT SORTEDIP.DAT
-
-
-
- August 24, 1991 RPSORT Examples Page 5
-
-
- Usage: RPSORT [/Q] [/Eerrfile] [/]? [inputfile[+inputfile]]
- [outputfile] [/A] [/B] [/C] [/D] [/Fnnnn] [/N] [/P]
- [/R] [/Td] [/Z] [sort key defin. . .]
-
- Sort key defin syntax: /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
-
-
- Examples Of General Interest (continued)
-
-
- 16. Here RPSORT is used as a filter with the input coming from a DIR
- command and the sorted output going to a MORE command which displays
- the output one screen at a time. The effect of the sort keys is to
- sort the directory entries by creation date (first by year then by
- month and day) and by file name and extension within creation date.
-
- DIR D:\*.* | RPSORT /+30:2 /+24:5 /+:12 | MORE
-
- If you are sorting the default directory, the listing might contain
- two strange file names. These are temporary files created by DOS to
- hold the data being piped.
-
- If you have DOS 5.0 you don't a sort utility to produce a sorted
- directory listing. Instead you can use the new "/O" switch. The
- following command achieves a similar effect as the previous one except
- that it sorts on both the creation date and time:
-
- DIR D:\*.* /P /ODNE
-
-
- 17. The /A switch tells RPSORT that both sort keys, in the example, are to
- be sorted according to the ASCII sequence. The first key uses the
- regular ASCII sequence while the second sort key uses the descending
- ASCII sequence as indicated by the R attribute.
-
- If you specify /A, there is no way to change it for an individual
- sort key. If you want some sort keys to be ASCII and some to be case
- insensitive, don't use /A but instead specify A in the appropriate
- sort key definitions.
-
- RPSORT /F120 /A /+19:4 /+3:9R MYDATA.DAT SORTDATA.DAT
-
-
- 18. The /R switch tell RPSORT to do a descending (reverse) sort for all
- the sort keys. The first key uses the descending ASCII sequence, as
- indicated by the A attribute, while the second sort key uses the
- descending case insensitive sequence.
-
- If you specify /R, there is no way to change it for an individual sort
- key. If you want some sort keys to be descending and some not, don't
- use /R but instead specify R for the appropriate sort key.
-
- RPSORT /R /+12:8A /+:11 IP.TXT OP.TXT
-
-
-
- September 17, 1991 RPSORT Examples Page 6
-
-
- Usage: RPSORT [/Q] [/Eerrfile] [/]? [inputfile[+inputfile]]
- [outputfile] [/A] [/B] [/C] [/D] [/Fnnnn] [/N] [/P]
- [/R] [/Td] [/Z] [sort key defin. . .]
-
- Sort key defin syntax: /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
-
-
- Examples Of General Interest (continued)
-
-
- 19. Here both /A and /R are specified. This means that all three sort
- keys will use the descending ASCII sequence.
-
- RPSORT /F90 /A /R /+1:7 /+11:5 /+8:3 DAT1.DAT SORT.DAT
-
-
- 20. The /N switch tells RPSORT to delete all null lines from the sorted
- output file. A null line contains only CRLF (a carriage return and a
- line feed) and nothing else. Lines that are all spaces and thus look
- like null lines when you list them will NOT be deleted.
-
- RPSORT /N /+3:9 /+1:2A INPUT.DOC SORTED.DOC
-
-
- 21. The /D switch tells RPSORT to delete from the sorted output all
- records whose sort keys duplicate those in a previous record. This
- will delete records that are not identical to a previous record
- because all that is required is that the sort keys be the same.
-
- RPSORT /F100 /D /+14:7 /+4:10R DATA.DAT SORTED.DAT
-
-
- 22. If you want to delete lines/records only if they are identical to a
- previous line/record, tack on /+A as the final sort key. Since this
- uses the entire line as an ASCII key, it means that the only time all
- keys will be equal is when the lines are identical.
-
- RPSORT /D /+14:7 /+4:10R /+A DATA.TXT SORTED.TXT
-
-
- 23. The /T switch tells RPSORT where to put any temporary files, it may
- require. In this case, /TC says to put them on the C drive.
-
- If the input file is small enough to fit into the available memory, it
- is sorted in one pass and temporary files are not required. Else,
- RPSORT reads and sorts the file a chunk at a time and writes the
- sorted chunks to a temporary file. Then RPSORT does one or more merge
- phases to combine the chunks into a single sorted output file.
-
- If the /T switch is not specified, RPSORT puts any temporary files on
- the default drive.
-
- RPSORT /TC /+9:12A /+23:11R BIGINPUT.DAT BIGSORT.DAT
-
-
-
- September 17, 1991 RPSORT Examples Page 7
-
-
- Usage: RPSORT [/Q] [/Eerrfile] [/]? [inputfile[+inputfile]]
- [outputfile] [/A] [/B] [/C] [/D] [/Fnnnn] [/N] [/P]
- [/R] [/Td] [/Z] [sort key defin. . .]
-
- Sort key defin syntax: /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
-
-
- Examples Of General Interest (continued)
-
-
- 24. The /Z switch tells RPSORT to ignore any Ctrl-Zs in a text file and to
- use the entire file. Normally RPSORT, like DOS, stops reading when it
- finds a Ctrl-Z in an input file. This is usually O.K. since the
- Ctrl-Z, if present, normally follows the last byte of actual data.
-
- However, if Ctrl-Zs appear in the middle of a text file then you must
- use /Z to get RPSORT to sort the entire file.
-
- RPSORT /Z /A /+1:5R /+11:3 DOWNLOAD.DAT SORTED.DAT
-
-
- 25. The /Q switch suppresses the display of the copyright message at the
- beginning and the successful completion message at the end. Error
- messages, if any, will still be displayed. This switch must be the
- first parameter on the command line.
-
- RPSORT /Q /F40 /+12:3A /17:4R INPUT.DAT OUTPUT.DAT
-
-
- 26. The /E switch, in this example, tells RPSORT to create the file
- MYERRORS.TXT and to direct any error or successful completion
- messages to that file. Except for the /Q switch, no other parameter
- should precede this switch in the command line.
-
- Since the /Q switch was not specified in this example, the copyright
- message will still appear on the screen. Any error or successful
- completion messages, if appropriate, will be sent to MYERRORS.TXT.
-
- RPSORT /EMYERRORS.TXT /2:9AR DATA.TXT SORTED.TXT
-
-
- 27. This example suppresses copyright and successful completion messages
- and sends any error messages to the file SORTERR.DAT.
-
- RPSORT /Q /ESORTERR.DAT /2:9AR DATA.TXT SORTED.TXT
-
-
- 28. Normally, RPSORT responds promptly to a Ctrl-Break from the keyboard
- and lets you terminate the sort. The /B switch, however, tells RPSORT
- to ignore Ctrl-Break and to continue with the sort until it is done.
-
- RPSORT /B /4:13R IP.DAT OP.DAT
-
-
-
- September 17, 1991 RPSORT Examples Page 8
-
-
- Usage: RPSORT [/Q] [/Eerrfile] [/]? [inputfile[+inputfile]]
- [outputfile] [/A] [/B] [/C] [/D] [/Fnnnn] [/N] [/P]
- [/R] [/Td] [/Z] [sort key defin. . .]
-
- Sort key defin syntax: /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
-
-
- Examples Of General Interest (continued)
-
-
- 29. If your input file contains tabs and they need to be expanded to the
- proper number of spaces for your sort keys to line up properly, then
- RPSORT will not sort it correctly because RPSORT does not expand the
- tabs. As a convenience, for those who face this problem, I have
- included a program called RPTAB in this package. It reads your file
- and produces an output file that is the same except that the tabs have
- been expanded. The syntax is:
-
- RPTAB input-filespec output-filespec [tabstop...]
-
- The parameters must be given in the indicated sequence. Specifying
- tab stops is optional. If you specify none, the default tab stops are
- at positions 1, 9, 17, 25, 33... and so on at intervals of eight
- columns. If you do specify tab stops they must be a sequence of
- integers each greater than the preceding one. The first tab stop is
- always at column 1 and you need not specify it. RPTAB follows the
- rule that the interval between the last two specified tab stops
- implies subsequent tab stops at the same interval.
-
- The following command expands tabs to the default tab stops:
-
- RPTAB MYTABS.DAT MYSPACES.DAT
-
- The following command:
-
- RPTAB MYTABS.DAT MYSPACES.DAT 6 15 27
-
- tells RPTAB that the tab stops are at positions 1, 6, 15, 27, 39, 51...
- etc. The interval of 12 between 15 and 27 is propagated to subsequent
- tab stops.
-
- After creating MYSPACES.DAT as in the above examples, you could then
- use RPSORT to sort it in the usual way.
-
-
-
-
- September 17, 1991 RPSORT Examples Page 9
-
-
- Usage: RPSORT [/Q] [/Eerrfile] [/]? [inputfile[+inputfile]]
- [outputfile] [/A] [/B] [/C] [/D] [/Fnnnn] [/N] [/P]
- [/R] [/Td] [/Z] [sort key defin. . .]
-
- Sort key defin syntax: /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
-
-
- RPSORT Examples Of Special Interest To Computer Programmers
-
-
- 30. The attribute C in a sort key definition says that the key is a C
- language string. This means that a binary zero, if present,
- terminates the string. Specify a key length equal to the maximum
- length for the string. For example, if you define "char mystr[7]" in
- your C program then you should specify a key length of 7 to RPSORT.
-
- In this example, the first sort key is a C style string at column 1
- whose maximum length is 7. The second key is a C style string at
- column 25 with maximum length 5.
-
- RPSORT /F95 /+:7ACR /+25:5C CSTRING.DAT SORTCSTR.DAT
-
-
- 31. RPSORT allows some of your sortkeys to be C style strings and some to
- be regular character strings as in this example.
-
- RPSORT /F80 /+13:12C /+5:5 DATA.DAT SORT.DAT
-
-
- 32. The attribute P in a sort key definition says that the key is a Turbo
- Pascal string. This means that the first byte of the key is a binary
- integer representing the length of the actual string.
-
- You should specify a key length equal to one plus the maximum possible
- length for the string. For example, if you define "string[9] in your
- Pascal program then you should specify a key length of 10 to RPSORT.
- The one extra allows for the length byte. Pascal strings are only
- allowed as sort keys in fixed length records.
-
- In this example, the first sort key is a Pascal style string at column
- 3 whose maximum length is 9 (one less than the length of the key. It
- is to be sorted per the descending ASCII sequence. The second key is
- a Pascal style string at column 12 with a maximum length of 8. It is
- to be sorted per the case insensitive sequence.
-
- RPSORT /F70 /+3:10APR /+12:9P PSTRING.DAT SORTPSTR.DAT
-
-
- 33. RPSORT allows some of your sortkeys be Pascal style strings and some
- to be regular character strings as in this example.
-
- RPSORT /F60 /+9:10 /+1:8P PASCAL.DAT SORT.DAT
-
-
-
- September 17, 1991 RPSORT Examples Page 10
-
-
- Usage: RPSORT [/Q] [/Eerrfile] [/]? [inputfile[+inputfile]]
- [outputfile] [/A] [/B] [/C] [/D] [/Fnnnn] [/N] [/P]
- [/R] [/Td] [/Z] [sort key defin. . .]
-
- Sort key defin syntax: /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
-
-
- RPSORT Examples Of Special Interest To Computer Programmers (continued)
-
-
- 34. The /C switch tells RPSORT that all your character string sort keys
- are to be treated as C style strings. If you specify /C, you can't
- over-ride it for an individual sort key. If you want some string keys
- to be C style strings and some not, don't use /C. Instead, specify C
- in the appropriate sort key definitions.
-
- RPSORT /F67 /C /+3:9A /+23:7 DATA.DAT SORT.DAT
-
-
- 35. The /P switch tells RPSORT that all your character string sort keys
- are to be treated as Pascal style strings. If you specify /P, you
- can't over-ride it for an individual sort key. If you want some
- string keys to be Pascal strings and some not, don't use /P but
- instead specify P in the appropriate sort key definitions.
-
- Note that /C and /P are mutually exclusive.
-
- RPSORT /F98 /P /+23:11 /+12:67A DATA.DAT SORT.DAT
-
-
- The remaining examples include sort keys which are binary numbers of some
- type. The table on page 12 lists the appropriate type and length
- attributes for the binary number formats defined in several popular
- compilers and interpreters. Binary number sort keys are only allowed in
- fixed length records.
-
-
- 36. The I attribute tells RPSORT that the first sort key, in this example,
- is a signed binary integer. RPSORT supports binary integers of any
- length. In this case the length of 8 would be appropriate for number
- of the "comp" type in Turbo Pascal.
-
- RPSORT /F112 /+12:8I /+1:9P INTEGER.DAT SORTINT.DAT
-
-
- 37. This example produces the exact same result as the previous one.
- Note that instead of using the P attribute in the second sort key
- definition, I used the /P switch. The important point is that while
- the /P switch would apply to all character string keys it does not
- apply to the first sort key because that is defined as a binary number
- sort key.
-
- RPSORT /F112 /P /+12:8I /+1:9 INTEGER.DAT SORTINT.DAT
-
-
-
- September 17, 1991 RPSORT Examples Page 11
-
-
- Usage: RPSORT [/Q] [/Eerrfile] [/]? [inputfile[+inputfile]]
- [outputfile] [/A] [/B] [/C] [/D] [/Fnnnn] [/N] [/P]
- [/R] [/Td] [/Z] [sort key defin. . .]
-
- Sort key defin syntax: /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
-
-
- RPSORT Examples Of Special Interest To Computer Programmers (continued)
-
-
- 38. The U attribute tells RPSORT that the second sort key is an unsigned
- binary integer of length 2. RPSORT supports binary integers of any
- length. In this case the length of 2 would be appropriate for an
- "unsigned int" in Turbo C.
-
- RPSORT /F97 /+2:11C /+12:2U UNSIGNED.DAT SORT.DAT
-
-
- 39. The F attribute tells RPSORT that the first sort key, in this example,
- is an 80x87 floating point number. RPSORT supports three different
- precisions of these numbers. The table below gives the lengths for
- each precision and the names assigned to them by Intel and by three
- popular compilers.
-
- Length Intel QuickBasic Turbo Pascal Turbo C
- ------ ---------- ---------- ------------ -------
- 4 short real single single float
- 8 long real double double double
- 10 temp real N/A extended long double
-
- In this example the length of 8 would be appropriate for a sort key of
- type double in any of the three compilers listed above.
-
- RPSORT /F125 /+:8F /+13:4 FLOAT.DAT SORT.DAT
-
-
- 40. The M attribute tells RPSORT that the second sort key is a floating
- point number of the type supported by BASICA, GWBASIC and older
- versions of QuickBASIC (v3.0 and earlier). RPSORT supports the 4 byte
- single precision and the 8 byte double precision formats.
-
- RPSORT /F92 /+13:8C /+2:4M BASICA.DAT SORT.DAT
-
- 41. The T attribute tells RPSORT that the first sort key is a Turbo Pascal
- type "real" number. This was the only floating point type in Turbo
- Pascal versions 1.0 through 3.0. It is still supported in version 6.0
- but Turbo Pascal has now added the 80x87 floating point types (see
- example 39 above and the table on page 12).
-
- I did not specify any length attribute because the length for this
- type is always 6. If you do specify a length, it must be 6.
-
- RPSORT /F87 /+10T /+3:7P PASCAL.DAT SORT.DAT
-
-
-
- September 17, 1991 RPSORT Examples Page 12
-
-
- The following table lists the type and length attributes for the binary
- numeric types available in a few programming language compilers and
- interpreters.
-
-
- Compiler Or Interpreter Number Type Type Attribute Length Attribute
- ----------------------- ----------- -------------- ----------------
- Microsoft QuickBASIC Integer I 2
- v4.0 and later & Long I 4
- Microsoft QBASIC Single F 4
- Double F 8
-
- Microsoft QuickBASIC Integer I 2
- v3.0, 8087 Single F 4
- Double F 8
-
- IBM BASICA & Integer I 2
- Microsoft GWBASIC & Single M 4
- Microsoft QuickBASIC Double M 8
- v1.0, v2.0 and v3.0 non-8087
-
- Turbo Pascal Shortint I 1
- v4.0 and later Integer I 2
- Longint I 4
- Byte U 1
- Word U 2
- Real T 6
- Single F 4
- Double F 8
- Extended F 10
- Comp I 8
-
- Turbo Pascal Integer I 2
- v3.0 8087 Byte U 1
- Real F 8
-
- Turbo Pascal Integer I 2
- v1.0, v2.0 and v3.0 non-8087 Byte U 1
- Real T 6
-
- Borland/Turbo C signed char I 1
- unsigned int U 2
- short int I 2
- int I 2
- unsigned long U 4
- long I 4
- float F 4
- double F 8
- long double F 10
-
-
-