× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Shooting from the hip, perhaps, but a shot and a score.  Check this source:

Fpf16      if   f  100    14aidisk    extfile(npf16) usropn
                                                           
d key             s             14                         
d npf16           s             21                         
                                                           
d results         ds                                       
d   pf16a_set1                   1                         
d   pf16a_set2                   1                         
d   pf16b_set1                   1                         
d   pf16b_set2                   1                         
                                                           
ipf16      ns  01                                          
i                                  1    1  dummy           
                                                           
 /free                                                     
  npf16 = 'SANDBOX/PF16A';                                 
  open pf16;                   
  key = '000000001X';          
  setll key pf16;              
  pf16a_set1 = %equal(pf16);   
  key = '000000007Z';          
  setll key pf16;              
  pf16a_set2 = %equal(pf16);   
  close pf16;                  
  npf16 = 'SANDBOX/PF16B';     
  open pf16;                   
  key = '000000001X';          
  setll key pf16;              
  pf16b_set1 = %equal(pf16);   
  key = '000000007Z';          
  setll key pf16;              
  pf16b_set2 = %equal(pf16);   
  close pf16;                  
  dsply results; 
  *inlr = *on;   
 /end-free       

Create two files:

(PF16A)
     A          R PF16AR             
     A            D1            10   
     A            K1             9S 0
     A            D2            10   
     A            K2             5   
     A          K K1                 
     A          K K2                 
     A          K D1                 

(PF16B)
     A          R PF16BR             
     A            D1             5   
     A            K1             9S 0
     A            D2             5   
     A            K2             5   
     A          K K1                 
     A          K K2                 
   
Add data:
(PF16A)
D1         K1         D2         K2 
A-1-D1             1  A-X-D2     X  
A-2-D1             2  A-Z-D2     Z  
A-7-D1             7  A-Q-D2     Q  
A-9-D1             9  A-B-D2     B  
(PF16B)
D1    K1         D2    K2 
A-1-D         1  A-X-D X  
A-2-D         2  A-Z-D Z  
A-7-D         7  A-Q-D Q  
A-9-D         9  A-B-D B  

Run the program:

DSPLY  1010


Works like a charm.  The only thing you would have to do is have THREE files
with USROPN; one each with key lengths of 14, 16 and 18.  Open the
appropriate file based on the key length.

Joe




From: Joe Pluta
Sent: Monday, July 03, 2006 7:21 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Knotty puzzle with chaining to files not known at compile
time

Without going into a lot of research, it seems to me (and I could be dead
wrong on this) that a program-described keyed file doesn't care much about
the keys other than the total length of the key.  In fact, in your case, I
would hazard a guess that you simply need to define files with key lengths
of 14, 16 and 18 (and with some suitable record length).

Then you might be able to override to the appropriate file dynamically and
then simply do a SETLL to determine the existence of a given key (which
you
would format as a single character field).

I don't know this for certain.  I'm really shooting from the hip here.
But
if all of those assumptions held, I'd just have a program that accepts the
file identification information, an 18-character key field and a flag that
says whether the data is 14, 16, or 18 characters.  Then I'd override,
open
and SETLL.

Joe



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.