No-optional access to secondary file (Quick)

Fry, Mark Mark.Fry@COGNOS.com
Wed, 22 Mar 2000 10:27:22 -0500


Hi Markus,

Rather than hard-coding your find procedure (and changing the 'get' on the
secondary file), you could write a very simple postfind procedure to check
whether the secondary file has been read successfully.

PROCEDURE POSTFIND
BEGIN
  IF NEWRECORD OF B ;means the record was not read successfully by the find
procedure
  THEN
     ERROR = "Secondary record does not exist" ;or some other meaningful
message
END

This relies upon the fact that the record buffer gets marked for
initialization when a retrieval fails (and record status gets initialized to
TFF).

Is this what you were looking for, or do you need to handle the
non-existence of the secondary record more elegantly? [if so, you could add
the extra code to do this to the postfind procedure]

Whatever...

Mark Fry
Cognos Limited
email: Mark.Fry@Cognos.com

 -----Original Message-----
From: 	Markus Grossrieder [mailto:markus.grossrieder@alba-systems.com] 
Sent:	22 March 2000 13:41
To:	powerh-l@lists.swau.edu
Subject:	No-optional access to secondary file (Quick)

Hi all,

I want to select a primary file, depending if a secondary file exist (with a
given selection criteria).
The only way to do this I found: cut the OPTIONAL option in the FIND
procedure.
Is therer an option/technique in the FILE statement which do this, without
the need to have the explicit PATH/FIND procedures in my source ? (I'm using
PH 7.10G3 on OpenVMS)

tia, Markus

(Example:)
FILE A PRIM OCCURS 15

FILE B SECOND OCCURS WITH A
ACCESS VIA KEY1 USING KEY1 OF A
SELECT IF ITEMX = "X"

PROCEDURE PATH
  ...

PROCEDURE FIND
  BEGIN
    FOR MISSING A
      BEGIN
       ...
      ;GET B OPTIONAL
      GET B                ;<- removed OPTIONAL for selection of A
      END
  END



= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.