Thanks for all your help. I got it working. For all who may need it, this is the exact code I ended up using:
Integer :: i,j,fileindex
Character(len=20) :: filename(45),aa
fileindex = 1
aa = "(I2,A1,I2,A4)"
Do i=1,15
Do j=1,3
write(filename(fileindex),aa) i,"-",j,".txt"...