{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare function msg, end_window\r\ndeclare subroutine rlist, record_lock, create_note\r\n$insert logical\r\n$insert rlist_equates\r\n$insert msg_equates\r\n$insert prod_spec_equ\r\n$insert quote_spec_equ\r\n\r\n\r\n\r\n* REMOVE THIS FROM THE NIGHTLY PROCESS WINDOW\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 'PROD_SPEC' to PSNTable else\r\n   Void = msg( '', 'Unable to open PROD_SPEC table...' )\r\n   return 0\r\nend\r\n*\r\n********\r\nToday = date()\r\nTodayOut = oconv( Today, 'D2/' )\r\nTheFirstDay = iconv( field( TodayOut, '/', 1 ):'/01/':field( TodayOut, '/', 3 ), 'D2/' )\r\nFirstDayPos = mod( TheFirstDay, 7 )+1\r\nDay = field( TodayOut, '/', 2 )+0\r\n\r\nif ( Day = 1 ) or ( Day < 4 and ( ( FirstDayPos = 7 ) or ( FirstDayPos = 1 ) ) ) then\r\n   * TODAY IS EITHER THE FIRST OF TODAY IS THE THIRD OR SECOND AND THE FIRST WAS OVER THE \r\n   * WEEKEND\r\n   * NOW SEE IF IT IS TUESDAY IF IT IS THEN IT RAN ON MONDAY AND DO NOT RUN AGAIN\r\n   TodayDay = mod( Today, 7 )+1\r\n   if TodayDay = 3 then\r\n      * DO NOT RUN CAUSE TODAY IS TUESDAY AND IT RAN ON MONDAY\r\n      return 1\r\n   end\r\n\tStatement = 'SELECT PROD_SPEC WITH STATUS = \"A\" AND WITH ACTIVITY_6MO = 0'\r\n\t* IF WE GET HERE WE ARE RUNNING THE PROCESSW\r\n\trlist( Statement, target_activelist$, '', '', '' )\r\n\t@rn.counter = 0\r\n\tEof = false$\r\n\tOnePercent = iconv( @reccount*.01, 'MD0' )\r\n\tloop\r\n\t   readnext Id else Eof = true$\r\n\tuntil Eof\r\n\t   record_lock( PSNTable, 'PROD_SPEC', Id )   \t\r\n\t   read PSNRec from PSNTable, Id else\r\n\t      Void = msg( '', 'Unable to read ':Id:' from PSN table.' )\r\n\t      return 0\r\n\t   end\r\n\t   PSNRec<prod_spec_status$> = 'I'\r\n\t   SpecAddtl = PSNRec<prod_spec_spec_addtl$> = ''\r\n       PSNRec<prod_spec_spec_addtl$> = SpecAddtl\r\n\t   write PSNRec on PSNTable, Id else\r\n\t      Void = msg( '', 'Unable to write ':Id:' on PSN table.' )\r\n\t      return 0\r\n\t   end\r\n\t   unlock PSNTable, Id else\r\n\t      Void = msg( '', 'Unable to unlock ':Id:' in PSN table.' )\r\n\t      return 0\r\n\t   end\r\n\t   if mod( @rn.counter, OnePercent ) else\r\n\t\t   NewWidth = CurrentSize<3> * @rn.counter/@reccount\r\n\t\t   .percent_complete->text = oconv(iconv( @rn.counter/@reccount*100, 'MD0' ), 'MD0' ):'%'\r\n\t\t   NewSize<3> = NewWidth\r\n\t\t   .gasbar->redraw = 0\r\n\t\t   .gasbar->size = NewSize\r\n\t\t   .gasbar->redraw = 1\r\n\t   end\r\n\trepeat\r\n\tif @rn.counter > 0 and @reccount > 0 then\r\n\t\tNewWidth = CurrentSize<3> * @rn.counter/@reccount\r\n\t\t.percent_complete->text = oconv(iconv( @rn.counter/@reccount*100, 'MD0' ), 'MD0' ):'%'\r\n\t\tNewSize<3> = NewWidth\r\n\t\t.gasbar->redraw = 0\r\n\t\t.gasbar->size = NewSize\r\n\t\t.gasbar->redraw = 1\r\n\tend\r\nend else\r\n   return 1\r\nend\r\nreturn 1"
        }
    }
}