Well, obviously no if you put it that way :-)
$ db2 "values date(timestamp_iso('10/30/2023'))"
1
----------
10/30/2023
1 record(s) selected.
$ db2 "values date(timestamp('10/30/2023'))"
1
----------
10/30/2023
1 record(s) selected.
These where run from the command prompt and the following two from Data Studio against the same database
1> values date(timestamp_iso('10/30/2023'))
2> go
1
----------
2023-10-30
1> values date(timestamp('10/30/2023'))
2> go
1>
2> go
1> Failed queries => 1
The syntax of the string representation of a datetime value is incorrect.. SQLCODE=-180, SQLSTATE=22007, DRIVER=4.31.10
So, it seems, IT Depends :-)
But the original question was if this cuold be done using sort in a JCL, so I will revise my previous statement as well.
The OUTREC control statement of dfsort may be used to convert the date fields but I won't try to get into how that would be done since its been quite a while since I was working actively on z/Os and as I said, this is not my area of experties.
------------------------------
Sven Heidorn
------------------------------
Original Message:
Sent: Thu December 14, 2023 11:49 AM
From: Jan Nelken
Subject: How to convert MM/DD/YYYY to YYYY-MM-DD
Are you sure?

Yet another way:

------------------------------
Jan Nelken
Original Message:
Sent: Thu December 14, 2023 11:31 AM
From: Sven Heidorn
Subject: How to convert MM/DD/YYYY to YYYY-MM-DD
If you want to use sort, I asume dfsort, in a JCL step you would probably need to write some sort of exit routine for dfsort. This is outside of my area of expertise but it should be described in the dfsort application programing guide.
Using SQL, the following should do the trick,
date(timestamp_iso('10/30/2023'))
1
----------
2023-10-30
------------------------------
Sven Heidorn
Original Message:
Sent: Tue October 31, 2023 01:53 AM
From: Prashant Kumar
Subject: How to convert MM/DD/YYYY to YYYY-MM-DD
Thank you for your response, Jan.
The issue is that it's not the current date in the file. The file having multiple date field (none of them are current date). Is there any way that I can covert these dates through JCL sort?
------------------------------
Prashant Kumar
Original Message:
Sent: Mon October 30, 2023 05:28 PM
From: Jan Nelken
Subject: How to convert MM/DD/YYYY to YYYY-MM-DD
C:\>db2 values(current date)
1
----------
10/30/2023
1 record(s) selected.
C:\>db2 values(year(current date) concat '-' concat month(current date) concat '-' concat day(current date))
1
-----------------------------------
2023-10-30
1 record(s) selected.
------------------------------
Jan Nelken
Original Message:
Sent: Sun October 29, 2023 04:47 AM
From: Prashant Kumar
Subject: How to convert MM/DD/YYYY to YYYY-MM-DD
I have file of length 852 bytes and this file have multiple date position in date format MM/DD/YYYY(Most of the date fields have date value but some of them are having spaces as well). I want to convert these valid date value only to YYYY-MM-DD. I have tried many things but none of them seems to be working. Can anyone please help me achieve this ?
------------------------------
Prashant Kumar
------------------------------