Cypros looks like local jargon, if not I' ll be glad to add the term to my knowledge base
This is what I was told from the 1st day.
If I write an algorithm for it then I have to do some date validation & leap year handling as well. I wanted to know if there is a way already present in DFSORT or not.
Julian Date:- Stored in COMP-3 format
nnnCdddC where nnn is no of the years since 1800 and ddd is the day of the year and C is again the signed bit of COMP-3
I just reread Your initial post...
looks like there is a lot of counterintuitive jargon around there
that' s not, wether You like it or not, a julian date
julian by any IT standards is in the form ...
short ==> YYddd
( obviously with the usual issues of y2k )
long ==> YYYYddd
U r right enrico-sorichetti about the IT standard but if we store Julian date in YYYYDDD format it will take 7 bytes. Storing it in the format of
year part :--- S9(3) COMP-3
Day Part :---- S9(3) COMP-3
will only take 4 bytes. So, for efficient use of space this format is being used.
how old is the application design and implementation ??
the excuse is acceptable for an old application,
but then the relevant conversion routines should already be available
that what is done by decently competent people when using non standard formats for common entities
if the application is new the concern for efficient use of space is just plain bullshit...
if the data format requirement and specification were done by decently competent people
then they would not be using non standard formats for common entities
just think about using Your conflicting date formats fwhen accessing DB2 tables
anyway routines for such weird requrements should be written only once and made available to all the programming staff
again, where do You have issues...
with the logic or with the code ??
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
1) Why not store the Julian date as PIC S9(07) COMP-3 and it only uses 4 bytes anyway?
2) More importantly, WHY ARE YOU WORRYING ABOUT 3 BYTES? The extra processing required to move things into and out of your specialized format probably costs orders of magnitude more than the storage space.
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
Just wondered if binary has been considered here, after all, a seven digit Julian date could be squeezed into only 3 bytes, thus an extended saving of an extra byte
here is some elementary math...
YYYYddd ==> seven digits + sign ==> 4 bytes packed decimal ( comp-something)
You can display/print it with a single move (YYYY/ddd)
You can sort it with a single field
the comparison can be carried on straight from system info
no ugly adjustments for data entry/output
YYY ==> 3 digits + sign ==> 2 bytes packed decimal ( comp-something)
ddd ==> 3 digits + sign ==> 2 bytes packed decimal ( comp-something)
total 4 bytes...
ok the same as occupancy
to print it
one addition to get the proper year plus two moves
two fields have to be specified for sort
some ugly adjustments have to be done for data entry/output
generalized routine are available all over for standard julian dates
even IBM LE/COBOL provided
for what You define as julian You are on Your own...
if the application is old why You are asking on a forum, ask Your peers or Your support
they must have already faced the issue... or not???
by the way Your julian is not a com-3, is the concatenation of two comp-3
We do have routines to convert dates but very frequently we are asked to make reports which require conversion of dates and to code in COBOL about which I am not so confident.
The reports are not of similar kind they vary a lot.I was wondering if we can achieve this in just a single sort step.
I had overlooked the DFSORT/ICETOOL forum..
and even if the thread shifted a bit off topic
still all the concerns I expressed are still valid
maybe Frank and Skolusu will be able to help You
at least for the julian/psudo julian part...
adding 1800 to the year will revert to an alrady solved problem
if You search for julian in the dfsort forum You will find quite a few matches for Your issue
converting from two fields to a standard julian should be easy enough..
one addition and one concatenation