SiouxCityElvis
Programmer
Hello.
I'm on RMCOBOL-85 on Linux. I'm parsing a record and trying to figure out the best way to reformat a date field on it. The date field appears in the very beginning of the record.
There are many ways I should anticipate this date field coming in, but my end goal is to put it into a YYYYMMDD format.
Possible dates examples.
09/01/2004
9/01/2004
9/1/2004
10/15/2004(Pretty easy on this)
10/01/2004(easy also)
10/1/2004(not easy)
It is simple to put the xx/xx/xxxx dates into a working storage
I can think of approaching my problems when receiving fields in x/xx/xxxx, xx/x/xxxx, and x/x/xxxx formats, but I start thinking of all these diffents INSPECT statements and wonder if I'm making things difficult.
Any easy solutions to this type of challenge?
I know when I had to find the number of days between 2 given dates someone once pointed me to a site that had various date difference functions in it, but it didn't have a date reformatting function in it.
Thanks.
-David
I'm on RMCOBOL-85 on Linux. I'm parsing a record and trying to figure out the best way to reformat a date field on it. The date field appears in the very beginning of the record.
There are many ways I should anticipate this date field coming in, but my end goal is to put it into a YYYYMMDD format.
Possible dates examples.
09/01/2004
9/01/2004
9/1/2004
10/15/2004(Pretty easy on this)
10/01/2004(easy also)
10/1/2004(not easy)
It is simple to put the xx/xx/xxxx dates into a working storage
Code:
01 ws-date-rfmt1.
03 ws-mm pic x(2)
03 ws-slash1 pic x(1)
03 ws-dd pic x(2)
03 ws-slash2 pic x(1)
03 ws-yyyy pic x(4)
then move each individual ws above to
01 ws-date-rfmt2.
03 ws-rfmt-yyyy pic x(4)
03 ws-rfmt-mm pic x(2)
03 ws-rfmt-dd pic x(2)
I can think of approaching my problems when receiving fields in x/xx/xxxx, xx/x/xxxx, and x/x/xxxx formats, but I start thinking of all these diffents INSPECT statements and wonder if I'm making things difficult.
Any easy solutions to this type of challenge?
I know when I had to find the number of days between 2 given dates someone once pointed me to a site that had various date difference functions in it, but it didn't have a date reformatting function in it.
Thanks.
-David