I am trying to create a dictionary for a flat file of “fixed length”
format, where one of the fields is of one character length.
If I specify the Start and End position to be the same, Developer
doesn’t allow me specifying that the End position must be greater than
the Start position.
Anyone knows how to work around this? One I can think of is to let it
take two characters and strip that second character inside the code.
Haven’t tried this, but assume that it will work. But am looking for a
more straightforward solution.
Java substring operations (which underpin webMethods String handlers) use zero-based counting and the “end” position you give is non-inclusive - that is, it is the location of the first character to NOT include in the substring extraction.
That means to extract the second character from a string, you would use a start position of 1 and an end position of 2 - this means everything from character position 1 up to and NOT INCLUDING character position 2.
e.g. webMethods - start location 3, end location 4 = “M”
This is why the start and end locations cannot be the same.
Page 56 of the Flat File Schema Developer’s Guide (FlatFileSchemaDevGuide.pdf) explains fixed-position extraction like this:
Fixed Position. Counting from zero (0), extracts a fixed number of characters from a
! Start Position. First character to extract from the record.
! End Position. First character that is not included in the extraction. If you enter a
negative number (for example, -1), the extractor returns all characters from the
character specified in the Start Position to the last character in the record or
record = webMethods
Start Position = 1
End Position = 7
Extracted characters = ebMeth
Hope this helps.
webMethods Professional Services