Fonction GAP4 , retourne la lg d'un fichier BD

BoTTom |
     h nomain copyright('Volubis')
      * prototype de la fonction
     Drtvdblen         pr             5  0
     d  ficlib                       20
 
      *corps de la fonction
     Prtvdblen         b                   export
     D                 pi             5  0
     d  ficlib                       20
 
 
     Dusrspc           s             20    inz('CPYDBSTMF QTEMP')
 
     Dmax              s              5  0
 
     Dpointeur         s               *
     Dptrinfos         s               *
     Dinfosliste       ds                  based(ptrinfos)
     D  offset                       10i 0
     D  taille                       10i 0
     D  nbpostes                     10i 0
     D  lgposte                      10i 0
 
     dptrliste         s               *
     DRCDL0200         ds                  based(ptrliste)
     d  rcdlen                       10i 0 overlay(RCDL0200:25)
 
 
     dQUSLRCD          PR                  EXTPGM('QUSLRCD')
     d  space                        20
     d  format                        8    const
     d  fichier                      20    const
     d  ovrdbf                        1    const
 
     dQUSPTRUS         PR                  EXTPGM('QUSPTRUS')
     d  space                        20
     d  ptr                            *
 
 
     c                   callp     QUSLRCD(usrspc : 'RCDL0200' :
     c                                     ficlib : '1')
 
     c                   callp     QUSPTRUS(usrspc : pointeur)
 


|
 
      * gestion de la liste (positionnement sur la partie entête)
     c                   eval      ptrinfos = pointeur + 124
 
      * positionnement sur le premier poste
      *  on enleve la taille d'un poste pour que la boucle puisse commencer
      *  par ajouter la taille même la première fois
     c                   eval      ptrliste = pointeur + offset - lgposte
 
 
      * boucle (nbpostes fois)
     c                   do        nbpostes
     c                   eval      ptrliste = ptrliste + lgposte
      * recherche du plus grand format
     c                   if        rcdlen > max
     c                   eval      max = rcdlen
     c                   endif
     c                   enddo
 
      * retour de la valeur (le + grand)
     c                   return    max
     Prtvdblen         e




©AF400