Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0078/util/dbload.sim
There is 1 other file named dbload.sim in the archive. Click here to see a list.
BEGIN
  EXTERNAL TEXT PROCEDURE conc,front,scanto,upcase,
  frontstrip,rest,getitem,from,inline;
  EXTERNAL PROCEDURE split,arrtxt;
  EXTERNAL INTEGER PROCEDURE checkint,scanint,
  maxint,search,splita,hash,splitc,arrlgd;
  EXTERNAL CLASS dbmmin;
  dbmmin("",68,TRUE) BEGIN
    REF (rspec) rtyp; REF (record) r; REF (Infile) inf;
    TEXT t,u,v,fname; CHARACTER breakchar;
    INTEGER k,n,m,max,nr,nrec,isize;

    PROCEDURE outcount;
    IF nrec > 0 THEN BEGIN
      Outtext(rtyp.rname); Outint(nrec,5); Outimage; nrec:=0;
    END outcount;

    !  -----------  start of main  -----------------;

    fname:-inline("Data base file: ",Sysin);
    openbase(fname,imsize);
    fname:-inline("Infile: ",Sysin);
    isize:=inline("Image size: ",Sysin).Getint;
    inf:-NEW Infile(fname); inf.Open(Blanks(isize));
    t:-inf.Image; inf.Inimage;
    breakchar:=t.Sub(1,1).Getchar; inf.Inimage;
    WHILE \inf.Endfile DO
    BEGIN
      IF t.Sub(1,3) = "!!!" THEN
      BEGIN
	v:-Copy(from(t,4).Strip); outcount;
	rtyp:-r__spec:-getrecordspec(v); IF rtyp == NONE THEN
	BEGIN outline2("Missig spec: ",v); GOTO fin; END;
	max:=rtyp.adim;
	BEGIN TEXT ARRAY ta[1:max]; r:-NEW record(rtyp,ta); END;
      END ELSE
      BEGIN
	nr:=splitc(t.Strip,breakchar,r.avalues,max);
	r.store; nrec:=nrec+1;
	IF Mod(nrec,200) = 0 THEN
	BEGIN Outtext("Antal poster laddade ="); Outint(nrec,5); Outimage; END;
      END;
      inf.Inimage;
    END;
    fin: eof: outcount; inf.Close;
  END simdbm;
END main;