Hi,
assuming you're working with DB2 z/OS: see "IBM DB2 SQL Reference, Chapter 2 Language elements, Predicates, LIKE predicate" for a description of LIKE patterns and rules. Sample queries 2 and 3 below do what you're looking for (depending on datatype of column PROGRAM_NAME).
Best regards, Alex
CREATE TABLE TERROR_LOG (PROGRAM_NAME CHAR(8));
INSERT INTO TERROR_LOG VALUES('AA12BB');
INSERT INTO TERROR_LOG VALUES('AA11BB');
INSERT INTO TERROR_LOG VALUES('AA13BB');
INSERT INTO TERROR_LOG VALUES('AA11CC');
INSERT INTO TERROR_LOG VALUES('AA12CC');
INSERT INTO TERROR_LOG VALUES('ABCDEF');
SELECT PROGRAM_NAME
FROM TERROR_LOG
WHERE PROGRAM_NAME LIKE 'AA__BB' ;
-----------------------------------------------------------
PROGRAM_NAME
-----------------------------------------------------------
DSNE610I NUMBER OF ROWS DISPLAYED IS 0
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100
SELECT PROGRAM_NAME
FROM TERROR_LOG
WHERE PROGRAM_NAME LIKE 'AA__BB%' ;
-----------------------------------------------------------
PROGRAM_NAME
-----------------------------------------------------------
AA12BB
AA11BB
AA13BB
DSNE610I NUMBER OF ROWS DISPLAYED IS 3
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100
SELECT PROGRAM_NAME
FROM TERROR_LOG
WHERE PROGRAM_NAME LIKE 'AA__BB ' ;
-----------------------------------------------------------
PROGRAM_NAME
-----------------------------------------------------------
AA12BB
AA11BB
AA13BB
DSNE610I NUMBER OF ROWS DISPLAYED IS 3
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100
DROP TABLE TERROR_LOG;