Need Help in a Date conversion

IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER
toanoop
Posts: 1
Joined: Wed Nov 25, 2020 1:34 pm
Skillset: COBOL, JCL , IMS DB, DB2 , IMS DC, CICS
Referer: Google

Need Help in a Date conversion

Postby toanoop » Wed Nov 25, 2020 1:41 pm

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?

NicC
Global moderator
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
Referer: Google
Location: Pushing up the daisies (almost)

Re: Need Help in a Date conversion

Postby NicC » Wed Nov 25, 2020 5:31 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic

User avatar
sergeyken
Posts: 458
Joined: Wed Jul 24, 2019 10:12 pm
Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
Referer: Internet search

Re: Need Help in a Date conversion

Postby sergeyken » Thu Nov 26, 2020 9:11 pm

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.
Javas and Pythons come and go, but JCL and SORT stay forever.

User avatar
sergeyken
Posts: 458
Joined: Wed Jul 24, 2019 10:12 pm
Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
Referer: Internet search

Re: Need Help in a Date conversion

Postby sergeyken » Sun Nov 29, 2020 6:47 am

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.
Javas and Pythons come and go, but JCL and SORT stay forever.


  • Similar Topics
    Replies
    Views
    Last post