x String expression. It specifies the string from which the
substring is extracted. If x is not a string, it is converted to
character.
y Expression that is converted to FIXED BINARY(31,0). y specifies
the starting position of the substring in x.
z Expression that is converted to FIXED BINARY(31,0). z specifies
the length of the substring in x. If z is zero, a null string is
returned. If z is omitted, the substring returned is position y in
x to the end of x.
The STRINGRANGE condition is raised if z is negative or if the values of y
and z are such that the substring does not lie entirely within the current
length of x. It is not raised when y = LENGTH(x)+1 and z = 0. For an
example of the SUBSTR built-in function, see "SEARCH" in item SEARCH.
Joined: 10 Oct 2003 Posts: 315 Topics: 49 Location: Germany
Posted: Fri Oct 06, 2006 9:04 am Post subject:
kolusu,
well "i guess" is the correct wording. If the length is omitted, the whole string is taken.
If youf code
Code:
DCL X CHAR(8) ;,
X = 'TESTLINE' ;,
SUBSTR(X,3) = SUBSTR(X,1);,
PUT SKIP EDIT(X)(A);,
the result is TETETETE.
What i want is "don't change bytes 1 and 2, set from byte 3 up to the end the old content of x", expected result TETESTLI.
It works with Pl1 2.3 not with the new version 3.5.
The old version works like
(pseudocode)
move x to temp
x = substr(x,1,2) || temp
the new version works like
(pseudocode)
do i = 3 to length(x)
x(i) = x(i - 2)
enddo
The question is not, works Pl1 2.3 correct or Pl1 3.5, the critical situation is, that one pieces of code works different depending on the compiler version.
It's depends up on your compiler options settings.
For more information you can check your compiler listing DFT(Nooverlap) option.
Code:
OVERLAP | NOOVERLAP
If you specify OVERLAP, the compiler presumes the source and target in an
assignment can overlap and generates, as needed, extra code in order to
ensure that the result of the assignment is okay.
NOOVERLAP will produce code that performs better; however, if you use
NOOVERLAP, you must insure that the source and target never overlap.
NOOVERLAP is the default.
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