Search code examples
ibm-midrangecrystal-reports-xi

AS/400 logical file


It seems to me, if I remember, the logical file, when used in Crystal REports, it passing not only all the records of the file OEOEHDOH, but also all the many fields. Is this correct?

If the CR only is interested in say 5 fields, how can we code this logical or to make a new one that will only pass less, is that a performance issue would you say?

I have also added a temporary filter to this logical

R OEORHDRR PFILE(OEORHDOH)

  K OHORDT    R                                    
  K OHSHTC    R                                    
  K OHORDD    R               DESCEND              
  O OHSHTC                    COMP(EQ '   ')       

* added by booksman I place this before the current O\ line. this should pass less records? I know there are better ways to code for this, but I am trying to see if ther is a CRystal performance improvement first. O OHORDD COMP(LT 20130101)


Solution

  • Using logical files with crystal report, will pass only all fields in your logical files (LF). Use DSPFFD, to see all fields in the LF.

    If you want to limit number of fields in LF, create LF by listing fields before Key lists. e.g. for only 5 fields

    R OEORHDRR PFILE(OEORHDOH) 
      FIELDA     
      FIELDB      
      OHORDT                                         
      OHSHTC                                         
      OHORDD     
    K OHORDT                                         
    K OHSHTC                                         
    K OHORDD                    DESCEND              
    O OHSHTC                    COMP(EQ '   ')    
    

    Better still, use stored procedure with whatever filters, selection, logics, etc as Datasource for Crystal Report. Creating LF is not considered a good practice anymore - create Indexes or views instead.