program Land
* To print a program listing to the IDM08 printer in landscape format.

      Lower = "abcdefghijklmnopqrstuvwxyz"
      Upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
      Sent = convert(Lower,Upper,trim(@SENTENCE))
      FileName = field(Sent," ",2)
      RecordName = field(Sent," ",3)

      if (FileName eq "") or (RecordName eq "") then
         crt "Usage: LAND filename recordname"
         stop
      end

      open "",FileName to File else
         stop "Unable to open ":FileName:" file.  (land)"
      end

      read Record from File, RecordName else
         stop "Unable to read ":RecordName:" from ":FileName:" file.  (land)"
      end
      Bad = ""
      Good = ""
      Space = seq(" ")
      Tilde = seq("~")
      for i = 0 to 255
         Bad := char(i)
         if (i lt Space) or (i gt Tilde) then
            Good := "."
         end else
            Good := char(i)
         end
      next i
      execute "SETPTR ,145,71,0,0,,BRIEF,NOTIFY,FORM IDM08,AS ":RecordName

      Idx = 1
      More = Record ne ""
      printer on
      gosub LandOn
      heading "'G'Record: ":RecordName:"     File: ":FileName:"     Account: ":@LOGNAME:"     ":TimeDate():"     Page: ":"'PG'"
      crt "Spooling ":FileName:">":RecordName:" to IDM08.  (land)"
      loop while More do
         remove Line from Record setting More
         print ("0000":Idx)[4]:" ":Convert(Bad,Good,Line[1,140])
         if not(mod(Idx,10)) then crt "*":
         if not(mod(Idx,70*50)) then
            printer off
            printer close
            printer on
            page
         end
         Idx += 1
      repeat
      crt
      crt FileName:">":RecordName:" spooled to IDM08.  (land)"
      gosub LandOff
      printer off
      printer close
      return

LandOn:
      Esc = char(27)
      print "=U":"D":"K=":Esc
      print Esc:"+P"
      print Esc:"+1Titan10iso-P"
      print Esc:"+2XCP14iso-L"
      print Esc:"m510,0,0,3,660"
      print Esc:"2"
      return

LandOff:
      print Esc:"1"
      print Esc:"m660,10,10,20,510"
      return

   end
