0

A team of developers are trying to upgrade our COBOL from Micro Focus 4 to 5 - and our date processing keeps throwing exceptions

working storage

...
 01  WS-CURRENT-TIMESTAMP    PIC  X(026).
...

procedure

...
01434      EXEC SQL                                                         
             SELECT CURRENT_TIMESTAMP INTO :WS-CURRENT-TIMESTAMP           
01436      END-EXEC.
...

further down

...
           MOVE WS-CURRENT-TIMESTAMP TO XX-LST-UPD-TS.
01578      EXEC SQL                                                         
01579         UPDATE NHP083TB  
              SET XX_LST_UPD_TS      = :XX-LST-UPD-TS
           END-EXEC.
...

ends with a SQLCODE of 241

XX_LST_UPD_TS is a SQL Server DATETIME2

piet.t
  • 11,718
  • 21
  • 43
  • 52
  • 1
    Msg 241 is "Conversion failed when converting date and/or time from character string." Could you show us an example of the value of `XX-LST-UPD-TS` please? I suspect you will need to change the "-" between the date and time to a "T", and then use the T-SQL function [`CONVERT`](https://learn.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?redirectedfrom=MSDN&view=sql-server-ver15) with a style of 126. – Andrew Morton Nov 05 '20 at 14:04
  • It looks like this has likely nothing to do with the MF Update as the old MF does not show this. I'd guess this is from a different server/user/client that operates/connects with different settings. – Simon Sobisch Nov 05 '20 at 14:18

0 Answers0