DB2 COBOL problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • minerva
    New Member
    • Nov 2006
    • 1

    #1

    DB2 COBOL problem

    Can anyone help me with a problem coding SQL in a COBOL program to handle nulls? I have coded SELECT COALESCE(MGRNO, 'NONE ') [INTO WS_MGRNO] FROM DEPT This works in SPUFI but gives a -206 SQLCODE in the bind when embedded in a COBOL program. I cannot see what is wrong! The INTO is only coded in the program not in SPUFI - Thanks
  • Herb
    New Member
    • Sep 2006
    • 13

    #2
    How have you defined your INTO varable?

    it might be easier to create a varable for the null indicator...
    Example:
    05 WS-MNGRNO-NULL PIC S9(04) COMP VALUE +1.

    in your fetch....
    fetch into :WS-MGRNO :WS-MGRNO-NULL

    then if WS-MGRNO-NULL is less than zero you know its null....

    Comment

    Working...