I have a Cobol/DB2 query:
EXEC SQL
Select A.CUDT_ID
INTO :WS-CUST-ID
FROM CUST A
WHERE A.CUST_NM = :WS-CUST-NAME
WITH UR
END-EXEC.
Working storage variable is defined as:
05 WS-CUST-NAME PIC X(20).
In this query I don't want to use all 20 bytes of working storage variable for comparison.
Number of bytes to be used will be found at run time.
WS-COUNT variable will hold the no. of bytes for comparison.
I am trying to use this:
EXEC SQL
Select A.CUDT_ID
INTO :WS-CUST-ID
FROM CUST A
WHERE A.CUST_NM = :WS-CUST-NAME(1:WS-COUNT )
WITH UR
END-EXEC.
This is not working.....Is there any other workaround??