Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Query on SET Db2 Command.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ajay_udl

New User


Joined: 10 Oct 2006
Posts: 29

PostPosted: Tue Sep 07, 2010 11:30 am    Post subject: Query on SET Db2 Command.
Reply with quote

Hi All,

I wanted to calculate a date which is 27 months old.
I have introduced the below mentioned code in a cobol program.

EXEC SQL
SET :WS-PURGE-DT = WS-PURGE-DB2 - 27 MONTHS
END-EXEC

The variables are defined as below in WS.

05 WS-PURGE-DT PIC X(10).
05 WS-PURGE-DB2 PIC X(10).


But this is not working for me by giving a sqlcode of -171.
If the above code wont work, can somebody help with the correct statement to get the 27 months old date.

Thanks in advance
Ajay.
Back to top
View user's profile Send private message

ajay_udl

New User


Joined: 10 Oct 2006
Posts: 29

PostPosted: Tue Sep 07, 2010 11:32 am    Post subject: Query on SET Db2 Command
Reply with quote

Hi All,

A small correction in the above mentioned code.
I have missed the colon for host variable

it will look like:

EXEC SQL
SET :WS-PURGE-DT = :WS-PURGE-DB2 - 27 MONTHS
END-EXEC

regards
Ajay
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Tue Sep 07, 2010 2:40 pm    Post subject:
Reply with quote

give you a hint:

db2 knows the data type of a column.
but, db2 has no idea the data type of a host variable.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Customizing the ISPF HILITE Command Pedro TSO/ISPF 3 Fri Mar 03, 2017 11:49 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us