c c Read in pedigrees - c Input file - Sorted by Animal ID, with consecutive numbers c Output file - entire pedigree is re-numbered consecutively c c Updated: Feb 21, 2020 c Parameter (nam=1000000) Common /BIGINT/newnum(nam) Character*12 oid(nam),ianm,isir,idam,blnk Integer kgen c c Open files c open(9,file='PEDA2S.d',form='formatted',status='old') open(10,file='PEDA3.d',form='formatted',status='unknown') c c Initialize arrays c newnum = 0 oid = ' ' blnk = ' ' mam=0 c c Read all pedigrees, and save animal ID c 10 read(9,1001,end=20)knum,ianm,isir,idam,kgen 1001 format(1x,i10,1x,a12,1x,a12,1x,a12,1x,i4) mam=mam+1 oid(mam) = ianm newnum(mam) = knum Go To 10 20 print 1701,mam 1701 format(1x,i10,' Number of pedigrees in') rewind 9 c c read file again, change IDs to consecutive numbers c nc=0 30 read(9,1001,end=40)knum,ianm,isir,idam,kgen c c find out consecutive numbers of sire and dam c kdam = 0 ksir = 0 if(isir.ne.blnk)then kw = luchs(isir,oid,mam) ksir = newnum(kw) endif if(idam.ne.blnk)then kw = luchs(idam,oid,mam) kdam = newnum(kw) endif if(ksir.gt.knum)go to 38 if(kdam.gt.knum)go to 38 write(10,2001)knum,ksir,kdam,kgen,ianm 2001 format(1x,3i10,1x,i5,1x,a12) c 31 32 37 38 50 c record length is 50 -r51 nc = nc + 1 go to 30 38 print *,ianm,isir,idam,knum,ksir,kdam go to 30 40 close(9) close(10) print *,nc,' Records out' stop end include 'lupch.f'