A CROSS_REFERENCE SYSTEM FOR THE AS/400

INTRODUCTION

There are commercial cross-reference systems on the market, but we decided to develop our own, with all the functionality that we needed.

Some development decisions were taken as follows:

The application uses only one program and one data libary. It is possible to use multiple data libraries for different applications.

You will find below an introduction to the database structure and the main programs that have been developed.

POSSIBLE QUERIES

The cross-reference system should be able to provide answers to following queries:

DATABASE STRUCTURE

The structure of the Database can be analysed by examining the main entities and relationships.

The main entities are the following:

Some other entities are used to split many to many relationships between the above entities (e.g. file to file) into one to many relationships as follows:


The Cross Reference Database tables have been given the following names:


THE DATABASE LOADING PROGRAMS


The cross reference database can be loaded by using various system utilities as follows:


  1. File Cross Reference. The CL program PRCFILCL extracts the required data into files stored in the QTEMP library, by executing following system commands:
    
    		DSPFD      FILE(&FILLIB/*ALL) TYPE(*BASATR) +
    				OUTPUT(*OUTFILE) OUTFILE(QTEMP/DSPFD)         
    		DSPFD      FILE(&FILLIB/*ALL) TYPE(*ACCPTH) +              
    		      	       OUTPUT(*OUTFILE) OUTFILE(QTEMP/DSPKEY)        
    		DSPFFD     FILE(&FILLIB/*ALL) OUTPUT(*OUTFILE) +           
    		      	       OUTFILE(QTEMP/DSPFFD)                         
    		DSPDBR     FILE(&FILLIB/*ALL) OUTPUT(*OUTFILE) +           
    		      	       OUTFILE(QTEMP/DSPDBR)
    	
    	 
    The COBOL program PRCFIL is then called to process the extracted data and to load the cross reference tables DFILES, DFIELDS, XFLFI, XFLKY, XFLLF.
  2. Program Cross Reference. The CL program PRCPGMCL extracts the required data into a file stored in the QTEMP library, by executing following system command:
    
    	 DSPPGMREF PGM(&PGMLIB/*ALL) OUTPUT(*OUTFILE) OUTFILE(QTEMP/DSPPGMREF)
    	 
    The COBOL program PRCFIL is then called to process the extracted data and to load the cross reference tables DPROGS, XFLPG, XPGPG.
  3. Program Source Cross Reference. The CL program PRCSRCCL extracts a list of all members in the source physical file of an application, by executing following system command:
    
    	  DSPFD FILE(&SRCLIB/&SRCFIL) TYPE(*MBRLIST) OUTPUT(*OUTFILE) OUTFILE(QTEMP/DSPSRC)
    	 

    The COBOL program PRCSRC and PRCFLD are then called to process all source members of the extracted list and to load the cross reference table XFIPG.



THE CROSS REFERENCE DATABASE INQUIRY AND PRINTING PROGRAMS

Once the cross reference database has been be loaded it can be inquired as follows:

  1. Initial Menu. The program XREF01 display an initial menu such as the following:
    
    	 XREF01         APPLICATION OBJECTS CROSS REFERENCE         4.05.01 14:49:22   
                                                                                    
                                                                                    
                                                                                    
                                                                                    
                       Work with Physical Files    | |                                 
                                                                                    
                               or Logical Files    | |                                
                                                                                    
                                    or Fields      | |                                
                                                                                    
                                    or Programs    | |                                
                                                                                    
                                                                                    
    
                                                                                    
                                                                                    
       F3=Exit                                        
    	 
  2. Physical Files Cross Reference. The program XREF10 display a list of all physical files (starting from an optionally entered one) such as the following:
     
    XREF10            PHYSICAL FILES CROSS REFERENCE           4.05.01 14:52:57   
                                                                                    
                                                           From File _________                
      Select one of the following:                                                  
       5=View Details  F=View Fields  K=View Keys  L=Log.Files  W=Where Used        
                                                                                    
      Sel File Name  Acc.Path    Description                                        
         AGEIN00F       A      P.f. x ageing gross rentals receivable    AL240395   
         ALIEN00F       A      P.f. x Down Load Alienazioni  (AR043)     MP000331   
         ANAFU00F       A      ANAGR. CREDITORI FUNDING                MREG040190   
         ANCAL00F       A      FILE CALENDARIO (originario ADB)                     
         ANCDC00F       A      FILE ANAGRAFICO CENTRI DI COSTO         FMIC261187   
         ANCEN00F       A      FILE CENTRI DI LAVORO                                
         ANCES00F       A      ANAGR.CESPITI                           MREG230389   
         ANCES00R       A      ANAGR.CESPITI                           MREG210489   
         ANCE1D         A      WORK ANAGR CESPITI                      MREG230389   
         ANCE2D         A      WORK ANAGR CESPITI                      MREG230389   
         ANCLIDBR       A      File di emissione per DSPDBR                         
         ANCLI00F       A      FILE ANAGRAFICO CLIENTI                              
         ANCLI00S       K      P.f.x spedizione a clienti comun.cambio indirizzo    
         ANCMM00F       A      Anagrafico Commesse (ADB)                            
                                                                           Segue... 
       F3=Exit                       F9=Print                        F12=Previous 
    
     

    The user can then request for any of the file one of the listed options ('5' to view the details, 'F' to view the fields etc.)
  3. Logical Files Cross Reference. The program XREF11 display a list of all logical files (starting from an optionally entered one) such as the following:
     
    XREF11             LOGICAL FILES CROSS REFERENCE           4.05.01 15:05:29   
                                                                                    
                                                           From File __________               
      Select one of the following:                                                  
       F=View Fields   K=View Keys   W=Where Used                                   
                                                                                    
      Sel   LF     Key   PF      Description                                        
         AGEIN01L   K AGEIN00F   LF SU AGEIN00F x Nr.Cnt./Conto/Cliente    AL260595 
         AGEIN02L   K AGEIN00F   V.l. x st.prat./nr.cnt./conto/cod.cli.    AL160695 
         AGEIN03L   K AGEIN00F   LF SU AGEIN00F x Nr.Contratto             AL300695 
         AGEIN04L   K AGEIN00F   LF SU AGEIN00F x Agente Nr.Cnt./Conto/Cliente      
         ANAFU01L   K ANAFU00F   LF ANAGR.CRED.FUNDING                   MREG040190 
         ANAFU02L   K ANAFU00F   LF ANAGR.CRED.FUNDING                   MREG040190 
         ANCAL01L   K ANCAL00F   FILE CALENDARIO (originario ADB)                   
         ANCDC01L   K ANCDC00F   FILE ANAGRAFICO CENTRI DI COSTO         FMIC261187 
         ANCEN01L   K ANCEN00F   FILE CENTRI DI LAVORO                              
         ANCES01L   K ANCES00F   ANAGR.CESPITI N.CNT/TIP.REC             MREG230389 
         ANCLIS1L   K ANCLI00S   V.L. x ragione sociale                    AL051193 
         ANCLIS2L   K ANCLI00S   V.L. x cap                                AL051193 
         ANCLI01L   K ANCLI00F   FILE ANAGRAFICO CLIENTI                            
         ANCLI02L   K ANCLI00F   FILE ANAGRAFICO CLIENTI                            
                                                                           Segue... 
       F3=Exit                       F9=Print                        F12=Previous 
    
    	 

  4. Fields Cross Reference. The program XREF12 display a list of all fields (starting from an optionally entered one) such as the following:
    
    XREF12         APPLICATION FIELDS CROSS REFERENCE          4.05.01 15:08:21   
                                                                                    
                                                           From Field ___________              
      Select one of the following:                                                  
       F=View files where used          P=View programs where updated               
                                                                                    
      Sel Field Name Description                                       Type Len Dec.
          AAGEN      AGENTI                                              A    6  0  
          ACALL      COSTO ORARIO ATTREZZAGGIO CORRENTE                  P    7  1  
          ACAPA      CAP                                                 A    5  0  
          ACAPP      CAP                                                 A    5  0  
          ACCLOC     ACCONTO                                             P   14  3  
          ACCRE      CODICE CREDITORE                                    A    3  0  
          ACCTD      ACCRUED TO DAY                                      P   11  0  
          ACIND      ALIQ/COSTO INDIRETTO CORRENTE                       P    7  1  
          ACLIE      CODICE CLIENTE                                      A    6  0  
          ACMAC      COSTO ORARIO MACCHINA CORRENTE                      P    7  1  
          ACMAN      COSTO ORARIO MANODOPERA CORRENTE                    P    7  1  
          ACOFI      CODICE FISCALE                                      A   16  0  
          ACONT      NUM. CONTRATTO                                      S    6  0  
          ACONTO     CONTO PROOF                                         A    6  0  
                                                                           Segue... 
       F3=Exit                       F9=Print                        F12=Previous 
    	 

  5. Programs Cross Reference. The program XREF13 display a list of all programs (starting from an optionally entered one) such as the following:
     
    XREF13         APPLICATION PROGRAMS CROSS REFERENCE        4.05.01 15:11:06   
                                                                                  
                                                         From Program __________              
      Select one of the following:                                                  
       5=View Details   F=View used files   W=View where used                       
                                                                                    
      Sel Program    Description                                          Type      
          PR001BM    LEASING - Gestione Contratti              MP000229 RPG         
          PR001BMOLD LEASING - Gestione Contratti              MP000229 RPG         
          PR002      CESSIONE CREDITI - Gestione contratti     MP000229 RPG         
          PR003      Transito per OVRDBF prima di CALL PR003 originale  RPG         
          PR004      Manutenzione piano di finanziamento       MP990101 RPG         
          PR010      Aggiornamento parametri per collegam.fatMREG050190 RPG         
          PR010A     Stampa Tabella Collegamenti Contabilit{ MREG050190 RPG         
          PR011      Aggiornamento tabella consumer          MREG050190 RPG         
          PR013      Transito per OVRDBF prima di CALL PR013 originale  RPG         
          PR013A     Lancio accantonamento interessi           MP980522 RPG         
          PR014      Manut. e interrog. piano finanziamento    MP990101 RPG         
          PR015      Stampa interessi mensili                           RPG         
          PR015A     Richiesta parametri per stampa interessi mensili   RPG         
          PR016      Gestione interessi mensili                         RPG         
                                                                           Segue... 
       F3=Exit                       F9=Print                        F12=Previous 
    
    	 

  6. Program Fields. The program XREF21 (accessible for both the physical and logical files) displays a list of all fields of a file such as the following:
     
     XREF21              FILE FIELDS CROSS REFERENCE            9.05.01 11:50:54   
                               File: ANCAL00F                                       
                                                                                    
      Select one of the following:                                                  
       F=View files where used          P=View programs where updated               
                                                                                    
      Sel Field Name Description                           Type Len Dec. From  To   
         TRB16      TIPO RECORD                              A    3  0      1     3 
         ATB16      ATTIVITA'/ANNULLAMENTO RECORD            A    1  0      4     4 
         NRB16      NUMERO AZIONE DI AGGIORNAMENTO           P    9  0      5     9 
         DACAL                                               A    8  0     10    17 
         PRTOT      PROGRESSIVO GIORNI LAVORATIVI - TOTALE   P    5  0     18    20 
         PRANN      PROGRESSIVO GIORNI LAVORATIVI - NELL'ANN P    3  0     21    22 
         TIPGI      TIPO GIORNO                              A    1  0     23    23 
                                                                                    
     
                                                                                    
                                                                                    
                                                                             Fine   
       F3=Exit                        F9=Print                       F12=Previous 
    
    	 

  7. Program Key Fields. The program XREF32 (accessible for both the physical and logica files) displays (if the access path is by key) a list of all key fields of a file such as the following:
     
     XREF32                       FILE KEYS                     9.05.01 11:55:41   
                               File: ANGAR01L                                       
                                                                                    
                                                                                    
                                                                                    
                                                                                    
      Num Field Name Description                            Uniq. Seq. Type Len Dec.
        1 GNUCON     NUMERO CONTRATTO                         N    A    P     6  0  
        2 NUGAR      NUMERO GARANTE                           N    A    P     1  0  
                                                                                    
                                                                                    
                                                                                    
    
                                                                                    
                                                                             Fine   
       F3=Exit                        F9=Print                       F12=Previous 
    	 

  8. Logical Files. The program XREF22 displays a list of the logical files dependent on a given physical file such as the following:
     
    
     XREF22             LOGICAL FILES CROSS REFERENCE           9.05.01 17:16:32   
                           Physical File  AGEIN00F                                  
                                                                                    
      Select one of the following:                                                  
       F=View Fields   K=View Keys   W=Where used                                   
                                                                                    
      Sel   LF       Key         Description                                        
         AGEIN01L     K    LF SU AGEIN00F x Nr.Cnt./Conto/Cliente    AL260595       
         AGEIN02L     K    V.l. x st.prat./nr.cnt./conto/cod.cli.    AL160695       
         AGEIN03L     K    LF SU AGEIN00F x Nr.Contratto             AL300695       
         AGEIN04L     K    LF SU AGEIN00F x Agente Nr.Cnt./Conto/Cliente            
                                                                                    
                                                                                    
     
                                                                                    
                                                                             Fine   
       F3=Exit                         F9=Print                      F12=Previous 
    	 

  9. Where used cross reference. The program XREF27 displays a list of the programs that access a file such as the following:
     
    XREF27             PROGRAM USAGE CROSS REFERENCE           9.05.01 17:19:25   
                                 File: CONS00F                                      
                                                                                    
      Select one of the following:                                                  
       5=View Details   F=View used files   W=View where used                       
                                                                                    
      Sel Program     Description                                         Type      
          @LS518      forzat. iniz. rate prefat. (call PR501)   MP990422  RPG       
          @LS521      emiss n.d. contratti prefatturati         MP990422  RPG       
          @LS558      ACQ VEN FORN (call LS621/LS623)           MP990506  RPG       
          @LS628      STAMPA RISC.ANT.PAR/TOT.(by LS627 - LS632)MP981228  RPG       
          @LS653      RETTIFICA VAL ERR. INPUT (see LC656)      MP990428  RPG       
          @LS654      RETTIFICA VAL CONTABILE  (see LC656)      MP999428  RPG       
          @LS655      STORNO PAG RATA CANONE   (see LC656)      MP990428  RPG       
          @PR003      Aggiornamento stato del contratto         MP990324  RPG       
          @PR013      Accantonamento interessi                  MP980522  RPG       
          @PR091      Pagamenti fatture                         MP991201  RPG       
          @PR091B     Pagamenti fatture                                   RPG       
          @PR134      Stampa Fattura Riscatto(called by PR137)  MP990505  RPG       
          @PR159      Stampa Fattura "Manuale" (by LS630-PR153) MP990420  RPG       
          @PR531      Lancio azione ft risc cont.conv.(PR532)   MP990430  RPG       
                                                                           Segue... 
       F3=Exit                       F9=Print                        F12=Previous 
    
    	 

  10. File usage cross reference.The program XREF25 displays a list of the files accessed by a given program such as the following:
     
    XREF25             PROGRAM FILES CROSS REFERENCE           9.05.01 17:22:47   
                               Program: @LS518                                      
                                                                                    
      Select one of the following:                                                  
       F=View Fields   K=View Keys                                                  
                                                                                    
      Sel  File      Key  Use    Description                                        
         ANCLI01L     K    01    FILE ANAGRAFICO CLIENTI                            
         BFTAB01L     K    01    FILE TABELLE                                       
         CFNUM00F     A    04    FILE NUMERATORI DI CONTABILITA"                    
         CONS01L      K    04    Consumer - contratti    - N.ro contrattoMZOL210587 
         EUCON00F     K    01    Dati aggiuntivi CONS00F per contratti EURO         
         EUFIN00F     K    01    Dati aggiuntivi FINAN00F per contratti EURO        
         EUPRA00F     K    02    Dati aggiuntivi PRACR00F per contratti EURO        
         FINAN01L     K    04    Consumer - finanziamenti presso altri   MZOL210587 
         INFAG03L     K    01    V.l. x cliente/nr.contratto/tipo informazione      
         MOAZI00F     A    02    FILE MOVIMENTI CONTABILI                           
         PRACR00F     A    02    Proof account receivables               MZOL230287 
                                                                                    
                                                                                    
                                                                                    
                                                                             Fine   
       F3=Exit                         F9=Print                      F12=Previous 
    
    	 

  11. Program usage cross reference. The program XREF26 displays a list of the programs that are called from or call a given program such as the following:
     
    XREF25 XREF26         PROGRAM USAGE CROSS REFERENCE           9.05.01 17:25:45   
                               Program: @LS518                                      
                                                                                    
      Select one of the following:                                                  
       5=View Details   F=View used files                                           
                                                                                    
      Sel Program    Relat. Description                                             
          @@GA21      CALL  Lancio acquisizione di massa interattiva                
          DOC01       CALL                                                          
          PR501       CALL  Raggruppamento fatture (see LS518)        MP990421      
                                                                                    
                                                                                    
    
                                                                                    
                                                                                    
                                                                                    
                                                                             Fine   
       F3=Exit                       F9=Print                        F12=Previous