Huge .tle file on NASA GSFC

Bjorn Gimle (Bjorn_Gimle@lector.kth.se)
Wed, 12 Jul 95 15:50:14 +0100

On the NASA GSFC RAID OIG BBS (what a name !?), file area 2, there is 
now, as a few times before, a file of ALL current tle's 
(for unclassified objects).

This consists of 8228 elsets, lacking the name line and checksums.
180 tles are before 1963-4A, 106 from 1995-1A to 1995-33D, 7012 between,
and 920 "grey bodies" (unidentified) with NORAD no. 81019-88984.

I wrote a small Q(uick)Basic program to add the missing data, which may
be useful in other circumstances too (I remember someone asking about
the checksum algorithm recently) :

DECLARE FUNCTION csum% (A$)
DEFSTR A-B, E-H, S-Z
DEFINT C-D, I-R
DIM B(3)
f = LTRIM$(COMMAND$ + " NUL NUL ")
' In QBASIC you must define f (or filin,filut) by INPUT or other statements.

filin = RTRIM$(LTRIM$(LEFT$(f, INSTR(f, " ") - 1)))
filut = RTRIM$(LTRIM$(MID$(f, INSTR(f, " ") + 1)))
filut = LEFT$(filut, INSTR(filut + " ", " ") - 1)
PRINT "Reading tle file '"; filin; "' ,appending to '"; filut; "'"
OPEN "I", #1, filin
OPEN "A", #2, filut

WHILE NOT EOF(1)
  LINE INPUT #1, A
  A = RTRIM$(A)
  L = LEN(A)
  r = INSTR(" 1 2 ", LEFT$(A, 2)) / 2
  IF r AND (L = 68 OR L = 69) THEN
    j = csum(A)
    IF L = 69 THEN
      IF ASC(MID$(A, 69, 1)) <> 48 + j THEN
        PRINT A; "<--"; j
        m = m + 1
      END IF
    ELSE
      m = m + 1
    END IF
    A = LEFT$(A, 68) + CHR$(48 + j)
    IF r = 1 AND B(0) = "" THEN
      B(0) = "ID." + MID$(A, 10, 8)
    END IF
  END IF
  B(r) = A
  IF r = 2 AND m > 0 THEN
    FOR i = 0 TO 2
      PRINT #2, B(i)
    NEXT i
    B(0) = ""
    m = 0
  END IF
WEND

DEFSNG O-Z
FUNCTION csum (A)
    c = 0
    FOR i = 1 TO 68
      d = ASC(MID$(A, i, 1)) - 48
      SELECT CASE d
      CASE 1 TO 9
        c = c + d
      CASE -3
        c = c + 1
      CASE ELSE
      END SELECT
    NEXT i
    j = (c MOD 10)
    csum = j
END FUNCTION




--