MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQLCODE -171

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
sri50131
Beginner


Joined: 07 Oct 2004
Posts: 38
Topics: 15

PostPosted: Fri Oct 15, 2004 2:15 pm    Post subject: SQLCODE -171 Reply with quote

Hello,

I am getting a -171 when trying to update a date column.

Here is what I am doing:

Using a inhouse date rotinue, I am getting Today's date and I am moving it into WS-TDATE.

05 WS-TDATE.
10 WS-TMONTH PIC X(2).
10 FILLER PIC X VALUE '/'.
10 WS-TDAY PIC X(2).
10 FILLER PIC X VALUE '/'.
10 WS-TYEAR PIC X(4).

Then, I am doing the following:

WS-TDATE TO D-START OF DCLCOV-C.

I am then trying to update the column as follows:

UPDATE COV_C
SET D_END = DATE(:DCLCOV-C.D-START - 1 DAY)
WHERE D_END = '12/31/9999'

what is that I am doing wrong?

Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Oct 15, 2004 2:25 pm    Post subject: Reply with quote

sri50131,

what is your Date format of D_END? Is it MM/DD/YYYY ? . I guess it is different date format.

Put a display after this move.

WS-TDATE TO D-START OF DCLCOV-C.

make sure that you have a valid date format.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sri50131
Beginner


Joined: 07 Oct 2004
Posts: 38
Topics: 15

PostPosted: Fri Oct 15, 2004 2:37 pm    Post subject: Reply with quote

Kolusu,

D_End is of DATE format. I was able to insert a row using SPUFI with D_END = 12/31/9999. So, I guess that format is DD/MM/YYYY. D_START is also of DD/MM/YYYY format. The column has a value of 01/01/1990 in the table.

Another thing, in Changeman, to Bind your program you have to promote the code to the next level to test the program. I am failing when I am promoting the code to the next level.

Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Oct 15, 2004 2:52 pm    Post subject: Reply with quote

Sri50131,

Try running this in spufi and see if it works.

Code:

  UPDATE COV_C
     SET D_END = DATE(CURRENT DATE - 1 DAY)
   WHERE D_END = '12/31/9999'


If you are able to update the table, then you need to check this topic

http://www.mvsforums.com/helpboards/viewtopic.php?t=1108&highlight=date

May be your bind options are looking at a different format as the poster had in the above post

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bithead
Advanced


Joined: 03 Jan 2003
Posts: 550
Topics: 23
Location: Michigan, USA

PostPosted: Fri Oct 15, 2004 3:09 pm    Post subject: Reply with quote

Should this not read

SET D_END = DATE(:DCLCOV-C.D-START) - 1 DAY
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Oct 15, 2004 3:31 pm    Post subject: Reply with quote

Bithead,

My bad. I was wrong. Your syntax is the correct syntax. But if you are using current date then you can code it as follows

Code:

EXEC SQL                                               
     SET :WS-PREV-DATE  = DATE(:WS-TEST-DATE) - 1 DAY 
        ,:WS-VOLD-DATE  = DATE(CURRENT DATE - 1 DAY)   
END-EXEC                                               



Both of them gave the results.However if I had

Code:

EXEC SQL                                               
     SET :WS-PREV-DATE  = DATE(:WS-TEST-DATE - 1 DAY) 
        ,:WS-VOLD-DATE  = DATE(CURRENT DATE - 1 DAY)   
END-EXEC                                               


I ended with an sql code of -171 at bind time.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sri50131
Beginner


Joined: 07 Oct 2004
Posts: 38
Topics: 15

PostPosted: Fri Oct 15, 2004 3:47 pm    Post subject: Reply with quote

Bithead,

You are correct. Thanks a lot.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group