No-optional access to secondary file (Quick)

Pickering, John (NORBORD) PICKERIJ@norbord.com
Wed, 22 Mar 2000 11:06:36 -0500


Good try Mark - this will work if the screen has only a single primary
record (unlike the example which has a cluster) and the user is prompted for
a unique key (which we can't be sure of in this example).

In the original problem I think Marcus wants to read a repeating key (or
even serially) and pick out the primary records where some condition based
on the the secondary file is true. Your method will result in nothing being
displayed if the secondary doesn't exist for even one of the primary records
(assuming you put your postfind code inside a loop on the primary file).

I'd go with the earlier suggestion to see if the primary and secondary files
could be swapped -- or else (I hope Matt o-not-zero isn't lurking :-)
override the default find procedure as posed in the original question.

John Pickering
Toronto

-----Original Message-----
From: Fry, Mark
To: 'Markus Grossrieder'; powerh-l@lists.swau.edu
Sent: 03/22/2000 10:27 AM
Subject: RE: No-optional access to secondary file (Quick)

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.