EXEC SQL
SELECT A.EMP_NUM,A.EMP_STATUS,A.LAST_NAME, B.DEPT_NUM,B.DEPT_NAME
INTO :EMP-NUM, :EMP-STATUS, :LAST-NAME, :DEPT-REC.DEPT-NUM, :DEPT-NAME
FROM EMPL1, DEPT1
WHERE A.EMP_NUM = :WS-EMP-NUM
AND A.DEPT_NUM = B.DEPT_NUM
END-EXEC
SELECT A.EMP_NUM,A.EMP_STATUS,A.LAST_NAME, B.DEPT_NUM,B.DEPT_NAME
INTO :EMP-NUM, :EMP-STATUS, :LAST-NAME, :DEPT-REC.DEPT-NUM, :DEPT-NAME
FROM EMPL1, DEPT1
WHERE A.EMP_NUM = :WS-EMP-NUM
AND A.DEPT_NUM = B.DEPT_NUM
END-EXEC
Error messages
UNDEFINED OR UNUSABLE HOST VARIABLE "DEPT-REC"
UNDEFINED OR UNUSABLE HOST VARIABLE "DEPT-NUM"
UNDEFINED OR UNUSABLE HOST VARIABLE "DEPT-NUM"