Is that in an OnJobStart rule? I think you can assign a variable for a global data file object which uses your input data file. Then you count the total records and use that as your secondary element in var ranges:
myData = new ExternalDataFileEx(GetFileName(FusionPro.Composition.inputFileName), ",") //assuming CSV data
totalRecords = myData.recordCount;
var ranges = [ 1, totalRecords ];
// your function, etc.
Admittedly, I have not tried this yet, but I think the logic is valid.