program-id. week-of-year. working-storage section. 01 ws-date pic 9(8). 01 ws-julian-date pic 9(7). 01 ws-julian-date-g redefines ws-julian-date. 05 filler pic 9(4). 05 ws-jd-day pic 9(3). 01 ws-week-dec pic 9(2)v9(3). 01 ws-week-int pic 9(2). Procedure division chaining ws-date. main. *Convert the passed date to a gregorian number with inter-of-date *and convert the gregorian number to a julian date. move function day-of-integer(function integer-of-date(ws-date)) to ws-julian-date *The last 3 digits of a julian date is the *number of the day of the year (up to 365 or 366) *Divide that number by 7 to get the week number compute ws-week-dec = (ws-jd-day / 7) *If the date is a portion of a week, there will be a fraction part *check that and add 1 if there is a fraction of a week if function fraction-part(ws-week-dec) > 0 add 1 to ws-week-dec end-if. *We only care about the integer part of ws-week-dec, *not the partial week. So use integer-part to get that. move function integer-part(ws-week-dec) to ws-week-int. display "For date " ws-date ", " "The julian value is " ws-julian-date ", " "and that date is in week # " ws-week-int " of the year." goback.