How to reassign case IDs in sequential order

The attached spec NEWID.SPX will generate new, ordered case ids.

This is useful if:

  1. You had deleted some cases and wish to reorder the IDs,
  2. You had mistakenly reset the ‘nextid’ field in the quota file, or
  3. You have multiple files that you are combining and reordering the IDs.
  4. You want to start the case ids at a particular case id

NOTE: Do NOT do this to cases that have the case id stamped in the .fon file or they will no longer match. If you have that situation, remove the records that need to be re-ordered, reorder those using newid.spx, then combine them with the original data file.

''***Set input file (or files) specification, default is OLDID>DEFINE @INPUT OLDID ''OLDID.ASC, etc.''***Uncomment and specify other file information if not CfMC TR file, or getting certain cases, etc.''ASCII/BINARY/SWAPPED_BINARY=<length:idlocation.length> LENGTH=, SELECT= etc.>DEFINE @FILEINFO  ''ASCII=80 BINARY=## LENGTH= etc.''***Set output file specification, default is NEWID>DEFINE @OUTPUT NEWID  ''ASCII LENGTH=<###> to change length''*** Set this define to the first case id numbered to use  ***>DEFINE @START 1''*** Specify your case id location, default is 1.4>DEFINE @CASEID 1.4''*** Uncomment this define and set last card for case ids if card image with case and card id on each card, Default is 10''>DEFINE @LAST_CARD 10''*** Set card id for multi-card updating>DEFINE @CARDID 5.2''Use this SET option if you have case IDs with blanks in them''~Set variable_length_caseid=warn  >DEMO>FILL_DEFINES_IN_QUOTES>ALLOW_INDENT~INPUT FILES="@INPUT"@FILEINFO~OUTPUT @OUTPUT~DEFINE PROCEDURE=Makeid:MODIFY MY_ID[@CASEID*Z] = ( CASE_NUMBER + @START -1)>IF_DEFINE @LAST_CARD>REPEAT $A=01,...,@LAST_CARDCOPY   [$A/@CASEID]   = MY_IDMODIFY [$A/@CARDID*Z] = $A>END_REPEAT>ENDIFPUT_ID [MY_ID$]WRITE_CASE}~EXECUTE PROCEDURE=Makeid~END

  • newid.spx