190. Rescuing files with "E" attribute on ADFS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I recently made a serious error. I intended to set the file attributes of a whole directory of InterWord files to "RL", using *ACCESS RL as usual. In a moment of carelessness, my finger missed the "R" key and hit the "E" instead; what a calamity! Once a file has the "E" attribute set, you cannot change it back again using the *ACCESS command. The file can only be executed, not LOADed or changed in any way. I was unable even to load my files into InterWord, as I got a spurious "File too long!" error message when I tried. I was more than a little dismayed, as although I had backup copies, they were not 100% up to date. I remembered reading in a magazine that it was possible to 'rescue' the files using a disc sector editor, but I couldn't find any trace of the article. I had no option but to figure it out for myself, and happily I was successful, after a bit of 'safe' fiddling about with a spare backup copy of the affected disc. Here's what to do: First, you need a disc sector editor, and I thoroughly recommend the one contained in the Advanced Disc Toolkit (ADT). Make a backup of the affected disc, as you cannot copy individual "E" files, and work on this disc, NOT the original! Next, you need to know the sector number of the catalogue containing the affected file(s). If it is the Root ($) directory, then it is always sector 2 (&02), ie track 0 sector 2. If it not the root directory, then move to the parent of that directory, ie the directory containing the directory containing the affected file. Eg if an affected file is called $.MYPROGS.FUN.DUMMY, then move to the $.MYPROGS directory. Type *INFO , where is the name of the directory containing the affected files, eg FUN in the example above. The result will be the 2-digit Hex sector number you need. Now enter the sector editor at the appropriate sector number, eg DEX 2 for the Root and DEX nn in the case of another directory if using the ADT. It is best to enter from an 80-column mode if possible, to avoid having to carry out scrolling to 'see' the whole sector. You will see the start of the catalogue for the directory containing the affected file. Now simply step through it and the next few sectors until you see the affected filename. Count along the filename to the 5th character from the start, eg "Y" if the filename was "DUMMY". If the filename is LESS than 5 characters, you must still look at whatever is in that 5th position. The first Hex digit of this character should be in the range 0-7, ie the 8th bit is set to 0, but when the "E" attribute is set, the 8th bit is set to 1, so the first digit is in the range 8-F. For example, the "Y" of "DUMMY" should show as &59, but if the attribute is "E" then the "Y" will show as &D9 instead. In the case the ADT, the "Y" still looks normal on the screen, even though the Hex code is wrong, but it might look different on other editors. If the filename is shorter than 5 characters, you may often find the 5th character is "&8D", which is a CR (&0D) with the "E" set. To get rid of the "E", simply alter the Hex code to the 'normal' value. Rather than calculate the code and enter in Hex, use the editor in ASCII mode, (the default with ADT), and overtype the appropriate character, eg "Y" in my example, or just to change &8D to &0D. If that looks ok, then exit from the editor, saying Yes to any Save option. If you catalogue the affected directory, and the "E" is still present, DO NOT PANIC, but simply *MOUNT the disc again, or type *DIR followed by the full directory pathname, eg *DIR $.MYPROGS.FUN, so as to update the catalogue in memory, as this isn't necessarily done automatically by the editor. If the "E" has gone, the final thing to do is set the "WR" attributes, or "RL" etc. as necessary. If you have to enter values in Hex, the correct code can be found from the expression PRINT ~<&oldhex> AND &7F, eg for the "Y" in my example type PRINT ~&D9 AND &7F, and the result is &59. If the character is a normal 'visible' character, such as "Y", then PRINT~ASC"Y" would suffice, but otherwise use the first expression. In summary, locate the sector number of the catalogue of the directory containing the affected file(s). Enter the disc sector editor, locate the 5th character from the start of the filename(s), and overtype it with the correct character, or enter the correct Hex code, as convenient. The first digit in Hex should change from 8-F to 0-7. Exit from the editor, saving the changes, and if the "E" attribute hasn't gone, remount the disc or reselect the directory with the full pathname. Although it sounds complicated, after a couple of practice goes on a spare disc and a dummy file, you can correct an "E" attribute in well under a minute!