Actually, I think this is what you want:
I1 = LEN_TRIM(NAME)
WRITE(FILENAME,'(A< I1 >,I3.3,A1,I3.3,A3)') NAME,MYPR,'_',IBL,'.nc'
So the name of the file will only be formatted to the length of the file name as that varies & not filled with blank spaces for the CHARACTER size of NAME.