GetStartingheet Method

     RGetStartingSheet ARGS;CODE;COURSE;DATE;COURSECODES
                             ;COURSES;INDEX;COURSEI;IDN
                             ;DATES;COMPS;IDATE;TEETIMES
                             ;GOLFERS;I;T
      :Access Public
      CODE DATEARGS
      COURSECODES COURSES INDEX⎕FREAD GOLFID 1
      COURSEICOURSECODESCODE
      COURSE⎕NEW GolfCourse(CODE(COURSEICOURSES,⊂''))
      R⎕NEW StartingSheet(0 COURSE DATE)
      :If COURSEI>⍴COURSECODES
          R.Message'Invalid course code'
          :Return
      :EndIf
      IDN2 ⎕NQ'.' 'DateToIDN',DATE.(Year Month Day)
      DATES COMPS⎕FREAD GOLFID,COURSEIINDEX
      IDATEDATESIDN
      :If IDATE>⍴DATES
          R.Message'No Starting Sheet available'
          :Return
      :EndIf
      TEETIMES GOLFERS⎕FREAD GOLFID,IDATECOMPS
      TDateTime.New¨(DATE.(Year Month Day)),¨[1]
                                   24 60 1TEETIMES
      R.Slots{⎕NEW Slot }¨T,¨GOLFERS
      R.OK1