{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare subroutine btree.extract, update_index, rlist, end_dialog\r\ndeclare function msg, key_sort, utility, ex_vm_rem, Get_Status\r\n$insert lsl_users_equ\r\n$insert msg_equates\r\n\r\nopen 'DICT.ICAR' to DictICARTable else\r\n   Void = msg( '', 'Unable to open DICT.ICAR...' )\r\n   return 0\r\nend\r\nSearchStr       = ''\r\nIssDateFrom     = .issue_date_from->text\r\nIssDateThru     = .issue_date_thru->text\r\nRespIds         = .resp_supervisor_id->array<1>\r\nNonConformances = .nonconformances->array<1>\r\nUserIds\t\t\t= .emp_id_info->array<1>\r\n\r\n\r\n\r\n* ICAR status variables\r\n\r\nOpen          = .open_check->check\r\nFormComplete  = .form_complete_check->check\r\nVerified      = .verified_check->check\r\nRMA           = .rma->check\r\nConfirmed     = .confirmed_check->check\r\nUnconfirmed   = .unconfirmed_check->check\r\n\r\n* PROLEM TYPE VARIABLES\r\n\r\nMajor = .major_check->check\r\nMinor = .minor_check->check\r\nImprovement\t= .improvement_check->check\r\n\r\n\r\nRespIds = ex_vm_rem(RespIds)\r\n\r\nif RespIds then\r\n    SearchStr<-1> = 'RESP_SUPERVISOR_ID':@vm:RespIds\r\nend\r\n\r\nUserIds = ex_vm_rem(UserIds)\r\n\r\nIF UserIds THEN\r\n\tSearchStr<-1> = 'USER_ID':@vm:UserIds\r\nEND\r\n\r\nNonConformances = ex_vm_rem(NonConformances)\r\n\r\nif NonConformances then\r\n    SearchStr<-1> = 'NON_CONF':@vm:NonConformances\r\nend\r\n\r\n\r\nif IssDateFrom and IssDateThru then\r\n    SearchStr<-1> = 'ENTRY_DATE':@vm:IssDateFrom:'...':IssDateThru\r\nend else\r\n\tif IssDateFrom then\r\n\t    SearchStr<-1> = 'ENTRY_DATE':@vm:'>=':IssDateFrom\r\n\tend\r\n\tif IssDateThru then\r\n\t    SearchStr<-1> = 'ENTRY_DATE':@vm:'<=':IssDateThru\r\n\tend \r\nend\r\n\r\n* ICAR status\r\n\r\nICARStatusVar = ''\r\nif Open\t\t\tthen ICARStatusVar<1,-1> = 'O'\r\nif FormComplete\tthen ICARStatusVar<1,-1> = 'F'\r\nif Verified\t\tthen ICARStatusVar<1,-1> = 'V'\r\n\r\nif ICarStatusVar then SearchStr<-1> = 'STATUS':@vm:ICARStatusVar\r\n\r\n\r\n* PROBLEM TYPE\r\nProblemTypeVar = ''\r\nif Major\t\tthen ProblemTypeVar<1,-1> = 'M'\r\nif Minor \t\tthen ProblemTypeVar<1,-1> = 'I'\r\nif Improvement\tthen ProblemTypeVar<1,-1> = 'A'\r\n\r\nif ProblemTypeVar then SearchStr<-1> = 'PROBLEM_TYPE':@vm:ProblemTypeVar\r\n\r\n\r\n* Shift\r\n\r\nShiftNoVar = ''\r\n\r\nIF .shift1_check->check THEN ShiftNoVar<1,-1> = '1'\r\nIF .shift2_check->check THEN ShiftNoVar<1,-1> = '2'\r\nIF .shift3_check->check THEN ShiftNoVar<1,-1> = '3'\r\nIF .shift4_check->check THEN ShiftNoVar<1,-1> = '4'\r\n\r\nIF ShiftNoVar THEN SearchStr<-1> = 'SHIFT':@VM:ShiftNoVar\r\n\r\n* CONFIRMATION status\r\nCONStatusVar = ''\r\nif Confirmed then\r\n    CONStatusVar<1,-1> = 'C'\r\nend\r\nif UnConfirmed then\r\n    CONStatusVar<1,-1> = 'U'\r\nend\r\nif CONStatusVar then\r\n   SearchStr<-1> = 'CONFIRM_STATUS':@vm:CONStatusVar\r\nend\r\n\r\nif SearchStr then\r\n    SearchStr := @fm\r\n    Void = utility( 'CURSOR', 'H' )\r\n    * do a btree.extract\r\n    \r\n    btree.extract( SearchStr, 'ICAR', DictICARTable, Keys, '', Flag )\r\n    IF Get_Status(errCode) THEN\r\n    \tCALL ErrMsg(errCode)\r\n    \tRETURN\r\n    END\r\n    if Keys then\r\n       convert @vm to @fm in Keys\r\n       Keys = key_sort( Keys, 'ICAR', '#ISSUE_DATE', 1 )\r\n       end_dialog( @window, Keys )\r\n    end else\r\n       MsgInfo = ''\r\n       MsgInfo<mtext$> = 'No records found meeting your criteria...' \r\n       MsgInfo<micon$> = '!'\r\n       Void = msg( '', MsgInfo )\r\n    end\r\n    Void = utility( 'CURSOR', 'A' )\r\nend else\r\n    MsgInfo = ''\r\n    MsgInfo<mtext$> = 'You have not entered any search criteria...' \r\n    MsgInfo<micon$> = '!'\r\n    Void = msg( '', MsgInfo )\r\nend\r\nreturn 0\r\n\r\n"
        }
    }
}