You've changed the input. How could you expect code for a different input to work on something else that you throw at it?
FIELDS is equal to BUILD. FIELDS is there for backwards-compatibilty, it is much clearer to use BUILD, which does not have multiple meanings in SORT (whereas FIELDS does).
You need to, catefully, re-post your data inside the Code tags, so that the data is in a fixed-font and it looks like a green screen, like the code in my previous response. Click on Quote there if you need to see how.
Show all the possible variations of input that you want to deal with, and show the data has having representative values (like we need to know if you can have embedded spaces, perhaps).
1. FIRST COLUMN SHOULD HAVE EMPID FOLLOWED BY COMMA
2. SECOND COLUMN - IF EMPID STARTS WITH A/B THEN EMPID SHOULD BE DISPLAYED IN SECOND COLUMN DELIMETED BY COMMA,
IF NOT MATCHING , THEN SIMPLY DELIMETED COLUMN BY COMMA
3.THIRD COLUMN - LAST NAME DELIMITED BY COMMA
4.FOURTH COLUMN - IF EMPID STARTS WITH C THEN EMPID SHOULD BE DISPLAYED DELIMETED BY COMMA , ELSE SIMPLY DELIMTED BY COMMA
5.FIFTH COLUMN - FIRSTNAME
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum