I have an input VARIABLE dataset. Something like this :
-TEST1
-123456
-ABCDEF
-BFDSS
My field starts at the 1st position of the file and it takes 6 positions. X(6)
I must sort all records with :
- For the records with 6 characters in the field, I have to take the last 5 characters. For ex: For ABCDEF, I need to take BCDEF.
- For the records with 5 characters in the field, I have to take the 5 characters. For ex: For TEST1, I need to take TEST1
The sorted output file must be:
-BCDEF
-BFDSS
-TEST1
-23456
It is important to consider that the input file is variable.