Monday 17 October 2011

RPGLE - Function to center a field

    RPGLE  - Function to center a field

*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
      * $GetComNam - Get Company Information
      *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     P$GetComNam       b
     D $GetComNam      pi            30a
     D   LenStr        s              3  0 inz(0)
     D   ComNum        s              3  0 inz(1)
     D   ComNam        s             30    inz(*blanks)
     D   TmpComNam     s             30    inz(*blanks)
      *
     C                   if        not %open(CCFILEL)
     C                   open      CCFILEL
     C                   endif
      *
     C                   eval      ComNum = 001.
     C     ComNum        Chain     CCFILEL
     C                   if        %found(CCFILEL)
     C                   eval      TmpComNam = %trim(CCCONM)
     C                   endif
      *
     C                   if        %open(CCFILEL)
     C                   close     CCFILEL
     C                   endif
      *
     C                   eval      LenStr = ((%len(TmpComNam) -
     C                             %len(%trim(TmpComNam))) / 2) + 1
     C                   eval      %subst(ComNam:LenStr) = %trim(TmpComNam)
      *
     C                   return    ComNam
      *
     P$GetComNam       e

No comments:

Post a Comment