So, if you have multiple entries for file, can we assume that you always have one and only one value set in sub_idclient? And will the record with value in sub_idclient have the largest N of that subset?
Yes, there will be only one value set in sub_idclient. Not necessarily the largest value of N will be the remaining record in sub_idclient, it will be the record distinct than 0 or blank in sub_idclient when file values are duplicated.
(html, codepage is 1252, embedded labels, table is @1);
NOCONCATENATE LOAD N,idclient,inputfile as file,nights,sub_idclient resident INPUT where len(sub_idclient);
LOAD N,idclient,inputfile as file,nights,sub_idclient resident INPUT where not exists (file,inputfile);
drop table INPUT;
So first load only the lines with the sub_idclient set (I used len(sub_idclient) to check, but you may double check if this is appropriate), then I do a second load that loads all other records (with a different file value).