/* */
'goview name Data_Division'
'top'
'find any data division'
call process_rc rc
if result = 0 then
   'extract class'            /* get the class of this line */
else
   exit
do while (pos("DIVISION",class) = 0)
   'find any data division'
   call process_rc rc
   if result = 0 then
      'extract class'            /* get the class of this line */
   else
      exit
end /* do while */
exit

process_rc: procedure 
arg rt
select
   when rt = 0 then
      do
         return 0
      end   
   when rt = 1 then 
      do
         'quitview'
         say 'No valid occurrences of Data Division found'
         return 1
      end
   when rt = 2 then 
      do
         'quitview'
         say 'No valid occurrences of Data Division found'
         return 2
      end
   when rt = 3 then 
      do
         'quitview'
         say 'No valid occurrences of Data Division found'
         return 3
      end
   otherwise
      say 'Unexpected return code ' rt ' from FIND' 
      return rt
end /* select */
