{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare subroutine btree.extract, update_index, rlist, end_dialog\r\ndeclare function msg, key_sort, utility\r\n\r\n$insert lsl_users_equ\r\n$insert msg_equates\r\n\r\nopen 'DICT.COC' to DictCOCTable else\r\n   Void = msg( '', 'Unable to open DICT.COC...' )\r\n   return 0\r\nend\r\n\r\nSearchStr = ''\r\n\r\nCustIds\t\t\t= .customer_info->array<1>\r\nEntryDateFrom\t= .entry_date_from->text\r\nEntryDateThru\t= .entry_date_thru->text\r\nEntryIds\t\t= .entry_ids->array<1>\r\nWo\t\t\t\t= .wo->array\r\nPo\t\t\t\t= .po->array\r\nTXDtsNull\t\t= .tx_dt_null->CHECK\r\n\r\nswap @vm:@vm with '' in Wo\r\nif Wo[-1,1] = @vm then Wo[-1,1] = ''\r\nswap @vm:@vm with '' in Po\r\nif Po[-1,1] = @vm then Po[-1,1] = ''\r\nswap @vm:@vm with '' in CustIds\r\nif CustIds[-1,1] = @vm then CustIds[-1,1] = ''\r\nswap @vm:@vm with '' in EntryIds\r\nif EntryIds[-1,1] = @vm then EntryIds[-1,1] = ''\r\n\r\nif CustIds then\r\n    SearchStr<-1> = 'WO_CUST_NO_SHIP_TO':@vm:CustIds\r\nend\r\n\r\nif EntryDateFrom and EntryDateThru then\r\n    SearchStr<-1> = 'ENTRY_DATE':@vm:EntryDateFrom:'...':EntryDateThru\r\nend else\r\n\tif EntryDateFrom then\r\n\t    SearchStr<-1> = 'ENTRY_DATE':@vm:'>=':EntryDateFrom\r\n\tend\r\n\tif EntryDateThru then\r\n\t    SearchStr<-1> = 'ENTRY_DATE':@vm:'<=':EntryDateThru\r\n\tend\r\nend\r\n\r\nif EntryIds then\r\n    SearchStr<-1> = 'ENTRY_ID':@vm:EntryIds\r\nend\r\nif Wo then\r\n    SearchStr<-1> = 'WO':@vm:Wo\r\nend\r\nif Po then\r\n    SearchStr<-1> = 'PO':@VM:Po\r\nend\r\n\r\n\r\nIF TXDtsNull THEN\r\n\tSearchStr<-1> = 'SEND_DTM':@VM:''\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    btree.extract( SearchStr, 'COC', DictCOCTable, Keys, '', Flag )\r\n    if Flag <> 0 then\r\n       Void = msg( '', 'Error while extracting COC records...' )\r\n       return 0\r\n    end\r\n    if Keys then\r\n       convert @vm to @fm in Keys\r\n       Keys = key_sort( Keys, 'COC', 'CUST_NAME_BILL_TO':@fm:'#ENTRY_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"
        }
    }
}