|
View previous topic :: View next topic
|
| Author |
Message |
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
Is there any way through which we can convert the Julian and Cypros dates to external format(mm/dd/yyyy)?
Cypros Date:- Stored in COMP-3 format
mmmmmCdddC where mmmmm is No of months since 1900 ,ddd is the day of the month and 'C' is the signed bit of the COMP-3 varaible.
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
for Example:
External Date : 10/30/2009
Julian Date : 209C303C
Cypros Date : 01318C030C |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
Cypros looks like local jargon, if not I' ll be glad to add the term to my knowledge base
did you try at least to devise an algorithm to do it
looks very simple to me , a bit of simple arithmetic ! |
|
| Back to top |
|
 |
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
@enrico-sorichetti
| Quote: |
| 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.
Thanks. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
| Quote: |
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 |
|
| Back to top |
|
 |
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
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.
Ragards,
Rahul Gupta |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
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 ?? |
|
| Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 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. |
|
| Back to top |
|
 |
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
We store year in just 2 bytes
for example year 2000 as 200C in COMP-3 format. |
|
| Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8798 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  |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
we can read quite well and understand the same...
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 |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
3 hours since the initial post...
anybody would have alrady written, tested, deployed the whole thing
I wonder how long the TS will wait for a forum response ?
I asked at least to post his idea for the algorithm, but... I did not see anything yet |
|
| Back to top |
|
 |
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
Thank You everyone for your response.
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.
Reagrds,
Rahul Gupta |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
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
sorry for the confusion |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
rgupta71,
What is the LRECL and RECFM of the input file?
what is the position and length of the Cypros date?
what is the position and length of the Julian date?
what is the LRECL and RECFM of output dataset? |
|
| Back to top |
|
 |
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
@ Skolusu
Its LRECL is 714 and RECF is FB.
LRECL & RECF of o/p is same as i/p.
Starting position of julian date is 10 and Length is 4.
Starting posion of Cypros Date is 15 and Length is 5. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
rgupta71,
*Sigh* How do you expect to a fit in 2 expanded dates into the same LRECL as the input?
You are expanding 2 dates each into 10 byte date and you want to have the same lrecl as the input without overlaying any of the input?
The following JCL will expand the 2 dates and put them at the very end of the file ie. 715(cypros date) and 726(julian date)
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input 714 byte FB file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(715:+1900,ADD,(15,3,PD,DIV,+12),EDIT=(TTTT),C'/',
15,3,PD,MOD,+12,EDIT=(TT),C'/',
18,2,PD,EDIT=(TT),X,
+1800,ADD,10,2,PD,EDIT=(TTTT))),
IFTHEN=(WHEN=(726,4,ZD,GE,1900,AND,726,4,ZD,LT,2000),
OVERLAY=(730:X'00',728,2,12,2,PD,EDIT=(TTT))),
IFTHEN=(WHEN=(726,4,ZD,GE,2000,AND,726,4,ZD,LT,2100),
OVERLAY=(730:X'01',728,2,12,2,PD,EDIT=(TTT))),
IFTHEN=(WHEN=(726,4,ZD,GT,2100),
OVERLAY=(730:X'02',728,2,12,2,PD,EDIT=(TTT)))
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(736:730,1,731,5,ZD,PD,LENGTH=3)),
IFTHEN=(WHEN=INIT,OVERLAY=(740:736,4,DT1,EDIT=(TTTT/TT/TT)))
OUTFIL IFTHEN=(WHEN=INIT,BUILD=(1,714,715,10,X,740,10)),
IFTHEN=(WHEN=(720,2,ZD,EQ,0),OVERLAY=(720:C'01'))
/* |
|
|
| Back to top |
|
 |
rgupta71
Active User
Joined: 21 Jun 2009 Posts: 160 Location: Indore
|
|
|
|
@ Skolusu
I will also use outrec to remove some unwanted fields.
Any way the position of date doesn't matter to me what matters to me was the conversion.
Thanks for you reply. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|