Change the cursor2 declare to this
declare @sql nvarchar(4000)
set @sql = '
DECLARE cursor2 CURSOR
GLOBAL
DYNAMIC
FOR
SELECT sum(file_size_bytes) , Lseries from ' + @filename + ' group by Lseries
FOR READ ONLY
'
exec(@sql)
Far away is close at hand in the images of elsewhere.
Anon.