It's easier to teach a non-programmer to program in an object oriented language than it is to teach a Cobol programmer to do the same. That's my experience, and I think Clint would agree. He sent in this VB6 block that he inherited, developed by a self-proclaimed Cobol fanatic. There's not a lot code here, but nearly every line has something… special.

'Get the current fiscal year
Function strGetYear() As String

   Dim stryear1        As String
   Dim stryear2        As String

   Dim n               As Integer
   Dim nn              As Integer
   Dim nnn              As Integer
   Dim nnnn              As Integer

   Dim date1           As Date
   Dim date2           As Date
   Dim date3           As Date

   stryear1 = PRF_strFY - 1 'PRF_strFY is a global variable
   stryear2 = PRF_strFY

   date1 = strTest_Date 'strTest_Date is a global variable
   n = 20

   Do Until n = 0

            date2 = "06/30/" & stryear1
            date3 = "07/01/" & stryear2

            If ((date1 > date2) And (date1 < date3)) Then
                   strGetYear = stryear2
                   n = 1
            End If

            n = n - 1

            stryear1 = stryear1 - 1
            stryear2 = stryear2 - 1

   Loop

End Function
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!