Search code examples
ibm-midrange

Chain in a CL with Multiple Keys using OVRDBF


Is there a way to do a operation like Chain in CL with multiple keys? Below would work for a single Key: For example if I have a file EMPMST, with Key as EMPNO, and I if I have to chain with Employee as 101 then I can use below:

OVRDBF     FILE(EMPMST) POSITION(*KEY 1 EMPMSTr 101)
RCVF 

If I have multiple keys in the Empmst(EMPNO(101) and EMPNAME(JIM)) , then how would I use this command? I know that second parameter would be a 2. But what would be the fourth parameter?


Solution

  • According to the Documentation

    Note that EMPNO is passed as a quoted string if a positive zoned decimal value.

    OVRDBF     FILE(EMPMST) POSITION(*KEY 2 EMPMSTr '101JIM')
    

    Note that if EMPNO is a packed field, you'd need to use a hexadecimal literal.

    OVRDBF     FILE(EMPMST) POSITION(*KEY 2 EMPMSTr x'101FD1C9D4')
    

    You also need to use hexadecimal literals for negative zoned decimals.