AS/400 QUICK Record Selection

Boyle, Joe Joe.Boyle@cognos.com
Tue, 6 Nov 2001 09:04:53 -0000


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C166A2.193BF760
Content-Type: text/plain;
	charset="iso-8859-1"

Hi all,

the solution below depends on the fact that you will save both the path and
find procedures, having first used the 'build list detail' option to output
them, and then modify the find procedure as described below.

The syntax may need a little tidying, but the principal works.


TEMP t-RAT-NAME char*20
TEMP t-RATLET-DOB zoned*8

FILE RATS occurs 9
	select if 0 ne index(RATNAME of RATS,trunc(t-RAT-NAME))
		
FILE RATLETS SECONDARY OCCURS WITH RATS NOITEMS OPEN 1 READ
	access via RAT-NO using RAT-NO of RATS

FILE RATLETS SECONDARY ALIAS DISCARD-COMPLEX OCCURS WITH RATS NOITEMS OPEN 2
READ
	access via RAT-NO using RAT-NO of RATS
      SELECT IF 1 = 2 

The generated find procedure will resemble that below,

FIND PROCEDURE 
BEGIN
FOR ....

GET RATLETS OPTIONAL
GET DISCARD-COMPLEX OPTIONAL

you must change the 'GET DISCARD-COMPLEX OPTIONAL' syntax above to that
below,

IF RATLET-DOB of RATLETS NE t-RATLET-DOB
     THEN GET DISCARD-COMPLEX             ;  - NOTICE THE OPTIONAL HAS BEEN
REMOVED



The principal is that the 'GET DISCARD-COMPLEX' syntax will always fail when
executed because of the impossible condition 'SELECT IF 1 = 2' associated
with it, but it will be executed only when condition 'IF RATLET-DOB of
RATLETS NE t-RATLET-DOB' is true i.e. a bad DOB match.

You could code the equivalent of 'SELECT IF 1 = 2' by using an impossible
key value in syntax 'access via RAT-NO using RAT-NO of RATS' of the
DISCARD-COMPLEX file, but sod's law dictates that somehow the key value you
use will make it into the file :-).  You could add a dummy file to the
dictionary and map the file DISCARD-COMPLEX to it.

I don't recall that there was a way to do this via the postfind procedure.


;There may be no RATLETS for a given RAT
;There is no index for RATNAME so the GET statement will be SEQUENTIAL





-----Original Message-----
From: Daniel Mielke [mailto:DMielke@aicfunds.com]
Sent: 02 November 2001 20:58
To: Powerhouse List (E-mail)
Subject: AS/400 QUICK Record Selection


Hello All,

I need help in selecting records for display.  I want to select specific
records from a primary file based on records in associated reference files.

TEMP t-RAT-NAME char*20
TEMP t-RATLET-DOB zoned*8

FILE RATS occurs 9
	select if 0 ne index(RATNAME of RATS,trunc(t-RAT-NAME)) &
	and RATLET-DOB of RATLETS eq t-RATLET-DOB
	
FILE RATLETS reference
	access via RAT-NO using RAT-NO of RATS

;There may be no RATLETS for a given RAT
;There is no index for RATNAME so the GET statement will be SEQUENTIAL

QUICK gives an Error stating that it can't find RATLET-DOB, and rightly so,
it hasn't been declared yet.  How do I control the selection of a RATS
record based on data in the referenced file RATLETS?

I was thinking of modifying the FIND or POSTFIND procedures, but I'm not
sure how to start.

Help!

> BUY. HOLD. AND PROSPER.
> 
> Daniel Mielke
> Senior User Analyst
> AIC Limited
> 1-888-710-4242 (4614)
> dmielke@aicfunds.com
> www.aicfunds.com
> 
> 

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

This message may contain privileged and/or confidential information.  If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so.  Thank you.

------_=_NextPart_001_01C166A2.193BF760
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">



RE: AS/400 QUICK Record Selection



Hi all,

the solution below depends on the fact that you will = save both the path and find procedures, having first used the 'build = list detail' option to output them, and then modify the find procedure = as described below.

