Page 1 of 1

Need Help in a Date conversion

PostPosted: Wed Nov 25, 2020 1:41 pm
by toanoop
Hi,

I have a CSV file where the Users enters a date as 4/9/2020 (read it as April the 9th), is it possible to convert this to 04/09/2020 (exactly like the / is required) using Sort?

Re: Need Help in a Date conversion

PostPosted: Wed Nov 25, 2020 5:31 pm
by NicC
is it possible

Yes, but if there is no date conversion routine to do this then you will just have to treat each byte as a byte not part of a date.

Also, this topic may help
http://www.ibmmainframeforum.com/post27455.html?hilit=date%20conversion#p27455
found by searching the forum.

Re: Need Help in a Date conversion

PostPosted: Thu Nov 26, 2020 9:11 pm
by sergeyken
Use PARSE= option to split input field by ‘/‘ characters, then use BUILD= to produce fixed length values for month, and day fields.

That’s it.

Re: Need Help in a Date conversion

PostPosted: Sun Nov 29, 2020 6:47 am
by sergeyken
Since your “file” has .CSV format, there is no other choice but using PARSE option of SORT to handle any data record, either with date fields, or without it.