Cobol date format

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
RK72
Participant
Posts: 154
Joined: Wed Sep 29, 2010 4:10 pm

Cobol date format

Post by RK72 »

I'm trying to read a Cobol/VSAM data file in complex flat file stage on 8.5 enterprise edition. Most data shows up properly except for date. It displays as 1130131. (with a dot at the end) and I have no idea how to convert this.

Initially thought this was Julian date but a quick search for conversion shows a different century. All I know is the file was generated this month so date is pretty recent. This data needs to be loaded to an Oracle database with Date as the data-type.

Does anyone out here know how this is represented and a method of converting this to Oracle date? And why is there a dot at the end of this field (as with many others). Thanks in advance!
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

You should ask the data provider for the specifics on how the date is formatted. Lacking that information, is the value in your example the only value you have encountered, or are there other values which you can examine to determine a pattern? Also, look at what the date is supposed to represent: Birthdate, open date, start date, end date, purchase date, etc., especially in light of what the file itself represents.

A couple of very wild guesses: YYYMMDD or MMDDYYY, and maybe add the YYY value to 1900? Likely aren't right, but might give you a starting point to play around with.

As for the trailing decimal point, my guess is that the fields are defined as Decimals and have no scale (scale=0), although you have not stated so. When you view these, DataStage will always include a decimal point (as well as a leading byte for the sign). If the scale of the decimal is 0, the decimal point will appear at the end.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

jwiles wrote:You should ask the data provider for the specifics on how the date is formatted.
This.
-craig

"You can never have too many knives" -- Logan Nine Fingers
RK72
Participant
Posts: 154
Joined: Wed Sep 29, 2010 4:10 pm

Post by RK72 »

Thanks for the responses!

The data team finally unveiled the mystery and it is apparently is in CYYMMDD format (where Century 0=1900, 1=20th and so on....)

So in essence 1130131 --> 20130131

Hope this helps someone like me who is looking for info :)
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

Using a flag to indicate the century is a non-standard approach for COBOL in general. The Y2K kerfluffle forced everyone to take a rational look at storage formats without actually thinking about consistent standards... or so I see it.

The standard is to use the most efficient storage format that does not need additional code to read or display. Packed decimal (COMP-3) is a good example. Dates have a sort of schizophrenia, because they are at the same time text displays and numeric values.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
RK72
Participant
Posts: 154
Joined: Wed Sep 29, 2010 4:10 pm

Post by RK72 »

You are absolutely right! I was told that this was a fix to the Y2K scenario which unfolded about 15 years ago...

Appreciate your response!
Post Reply