The syntax may need a little tidying, but the = principal works.


TEMP t-RAT-NAME char*20
TEMP t-RATLET-DOB zoned*8

FILE RATS occurs 9
        select if = 0 ne index(RATNAME of RATS,trunc(t-RAT-NAME))
        =        =20
FILE RATLETS SECONDARY OCCURS WITH RATS NOITEMS OPEN = 1 READ
        access = via RAT-NO using RAT-NO of RATS

FILE RATLETS SECONDARY ALIAS DISCARD-COMPLEX OCCURS = WITH RATS NOITEMS OPEN 2 READ
        access = via RAT-NO using RAT-NO of RATS
      SELECT IF 1 =3D 2 =

The generated find procedure will resemble that = below,

FIND PROCEDURE
BEGIN
FOR ....

GET RATLETS OPTIONAL
GET DISCARD-COMPLEX OPTIONAL

you must change the 'GET DISCARD-COMPLEX OPTIONAL' = syntax above to that below,

IF RATLET-DOB of RATLETS NE t-RATLET-DOB
     THEN GET = DISCARD-COMPLEX         &nb= sp;   ;  - NOTICE THE OPTIONAL HAS BEEN REMOVED



The principal is that the 'GET DISCARD-COMPLEX' = syntax will always fail when executed because of the impossible = condition 'SELECT IF 1 =3D 2' associated with it, but it will be = executed only when condition 'IF RATLET-DOB of RATLETS NE t-RATLET-DOB' = is true i.e. a bad DOB match.

You could code the equivalent of 'SELECT IF 1 =3D 2' = by using an impossible key value in syntax 'access via RAT-NO using = RAT-NO of RATS' of the DISCARD-COMPLEX file, but sod's law dictates = that somehow the key value you use will make it into the file = :-).  You could add a dummy file to the dictionary and map the = file DISCARD-COMPLEX to it.

I don't recall that there was a way to do this via = the postfind procedure.


;There may be no RATLETS for a given RAT
;There is no index for RATNAME so the GET statement = will be SEQUENTIAL





-----Original Message-----
From: Daniel Mielke [mailto:DMielke@aicfunds.com]
Sent: 02 November 2001 20:58
To: Powerhouse List (E-mail)
Subject: AS/400 QUICK Record Selection


Hello All,

I need help in selecting records for display.  I = want to select specific
records from a primary file based on records in = associated reference files.

TEMP t-RAT-NAME char*20
TEMP t-RATLET-DOB zoned*8

FILE RATS occurs 9
        select if = 0 ne index(RATNAME of RATS,trunc(t-RAT-NAME)) &
        and = RATLET-DOB of RATLETS eq t-RATLET-DOB
       =20
FILE RATLETS reference
        access = via RAT-NO using RAT-NO of RATS

;There may be no RATLETS for a given RAT
;There is no index for RATNAME so the GET statement = will be SEQUENTIAL

QUICK gives an Error stating that it can't find = RATLET-DOB, and rightly so,
it hasn't been declared yet.  How do I control = the selection of a RATS
record based on data in the referenced file = RATLETS?

I was thinking of modifying the FIND or POSTFIND = procedures, but I'm not
sure how to start.

Help!

> BUY. HOLD. AND PROSPER.
>
> Daniel Mielke
> Senior User Analyst
> AIC Limited
> 1-888-710-4242 (4614)
> dmielke@aicfunds.com
> www.aicfunds.com
>
>

=3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D = =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D
Mailing list: powerh-l@lists.swau.edu
Subscribe: "subscribe" in message body to = powerh-l-request@lists.swau.edu
Unsubscribe: "unsubscribe" in message body = to powerh-l-request@lists.swau.edu
http://lists.swau.edu/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you = must be a subscriber.

This message may contain privileged and/or = confidential information.  If you have received this e-mail in = error or are not the intended recipient, you may not use, copy, = disseminate or distribute it; do not open any attachments, delete it = immediately from your system and notify the sender promptly by e-mail = that you have done so.  Thank you.

------_=_NextPart_001_01C166A2.193BF760--