Wednesday, May 16, 2007

cleaning up your catalog

this is a cool trick I learned recently. You know how catalogs become a mess, especially if you're dealing with data from multiple nights and/or multiple sources? I like to group my files to keep them straight (like putting all the CVEL or SPLIT files together), but sometimes due to timing the catalog gets messy. Renumbering items in the catalog can be a huge pain in the rear if you have to move everything up 1 to make room for a file, the trick I learned removes this frustration.

For example, if you have 200 files and you want to move file #140 to slot #40, you'd have to first make slot #40 empty. You can do this by moving 200 to 201, 199 to 200, etc, until you move 40 to 41 and slot 40 is available:

getn 200; slot 201; renum
getn 199; slot 199; renum
...
getn 40; slot 41; renum

Then,

getn 141 (since you moved 140 up to 141!) ; slot 40; renum; recat (to get rid of any new gaps in the catalog)

the painful part is moving up all the files, but never fear! Use this instead:

for i=200:40 by -1;getn i;slot i+1;renum;end;

and it will move files 200 to 40 up one entry in the catalog. Obviously, the first number has to be the highest numbered file in the catalog to work. Also, the slot i+1 part can be modified depending on how many spaces you want to create.

3 comments:

Anonymous said...

Another nice thing here is the verb RECAT. It fills up the gaps in your catalog by "compressing" it. For example, entries 1 to 200 are filled, then some numbers are missing, and 215, 216 and 219 are used.
After RECAT number 215 became 201, 216 became 202 and 219 became 203.

Anonymous said...

does recat work for tables too?

amanda said...

recat only works for catalog files and not for tables. The verbs extdest and tacop are good for table manipulation. Be very careful, however, when playing with tables. You can really screw up your original datat file.