Parsing fixed-width format with J
For reference, in case anyone stumbles across this page later, and as discussed in your thread here.

Something like this would do the trick:

parseFW=: (i.@{:@$@] e. 0,+/\@[) &lt;;.1"1 ]


(Though when I test against your input, I'm tripped up by a leading space on each line of your 'input' value, which does not match the specific width values you have used here. Need to also deal with that issue somehow. I would recommend either manually removing those spaces, or dropping the first character on each row before handing off to either implementation of parseFW).

That said, to get an exact workalike to your parseFW (throws an error because the record size is wrong, rather than slicing at the "wrong" column positions on the larger records), you could do this:

parseFW=: (i.@(+/) e. 0,+/\)@[ &lt;;.1"1 ]