299 DATA BUNDRPT REGULERT;
300 SET COMBINE;
301 IF (SUBSTR(TRIM(LEFT(BRPROV)),1,7) = 'ALBERTA') OR
302 (SUBSTR(TRIM(LEFT(BRPROV)),1,12) = 'SASKATCHEWAN' AND
303 PUT(CIDKEY,SASK.) = 'Y') THEN OUTPUT BUNDRPT;
304 ELSE OUTPUT REGULERT;
NOTE: INVALID THIRD ARGUMENT TO FUNCTION SUBSTR AT LINE 302 COLUMN 3.
CIDKEY=1111111111111111 ACCOUNT=000000111111111 ORIGDATE=04JUL2003 ISSUEDTE=04JUL2003 MATDATE=04JUL2008 BLTRANS=77777 BRPROV=ALBERTA
CUSTNM=xxxxxxxxxxxxx MKEY=vvvvvvvvvvv NAME=cccccccccc CADD1=eeeeeee CADD2=rrrrrrrrrr cccc MY T1A 7H3
IF I PUT WHERE STATMENT instead of IF, I don't get errory message.
What make the difference between if and where statment.
Note that field BRPROV is 18 characters length long
(from the proc contents I found the following
# Variable Type Len Pos Format Label
44 BRPROV CHAR 18 320
Don't use the TRIM function. What you are then returning when BRPROV = 'ALBERTA' is a 7 character value, which is ok for the first SUBSTR but not for the second SUBSTR; 12 is out of range for a 7 character value.