View previous topic :: View next topic |
Author |
Message |
sri50131 Beginner
Joined: 07 Oct 2004 Posts: 38 Topics: 15
|
Posted: Fri Oct 15, 2004 2:15 pm Post subject: SQLCODE -171 |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Fri Oct 15, 2004 2:25 pm Post subject: |
|
|
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 |
|
|
sri50131 Beginner
Joined: 07 Oct 2004 Posts: 38 Topics: 15
|
Posted: Fri Oct 15, 2004 2:37 pm Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Fri Oct 15, 2004 2:52 pm Post subject: |
|
|
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 |
|
|
Bithead Advanced
Joined: 03 Jan 2003 Posts: 550 Topics: 23 Location: Michigan, USA
|
Posted: Fri Oct 15, 2004 3:09 pm Post subject: |
|
|
Should this not read
SET D_END = DATE(:DCLCOV-C.D-START) - 1 DAY |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Fri Oct 15, 2004 3:31 pm Post subject: |
|
|
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 |
|
|
sri50131 Beginner
Joined: 07 Oct 2004 Posts: 38 Topics: 15
|
Posted: Fri Oct 15, 2004 3:47 pm Post subject: |
|
|
Bithead,
You are correct. Thanks a lot. |
|
Back to top |
|
|
|
|