From: Parlow, Axel [parlow@fiz-chemie.de] Sent: Friday, February 15, 2002 3:58 AM To: Info-VAX@Mvb.Saic.Com Subject: AW: DCL questions Here is another one: $ verify=f$verify(0) $! $! WEEKNUMBER.COM $! weeknumber calculation from date $! $! P1 = date (empty = today) $! output: weeknumber in symbol WN, always two digits $! $ date = p1 $ IF date .EQS. "" THEN date = "Today" $ day = F$CVTIME (date,,"DAY") $ IF .NOT. $status THEN exit $! $ month= F$CVTIME (date,,"MONTH") $ year = F$CVTIME (date,,"YEAR") $ IF month .LE. 2 $ THEN $ yday = 31 * (month - 1) $ ELSE $ yday = (306 * month - 324) / 10 + ((year-1)-(year-1)/4*4)/3 $ if year/100*100 .eq. year .and. year/400*400 .ne. year - then yday=yday-1 $ ENDIF $ day = day + yday $! $ weekday = F$EXTRACT (0, 2, F$CVTIME ("1-JAN-''year'",,"WEEKDAY")) $ offset = (F$LOCATE (weekday, "FrSaSuMoTuWeTh")/2) + 3 ! from 3 to 9 $ week = (day + offset) / 7 ! from 0 to 52 $ if week.eq.0 $ then $! weeknumber from last year: same as 31-dec $ fy = year-1 $ @'f$environment("procedure") 31-dec-'fy' $ exit $ endif $ ddum = offset + yday $ if week.eq.53 .and. ddum.ge.339 .and. ddum.le.342 then week=1 $! $ wn == f$fao("!2ZW",week) $ if f$mode() .eqs. "INTERACTIVE" then sh sym wn $! $ if verify then $ set verify > >Is there a better Ng to post any DCL questions? >Would like to know if it is possible to generate the weeknumber with >f$cvtime