Hi,
I've been working on this program for a while now but I've hit a brick wall.
I need to spread a string across sereral variables at a specified index, but not when that index is in the middle of a word only when it is at a space. Its driving me nuts.
For example -
ONE HUNDRED AND FIFTY SIX THOUSAND EURO
with index = 20 points at 'T' in FIFTY. Count back to the closest space (16) and store everything up to that index in a variable.
Continue until index > length.
I was using something like this,
IF WS-LENGTH > WS-PARSE-INDEX
PERFORM VARYING WS-PARSE-INDEX FROM WS-PARSE-INDEX BY -1
UNTIL WS-PARSE-INDEX > WS-LENGTH
IF WS-CHEQUE-DATA(WS-PARSE-INDEX:1) = " "
UNSTRING WS-CHEQUE-DATA
INTO WW-CHEQUE-LINE(WS-LINE-INDEX)
WITH POINTER WS-PARSE-INDEX
END-UNSTRING
ADD 1 TO WS-PARSE-INDEX GIVING WS-PARSE-INDEX
ADD 1 TO WS-LINE-INDEX GIVING WS-LINE-INDEX
END-IF
END-PERFORM
END-IF.
But it doesnt work as intended.
This is really stressing me out at this stage.
I've been working on this program for a while now but I've hit a brick wall.
I need to spread a string across sereral variables at a specified index, but not when that index is in the middle of a word only when it is at a space. Its driving me nuts.
For example -
ONE HUNDRED AND FIFTY SIX THOUSAND EURO
with index = 20 points at 'T' in FIFTY. Count back to the closest space (16) and store everything up to that index in a variable.
Continue until index > length.
I was using something like this,
IF WS-LENGTH > WS-PARSE-INDEX
PERFORM VARYING WS-PARSE-INDEX FROM WS-PARSE-INDEX BY -1
UNTIL WS-PARSE-INDEX > WS-LENGTH
IF WS-CHEQUE-DATA(WS-PARSE-INDEX:1) = " "
UNSTRING WS-CHEQUE-DATA
INTO WW-CHEQUE-LINE(WS-LINE-INDEX)
WITH POINTER WS-PARSE-INDEX
END-UNSTRING
ADD 1 TO WS-PARSE-INDEX GIVING WS-PARSE-INDEX
ADD 1 TO WS-LINE-INDEX GIVING WS-LINE-INDEX
END-IF
END-PERFORM
END-IF.
But it doesnt work as intended.
This is really stressing me out at this stage.