[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference orarep::nomahs::dbms

Title:VAX DBMS
Notice:THIS NOTESFILE IS NOT A FORMAL SUPPORT CHANNEL
Moderator:SCARY::CHARLAND
Created:Thu Feb 20 1986
Last Modified:Tue Jun 03 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2642
Total number of notes:11044

2595.0. "compare and if member test" by M5::MGULLIKS (Marilyn I. Gulliksen - Worldwide Support) Fri Feb 14 1997 12:21

Happy Valentine's Day.

I have a customer who has a programming question.  Since the only language 
I know is COBOL (shhhh! don't tell anyone), I'm stumped.

He's using C and has implemented the DML COMPARE for an IF MEMBER test. 
However, he isn't getting the expected results.  He used a pascal example 
from $ help DML DML_SYNTAX If_tests MEMBER Examples

"           The following example shows how the function MEMBER can be  used
           (example written in PASCAL):

               IF (MEMBER (DBM$P_MANAGES) = DML$K_SUCCESS)
               THEN
                   IF (COMPARE (DBM$TRUE) = DML$K_SUCCESS)
                   THEN
                       BEGIN
                         .
                         {statements}
                         .
                       END
                   ELSE
                       IF (COMPARE (DBM$FALSE) = DML$K_SUCCESS)
                       THEN
                           BEGIN
                             .
                             {statements}
                             .
                           END
                           END"

This looks incorrect to me.  I'm not sure how the the dbm$false logic would
ever get executed.  The customer is also seeing the same results.  
When the record is a member, his code works correctly.  When the record 
isn't a member, the code is executing as if the status code was an error
condition and not end of collection.

Any assistance would be greatly appreciated.
T.RTitleUserPersonal
Name
DateLines
2595.1ORAREP::AUSS::GARSONDECcharity Program OfficeMon Feb 17 1997 16:4512
    re .0

    It's been a long time since I wrote this stuff but the example
    would make sense if MEMBER returns success or failure depending on
    whether it could be executed and not depending on whether the current
    record is a member of the specified set. That interface might be more
    appropriate for a language using a DML preprocessor whereas a language
    with DML support built in could be more sophisticated.

    (It is my recollection that the argument to MEMBER is passed by
    reference which is going to cause a problem for unalert C programmers.
    Can you get a code fragment from the customer?)
2595.2M5::MGULLIKSMarilyn I. Gulliksen - Worldwide SupportTue Feb 18 1997 14:209
It seems that the customer didn't tell me the whole story.

He noticed the compare statement when he was looking in help for the 
if_member statement.  None of his code is using the compare statement and
things are working just fine.  

He called because he is worried that he should be using the compare 
statement.  To the best of my knowledge, the compare statement isn't 
necessary.