AS/400 QUICK Record Selection

Boyle, Joe Joe.Boyle@cognos.com
Wed, 7 Nov 2001 08:55:03 -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_01C16769.E422AFB0
Content-Type: text/plain;
	charset="iso-8859-1"

Hi Daniel ( all ),
 
apologies everyone, I remembered the solution ( below ) but had forgotten
what the original problem was.
 
The problem that the suggestion below solves is when there is MORE than 1
secondary ( in the original case it was 5 ) and the complex had to be
rejected if none of the 5 secondary files returned a record matching
selection requirements.
 
It's a good solution, but to a different problem.

-----Original Message-----
From: Boyle, Joe [mailto:Joe.Boyle@cognos.com]
Sent: 06 November 2001 09:05
To: 'Daniel Mielke'; Powerhouse List (E-mail)
Subject: 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)) 
                
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
<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
<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.


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_01C16769.E422AFB0
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>RE: AS/400 QUICK Record Selection</TITLE>

<META content="MSHTML 5.00.2314.1000" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=612564508-07112001>Hi 
Daniel ( all ),</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=612564508-07112001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=612564508-07112001>apologies everyone, I remembered the solution ( below ) 
but had forgotten what the original problem was.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=612564508-07112001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=612564508-07112001>The 
problem that the suggestion below solves is when there is MORE than 1 secondary 
( in the original case it was 5 ) and the complex had to be rejected if none of 
the 5 secondary files returned a record matching selection 
requirements.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=612564508-07112001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=612564508-07112001>It's a 
good solution, but to a different problem.</SPAN></FONT></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
  <DIV align=left class=OutlookMessageHeader dir=ltr><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Boyle, Joe 
  [mailto:Joe.Boyle@cognos.com]<BR><B>Sent:</B> 06 November 2001 
  09:05<BR><B>To:</B> 'Daniel Mielke'; Powerhouse List 
  (E-mail)<BR><B>Subject:</B> RE: AS/400 QUICK Record 
  Selection<BR><BR></DIV></FONT>
  <P><FONT size=2>Hi all,</FONT> </P>
  <P><FONT size=2>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.</FONT></P>
  <P><FONT size=2>The syntax may need a little tidying, but the principal 
  works.</FONT> </P><BR>
  <P><FONT size=2>TEMP t-RAT-NAME char*20</FONT> <BR><FONT size=2>TEMP 
  t-RATLET-DOB zoned*8</FONT> </P>
  <P><FONT size=2>FILE RATS occurs 9</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>select if 0 ne 
  index(RATNAME of RATS,trunc(t-RAT-NAME))</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR><FONT size=2>FILE RATLETS 
  SECONDARY OCCURS WITH RATS NOITEMS OPEN 1 READ</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>access via RAT-NO 
  using RAT-NO of RATS</FONT> </P>
  <P><FONT size=2>FILE RATLETS SECONDARY ALIAS DISCARD-COMPLEX OCCURS WITH RATS 
  NOITEMS OPEN 2 READ</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  <FONT size=2>access via RAT-NO using RAT-NO of RATS</FONT> <BR><FONT 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT IF 1 = 2 </FONT></P>
  <P><FONT size=2>The generated find procedure will resemble that below,</FONT> 
  </P>
  <P><FONT size=2>FIND PROCEDURE </FONT><BR><FONT size=2>BEGIN</FONT> <BR><FONT 
  size=2>FOR ....</FONT> </P>
  <P><FONT size=2>GET RATLETS OPTIONAL</FONT> <BR><FONT size=2>GET 
  DISCARD-COMPLEX OPTIONAL</FONT> </P>
  <P><FONT size=2>you must change the 'GET DISCARD-COMPLEX OPTIONAL' syntax 
  above to that below,</FONT> </P>
  <P><FONT size=2>IF RATLET-DOB of RATLETS NE t-RATLET-DOB</FONT> <BR><FONT 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp; THEN GET 
  DISCARD-COMPLEX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  ;&nbsp; - NOTICE THE OPTIONAL HAS BEEN REMOVED</FONT> </P><BR><BR>
  <P><FONT size=2>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.</FONT></P>
  <P><FONT size=2>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 :-).&nbsp; You could add a dummy file to the 
  dictionary and map the file DISCARD-COMPLEX to it.</FONT></P>
  <P><FONT size=2>I don't recall that there was a way to do this via the 
  postfind procedure.</FONT> </P><BR>
  <P><FONT size=2>;There may be no RATLETS for a given RAT</FONT> <BR><FONT 
  size=2>;There is no index for RATNAME so the GET statement will be 
  SEQUENTIAL</FONT> </P><BR><BR><BR><BR>
  <P><FONT size=2>-----Original Message-----</FONT> <BR><FONT size=2>From: 
  Daniel Mielke [<A 
  href="mailto:DMielke@aicfunds.com">mailto:DMielke@aicfunds.com</A>]</FONT> 
  <BR><FONT size=2>Sent: 02 November 2001 20:58</FONT> <BR><FONT size=2>To: 
  Powerhouse List (E-mail)</FONT> <BR><FONT size=2>Subject: AS/400 QUICK Record 
  Selection</FONT> </P><BR>
  <P><FONT size=2>Hello All,</FONT> </P>
  <P><FONT size=2>I need help in selecting records for display.&nbsp; I want to 
  select specific</FONT> <BR><FONT size=2>records from a primary file based on 
  records in associated reference files.</FONT> </P>
  <P><FONT size=2>TEMP t-RAT-NAME char*20</FONT> <BR><FONT size=2>TEMP 
  t-RATLET-DOB zoned*8</FONT> </P>
  <P><FONT size=2>FILE RATS occurs 9</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>select if 0 ne 
  index(RATNAME of RATS,trunc(t-RAT-NAME)) &amp;</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>and RATLET-DOB of 
  RATLETS eq t-RATLET-DOB</FONT> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  <BR><FONT size=2>FILE RATLETS reference</FONT> 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT size=2>access via RAT-NO 
  using RAT-NO of RATS</FONT> </P>
  <P><FONT size=2>;There may be no RATLETS for a given RAT</FONT> <BR><FONT 
  size=2>;There is no index for RATNAME so the GET statement will be 
  SEQUENTIAL</FONT> </P>
  <P><FONT size=2>QUICK gives an Error stating that it can't find RATLET-DOB, 
  and rightly so,</FONT> <BR><FONT size=2>it hasn't been declared yet.&nbsp; How 
  do I control the selection of a RATS</FONT> <BR><FONT size=2>record based on 
  data in the referenced file RATLETS?</FONT> </P>
  <P><FONT size=2>I was thinking of modifying the FIND or POSTFIND procedures, 
  but I'm not</FONT> <BR><FONT size=2>sure how to start.</FONT> </P>
  <P><FONT size=2>Help!</FONT> </P>
  <P><FONT size=2>&gt; BUY. HOLD. AND PROSPER.</FONT> <BR><FONT size=2>&gt; 
  </FONT><BR><FONT size=2>&gt; Daniel Mielke</FONT> <BR><FONT size=2>&gt; Senior 
  User Analyst</FONT> <BR><FONT size=2>&gt; AIC Limited</FONT> <BR><FONT 
  size=2>&gt; 1-888-710-4242 (4614)</FONT> <BR><FONT size=2>&gt; 
  dmielke@aicfunds.com</FONT> <BR><FONT size=2>&gt; www.aicfunds.com</FONT> 
  <BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; </FONT></P>
  <P><FONT size=2>= = = = = = = = = = = = = = = = = = = = = = = = = = = =</FONT> 
  <BR><FONT size=2>Mailing list: powerh-l@lists.swau.edu</FONT> <BR><FONT 
  size=2>Subscribe: "subscribe" in message body to 
  powerh-l-request@lists.swau.edu</FONT> <BR><FONT size=2>Unsubscribe: 
  "unsubscribe" in message body to powerh-l-request@lists.swau.edu</FONT> 
  <BR><FONT size=2><A href="http://lists.swau.edu/mailman/listinfo/powerh-l" 
  target=_blank>http://lists.swau.edu/mailman/listinfo/powerh-l</A></FONT> 
  <BR><FONT size=2>This list is closed, thus to post to the list you must be a 
  subscriber.</FONT> </P>
  <P><FONT size=2>This message may contain privileged and/or confidential 
  information.&nbsp; 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.&nbsp; Thank 
  you.</FONT></P></BLOCKQUOTE></BODY></HTML>
<BR>

<P><FONT SIZE=2 FACE="Arial">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.</FONT></P>

------_=_NextPart_001_01C16769.E422AFB0--