View Single Post

  #3 (permalink)  
Old 07-26-2007, 03:34 PM
eddie13 eddie13 is offline
Junior Member
 
Join Date: Jul 2007
Posts: 5
eddie13 is on a distinguished road
If you are like some who do not have the function options available, you could create a days in month table and calculate... you just have to deal with the Leap year. ie . if you divide the year by 4 and do not have a remainder and the date is after Feb, add 1 to the julian day. ... of course there is the 400 year to consider if not this year.

working-storage
01 ws-days-in-month-table.
05 ws-days-in-month pic x(24) value "312831303130313130313031".
05 ws-days-in-mo redefines ws-days-in-month pic 9(02).
...
05 ws-julian-date.
10 ws-julian-yr pic 9(02) value zero.
10 ws-julian-day pic 9(03) value zero.
05 ws-date.
10 ws-year pic 9(02) value zero.
10 ws-month pic 9(02) value zero.
10 ws-day pic 9(02) value zero.
05 i pic 9(02) value 01.

Procedure
accept ws-date from date.
move ws-year to ws-julian-yr.
compute i = ws-month - 1.
if i = zero move 12 to i.
compute ws-julian-day = ws-days-in-mo(i) + ws-day.

Last edited by eddie13; 07-26-2007 at 03:38 PM.
Reply With Quote