mhg@MITRE-BEDFORD.ARPA (Mark H. Granoff) (06/28/88)
First, I want to thank everyone that answered my question about suppressing error output from CLI$DCL_PARSE. Those that responded (Jerry Leichter, Mike Marques, Yaacov Fenster, J Wilkinson, Don Newcomer, John Hascall, JEN%VTCS1.BITNET@CUNYVM.CUNY.EDU, Pat Rankin, Betsy Ramsey, Dave Jones, welker%gtewd.decnet@gtewd.arpa, Steve Thompson, BOTMAN%HLERUL5.BITNET@CUNYVM.CUNY.EDU, rde@uunet.UU.NET, bramich@uunet.UU.NET) unanimously suggested establishing my own condition handler. By far, the simplest example was from Pat Rankin, which I used, and have included here. Pat wrote: > You don't need to alter the process's message handling to suppress >this type of message from within your program. The following 5 line >macro subroutine will accomplish what you want. Call it with the >same arguments you're currently passing to CLI$DCL_PARSE. >----------------- >;; >; Dcl_Parse -- invoke CLI$DCL_PARSE but suppress error signalling. >;; > .entry Dcl_Parse, ^m<> > MOVAW g^LIB$SIG_TO_RET, (FP) ;establish condition handler > CALLG (AP), g^CLI$DCL_PARSE ;do the real work > RET ;done > .end >----------------- > The same result can be accomplished via a higher-level language >routine by using LIB$ESTABLISH to set up LIB$SIG_TO_RET as the condition >handler. However, using macro takes away the hassles of dealing with >the optional arguments that CLI$DCL_PARSE allows. Works like a charm! Thanks (to all)! Now, I have another question, a bit less complicated. I ask becuase I want to do it the right way. My application stores date/time stamps for certain events in quadword format. I would like to have commands that use qualifiers like /SINCE=date and /BEFORE=date (like the VMS DIRECTORY command, etc). My question is: What's the best way to do date comparison like this? I thought of a couple ways: 1. Call LIB$SUBX with the two dates. Based on the sign of the answer, what was subtracted from what, and whether its a /SINCE or /BEFORE, do the appropriate thing. Or, 2. Use LIB$DAY (I think), which returns the day number of a given date from November 17, 1758 (or whatever that date is) and based on which day number is lower or higher, etc... Is there a better way? Are these two solutions reasonable, interchangable, did I miss something in a manual or something, or ....? Thanks for any help. (Please respond directly to me.) +--------------------------------------------------------------------+ | Mark H. Granoff Member of the Technical Staff | +--------------------------------------------------------------------+ | USMAIL: The MITRE Corporation | ARPAnet: mhg @ mitre-bedford.ARPA | | Burlington Rd. | UUCP : linus!mbunix!mhg | | M/S B015 |-----------------------------------| | Bedford, MA 01730 | A T & T: (617) 271 - 7506 | +--------------------------- Disclaimer -----------------------------+ | The views expressed herein are my own and do not necessarily | | reflect those of my employer. | +--------------------------------------------------------------------+
cfchiesa@bsu-cs.UUCP (Christopher Chiesa) (07/06/88)
In article <8806281323.AA07688@mitre-bedford.ARPA>, mhg@MITRE-BEDFORD.ARPA (Mark H. Granoff) writes: > > My application stores date/time stamps for certain events in quadword > format. I would like to have commands that use qualifiers like > /SINCE=date and /BEFORE=date (like the VMS DIRECTORY command, etc). > My question is: What's the best way to do date comparison like this? > I thought of a couple ways: > > 1. Call LIB$SUBX with the two dates. Based on the sign of the > > 2. Use LIB$DAY (I think), which returns the day number of a given > > Is there a better way? Are these two solutions reasonable, > interchangable, did I miss something in a manual or something, or ....? This may generate more questions than it answers, but... ... can't you just compare your quadwords directly? Now wait, I don't mean using a nonexistent "CMPQ" instruction; I mean, using the appropriate combination of two CMPL instructions, is it not the case that the date/time quadwords simply INCREASE as time goes by? I.e. that the date/time quad- word of a LATER date will always be greater than that for an EARLIER date? I've done a little experimenting along this line and this has always seemed to be the case. Chris Chiesa -- UUCP: <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!cfchiesa cfchiesa@bsu-cs.UUCP