So, if I am thinking this correctly, I think the only places that would be left would be the places where you have 1st duplicates cause everything else will either have Dup or NoDup. Can you do something like this:
LOAD If(Len(Trim(DupRec)) = 0, 'Dup', DupRec) as DupRec;
LOAD if (peek('Line_ID',-1) = Line_ID ,'Dup','NoDup') as DupRec
Order by Line_ID;
Let me know if it doesn't work.
The solution is fooling around with a few Resident loads.
Lets assume the table with your original IF statement is called TableTMP.
Load Line_ID as DoubleID,
'Dub' as Flag
where DupRec = 'Dub';
That makes a helper list with all the keys that are double.
Next, create your final table:
applymap('DoubleTMP', Line_ID, 'NotDub') as DupRec
Drop Table TableTMP;
I assume it can be done easier, but this should work.