Sorting in a business environment is a "Good Thing"
When dealing with serial media, such as magnetic tapes (and decks of cards), sorting is often "a good thing".
Various card oriented tasks, such as billing operations, payroll, inventory control, are made faster and more convenient if the records are sorted by customer number, or stock number.
(Random access based storage, (such as disk) is a completely different matter, and not discussed here.)
We expect tapes to move and spin
In the movies, and oddly in real life, groups of magnetic tape drives moving tape in a jerky fashion, then suddenly the tape reels spinning backward, then jerking tape forward again, - that is tape sorting - is what business data processing did for hours a day.
With great perseverance by the tape crew, we may be able to get three tape drives working reliably :-))
Three tape drives is the absolute practical minimum for practical tape sorting. Doing it with less is a silly exercise.
Everyone wants to see tapes move, and hear them chatter like a machine gun,
and the rewind of a 729 tape drive is a wonder to behold.
One can do some random things with tape drives,
but everyone gets a sense of serious purpose watching a group of tape drives doing a sort. -
So - how can we provide a 3 tape sort, to thrill our guests, and of course ourselves?
Note: SORT 7 requires a minimum of 4 working tapes - currently only a dream -
The Royal "We" write a three tape sort. Royal in the sense of a King saying
" 'We' will work harder".
No one expects the King to swing a hammer, pull a plow, ... harder ;-))
Constraints & Problems:
- Our guests & docents do not have the time liberty (or patience) to watch a full tape get sorted.
- The Demo should be complete in say 30 to 60 second - likely -
- 729 tape drives, with say 15 to 60 seconds of tape on the reel do not go into the full scale rewind :-((
- To keep life simple:- mount and rewind three scratch tapes
- The computer writes 80 character records with say random 5 character sort keys to one tape
- - print say the first 20 records and keys, then top of form
- Until 60 seconds or a sense key operated
- The sort/merge phases begin and continue
- When the merge is completely sorted, and rewound
- - print say the first 20 records and keys, then top of form
- Rewind the merge scratch tape, (the sort tapes are already rewound)
Writing the above is an "exercise for the student".
Dealing with imperfect tape and the imperfect world is more difficult !!
If 1401 tape I/O subroutines are not available,
Van Snyder offers the following (Aug 5, 2009)
Ed: Tape I/O and error handling on 1401 aren't very difficult. See A24-3069. [2.4 megabytes] The buffer areas are addressed at the low-core end and continue until a group mark with a word mark. In the case of writing, the buffer is written from the addressed character up to the next one having a group mark with a word mark. In the case of reading, the record is read until it is completely read or a character in core has a group mark with a word mark, whichever happens first. A group mark is deposited in core after the last character read. In either case, after the transfer the B address register is one after the last character transferred. You can read and write with or without word marks. The op codes are M without word marks and L with word marks. The A address is the tape drive address, %U1 .. %U6 for even parity, % B1 .. %B6 for odd parity. Overlap adds some complications so let's not think about that now. The B address is the buffer start address. The D modifier is R to read and W to write, or you can use the Autocoder mnemonics RT, RTW, WT, WTW (with these the A address is just the unit number 1..6, not %U1..%U6). Tape control uses the U op code (Autocoder mnemonic is CU). The A address is the unit number. The D modifier is R for rewind, U for rewind and unload, B for backspace, E for skip and blank tape (this actually sets an "erase" switch that is examined during the next write so it doesn't matter which unit number you select), M to write an end-of-file mark, and A for "diagnostic read" which skips a record and checks for error and end-of-file without transferring any data. Autocoder mnemonics that don't need D modifiers are RWD, RWU, BSP, SKP and WTM. Diagnostic read doesn't have a special Autocoder mnemonic. A read routine should check for noise records (usually defined as 12 characters or less), and clear the GM the TAU deposits if the buffer has word marks. You can do length checking if you feel like it by looking for the GM where you expect it before clearing it. I used to set aside a buffer with an extra two characters to detect long records, then look for the GM in the right place Here are some simple I/O routines (no length checking). rdtape sbr rdexit&3 mz *-6,azone make character the tape can't transfer mcw azone,test&7 lca gmwm,buf&999 rdagin za err rdinst mcw azone,buf&11 rt 1,buf mcw err clobber gm bef done test bce rdinst,buf&11,0 check for noise ber rderr rdexit b 0-0 rderr a *-6,err bsp 1 bce rdinst,err-1,0 fewer than ten errors nop 666 h b rdagin azone dcw #1 If you know the records don't have GM in them, you can simplify the noise test (you don't need AZONE). If you don't have word marks in the read area you can leave out "mcw err": rdinst rt 1,buf bef done bce rdinst,buf&12,} chain12 wrtape sbr wrexit&3 wragin za err wrinst wt 2,buf bef full Tape reel is full, mount another one ber wrerr wrexit b 0-0 wrerr a *-6,err bsp 2 bce wrinst,err-1,0 fewer than ten errors skp 1 nop 1666 h b wragin err dcw #2 If you're reading into an area without word marks, you don't need to clobber the GM the TAU deposits, so you don't need to worry about clobbering the one that defines the end of the buffer, so you can do that with DCW instead of LCA. A package that checks and writes labels, and does length checking is attached. If you want to use it without label checking, clear the WM in the second character of the packet before branching to XXTAPE. I/O is a lot faster with blocked records. Let me know if you want to do this and I'll send some tips. An alternative is to use IOCS (C24-1462). IOCS can also do blocking. You'd have to use Real Autocoder since my cross-assembler doesn't do IOCS. Let me know if you want to do this and I'll tell you which Autocoder tapes have IOCS macros on them, and how to use them in SimH. Dick Weaver is an expert on tape I/O in general and IOCS in particular. Best regards, Van
return to main page