{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare function msg, end_window, fieldcount, set_status\r\ndeclare subroutine rlist, record_lock, extract_si_keys\r\n$insert logical\r\n$insert rlist_equates\r\n$insert msg_equates\r\n$insert rds_equ\r\n$insert wo_log_equ\r\n$insert prod_spec_equ\r\n$insert quote_spec_equ\r\n\r\nCurrentSize = .gasbar->size\r\nNewSize = CurrentSize\r\nNewSize<3> = 0\r\n.gasbar->size = NewSize\r\n.gasbar->visible = 1\r\nopen 'WO_LOG' to WoLogTable else\r\n   Void = msg( '', 'Unable to open WO_LOG...' )\r\n   return 0\r\nend\r\nopen 'RDS' to RdsTable else\r\n   Void = msg( '', 'Unable to open RDS...' )\r\n   return 0\r\nend\r\nopen 'PROD_SPEC' to PSNTable else\r\n   Void = msg( '', 'Unable to open PSN...' )\r\n   return 0\r\nend\r\nVoid = set_status(0)\r\nStatement = 'SELECT WO_LOG WITH STATUS = \"O\"'\r\nrlist( Statement, target_activelist$, '', '', '' )\r\n@rn.counter = 0\r\nEof = false$\r\nToday = date()\r\nOnePercent = iconv( @reccount*.01, 'MD0' )\r\nloop\r\n   readnext Id else Eof = true$\r\nuntil Eof\r\n   read WoLogRec from WoLogTable, Id else\r\n      Void = msg( '', 'Unable to read ':Id:' from WO_LOG table.' )\r\n      return 0\r\n   end\r\n   Update = true$\r\n   extract_si_keys( 'RDS', 'WO',  Id, RdsToProc )\r\n   Rcnt = fieldcount( RdsToProc, @vm )\r\n   if Rcnt > 0 else\r\n      Update = false$\r\n   end\r\n   for i = 1  to Rcnt\r\n      read RdsRec from RdsTable, RdsToProc<1,i> else\r\n         Void = msg( '', 'Unable to read ':RdsToProc<1,i>:' from RDS...':Id )\r\n         GOTO NEXTRDS\r\n         *return 0\r\n      end\r\n      if RdsRec<rds_status$> = 'S' else\r\n         Update = false$\r\n      end\r\n     until Update = false$\r\n     NEXTRDS:\r\n   next i\r\n   if Update then\r\n      record_lock( WoLogTable, 'Wo Log', Id )\r\n\t  WoLogRec<wo_log_status$> = 'C'\r\n\t  WoLogRec<wo_log_close_date$> = date()\r\n      write WoLogRec on WoLogTable, Id else\r\n         Void = msg( '', 'Unable to write ':Id:' on WO_LOG table.' )\r\n\t     return 0\r\n\t  end\r\n      unlock WoLogTable, Id else\r\n         Void = msg( '', 'Unable to unlock ':Id:' in WO_LOG table.' )\r\n\t     return 0\r\n\t  end\r\n   end\r\n   if mod( @rn.counter, OnePercent ) else\r\n      NewWidth = CurrentSize<3> * @rn.counter/@reccount\r\n\t  .percent_complete->text = oconv(iconv( @rn.counter/@reccount*100, 'MD0' ), 'MD0' ):'%'\r\n\t  NewSize<3> = NewWidth\r\n\t  .gasbar->redraw = 0\r\n\t  .gasbar->size = NewSize\r\n\t  .gasbar->redraw = 1\r\n   end\r\nrepeat\r\nif @rn.counter > 0 and @reccount > 0 then\r\n\tNewWidth = CurrentSize<3> * @rn.counter/@reccount\r\n\t.percent_complete->text = oconv(iconv( @rn.counter/@reccount*100, 'MD0' ), 'MD0' ):'%'\r\n\tNewSize<3> = NewWidth\r\n\t.gasbar->redraw = 0\r\n\t.gasbar->size = NewSize\r\n\t.gasbar->redraw = 1\r\nend\r\nreturn 1\r\n"
        }
    }
}