Shmuel is correct. Your string SOURCE is 10 characters in length. The number of characters in the substring beginning at the one-origin offset 8 is three, to wit the eighth, the ninth and the tenth.
The substring defined by your SUBSTR(SOURCE,8,5) is thus two characters too long, and the compiler's error message is appropriate. What PL/I will do is [conceptually] to pad the shorter of the two strings comparand and comparans on the right with blanks in such contexts as declare comparand character(12), comparans character(10), greater aligned bit ; . . . greater = (comparand > comparans) ; if greater then . . . ; else . . . ; Or again declare (vcomparand character(32), vcomparand character(24)) varying ; . . . greater = (vcomparand > vcomparans) ; if greater then . . . ; else . . . ; for which the current, as opposed to allocated or declared, lengths of vcomparans and vcomparand are made equal by conceptually padding the value of the one having the shorter current length with blanks. --jg On 9/27/12, Hunkeler Peter (KIUP 4) <[email protected]> wrote: >>PL/I > > With "IBM(R) Enterprise PL/I for z/OS V4.R2.M0" the following code: > > DCL SOURCE CHAR(10) INIT('0123456789'); > PUT SKIP LIST( ">" !! SUBSTR(SOURCE, 8, 5) !! "<" ); > > leads to msg: > "IBM1446I E 4.0 Third argument in SUBSTR reference is too big. It > will be trimmed to fit." > > and TFM says under SUBStR(): > 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. > > -- > Peter Hunkeler > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
