* BASIC Program * CREATED: April 25, 1995 * PROGRAMMER: Karl O. Pinc * * TITLE: Strip leading zeros off all the records in a savedlist. * * DESCRIPTION: Is invoked with an active select list and exits with a * active select list, only with the leading zeros stripped from the id. * * MODIFICATIONS: * *========================================================================= * $INSERT EQU.FILE I_GLOBAL * Generate pretty error message. READNEXT Id ELSE STOP "No select list active." END * Open files. OPEN "", "SAVEDLISTS" TO F.SAVEDLISTS ELSE STOP "Cannot open SAVEDLISTS." END * Make sure our temp record is locked. Tempid = "UNZERO*" : @USERNO : "*" : @DATE : "*" : @TIME READVU Dummy FROM F.SAVEDLISTS, Tempid, 0 THEN STOP "Record '":Tempid:"' exists on SAVEDLISTS." END OPENSEQ "SAVEDLISTS", Tempid TO F.Temprec THEN STOP "Record '":Tempid:"' exists in SAVEDLISTS." END ELSE IF STATUS() # 0 THEN STOP "Cannot open '":Tempid:"' in SAVEDLISTS." END END * Do the deed. GOSUB Process: CLOSESEQ F.Temprec * Get a new active select list. EXECUTE "FORM.LIST SAVEDLISTS " : Tempid * Cleanup GOSUB Cleanup: STOP *========================================================================= Cleanup: DELETE F.SAVEDLISTS, Tempid RETURN *========================================================================= Process: Zero = "0 " Space = " " : @FM ;* Field marks are not allowed in select list record ids. LOOP * Already got the first Id. WRITESEQ CONVERT(Space, Zero, TRIMF(CONVERT(Zero, Space, Id))) TO F.Temprec ELSE GOSUB Cleanup: STOP "Cannot WRITESEQ -- Savedlist not stripped." END * We don't need to worry about exploded select lists because the entire * set of values is put into Id when the select list is exploded. READNEXT Id ELSE RETURN END REPEAT END