'SANCTION - checks status of order, appts, bespoke & alloc'ns

external   sch scw jobnr vloadif() vunloadif() dpath

public     ptstr

global     x newstat y $col $offset

MAIN
single-step off
  screen clear box 1 1 sch scw 0 0 no-border
  repaint off
  newstat = "S"
  vloadif(dpath|"apptdate.vws")
  order change physical
  for y = 1 to 7
    data goto record first
    for x = 1 to precords
      $col = "[A"|str(y)|"]"
      data find $col equal jobnr options ""
      if cerror
        data goto record next
        continue for
      else
        lock-record
          case (y)
            when 1
              [B1] = newstat
            when 2
              [B2] = newstat
            when 3
              [B3] = newstat
            when 4
              [B4] = newstat
            when 5
              [B5] = newstat
            when 6
              [B6] = newstat
            when 7
              [B7] = newstat
          end case
        write-record
        data goto record next
      end if
    end for
  end for
  vunloadif("apptdate.vws")
END MAIN
