Bind Error on Host Variable for DATE function

Ask question on - DataBase Concepts, IBM Mainframe DB2, DB2/UDB, DB2 Tools, SQL , DB2 programming with languages like COBOL, PL1.

Moderators: Kalicharan, Moderator Group

Post Reply
bmeansdfw
Member
Posts: 3
Joined: Fri Sep 12, 2014 10:50 pm

Bind Error on Host Variable for DATE function

Post by bmeansdfw » Fri Sep 12, 2014 10:55 pm

I am receiving a bind error when compiling a Cobol program. The error is:

-171 THE DATA TYPE, LENGTH, OR VALUE OF ARGUMENT nn OF function-name IS
INVALID

The error is on the WS-TEMP-MONTHS host variable.

EXEC SQL
SELECT DATE((:WS-TEMP-DB2-DATE) + :WS-TEMP-MONTHS MONTHS)
INTO :WS-TEMP-EXP-DATE
FROM SYSIBM.SYSDUMMY1
END-EXEC

WS-TEMP-MONTHS is defined as PIC S9(8) COMP.

Does anyone know of this is the right variable definition?

bmeansdfw
Member
Posts: 3
Joined: Fri Sep 12, 2014 10:50 pm

Post by bmeansdfw » Fri Sep 12, 2014 11:22 pm

Well, I ended up replacing that statement with:

EXEC SQL
SET :WS-TEMP-EXP-DATE = DATE(:WS-TEMP-DB2-DATE) +
:WS-TEMP-SHELF-LIFE MONTHS
END-EXEC

It compiled just fine.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others