All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.imsweb.validation.edits.translated.naaccr.NaaccrTranslatedCompiledRules3.groovy Maven / Gradle / Ivy

package com.imsweb.validation.edits.translated.naaccr

import com.imsweb.validation.functions.MetafileContextFunctions
import com.imsweb.validation.runtime.CompiledRules
import groovy.transform.CompileStatic

@CompileStatic
class NaaccrTranslatedCompiledRules3 implements CompiledRules {

    @Override
    public String getValidatorId() {
        return 'naaccr-translated'
    }

    @Override
    public String getValidatorVersion() {
        return 'NAACCR-011-01'
    }

    @Override
    public Map>> getMethodParameters() {
        return [
            'untrimmedlines' : [Binding.class, Map.class, MetafileContextFunctions.class, List.class],
            'untrimmedlines.untrimmedline' : [Binding.class, Map.class, MetafileContextFunctions.class, List.class, Map.class]
        ]
    }

    @Override
    public boolean containsRuleId(String id) {
        return 'NAACCR-00565' <= id && id <= 'NAACCR-00862'
    }

    // ID: NAACCR-00565; TAG: N1471; NAME: Comorbid/Complication 2, Date DX (COC)
    public boolean naaccr00565(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.comorbidComplication2))
            return true
        if (dx_year < 2011) {
            if (functions.GEN_INLIST(untrimmedline.comorbidComplication2, "00000,00100-13980,24000-99990", "(\\d\\d\\d\\d\\d)"))
                return true
            else {
                if (functions.GEN_INLIST(untrimmedline.comorbidComplication2, "8700-8799,9300-9499", "(E\\d\\d\\d\\d)", 2, 4))
                    return true
                else {
                    if (functions.GEN_INLIST(untrimmedline.comorbidComplication2, "0720-0739,1000-1590,2220-2310,2540,4400-4589,5041-5049", "(V\\d\\d\\d\\d)", 2, 4))
                        return true
                    else
                        return false
                }
            }
        }
        else {
            if (!functions.GEN_ILOOKUP(untrimmedline.comorbidComplication2, context.NAACCR_ICD9CM, context.NAACCR_ICD9CM_CODE, [:]))
                return false
        }
        
        return true

    }

    // ID: NAACCR-00566; TAG: N1473; NAME: Comorbid/Complication 3, Date DX (COC)
    public boolean naaccr00566(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.comorbidComplication3))
            return true
        if (dx_year < 2011) {
            if (functions.GEN_INLIST(untrimmedline.comorbidComplication3, "00000,00100-13980,24000-99990", "(\\d\\d\\d\\d\\d)"))
                return true
            else {
                if (functions.GEN_INLIST(untrimmedline.comorbidComplication3, "8700-8799,9300-9499", "(E\\d\\d\\d\\d)", 2, 4))
                    return true
                else {
                    if (functions.GEN_INLIST(untrimmedline.comorbidComplication3, "0720-0739,1000-1590,2220-2310,2540,4400-4589,5041-5049", "(V\\d\\d\\d\\d)", 2, 4))
                        return true
                    else
                        return false
                }
            }
        }
        else {
            if (!functions.GEN_ILOOKUP(untrimmedline.comorbidComplication3, context.NAACCR_ICD9CM, context.NAACCR_ICD9CM_CODE, [:]))
                return false
        }
        
        return true

    }

    // ID: NAACCR-00567; TAG: N1474; NAME: Comorbid/Complication 4, Date DX (COC)
    public boolean naaccr00567(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.comorbidComplication4))
            return true
        if (dx_year < 2011) {
            if (functions.GEN_INLIST(untrimmedline.comorbidComplication4, "00000,00100-13980,24000-99990", "(\\d\\d\\d\\d\\d)"))
                return true
            else {
                if (functions.GEN_INLIST(untrimmedline.comorbidComplication4, "8700-8799,9300-9499", "(E\\d\\d\\d\\d)", 2, 4))
                    return true
                else {
                    if (functions.GEN_INLIST(untrimmedline.comorbidComplication4, "0720-0739,1000-1590,2220-2310,2540,4400-4589,5041-5049", "(V\\d\\d\\d\\d)", 2, 4))
                        return true
                    else
                        return false
                }
            }
        }
        else {
            if (!functions.GEN_ILOOKUP(untrimmedline.comorbidComplication4, context.NAACCR_ICD9CM, context.NAACCR_ICD9CM_CODE, [:]))
                return false
        }
        
        return true

    }

    // ID: NAACCR-00568; TAG: N1475; NAME: Comorbid/Complication 5, Date DX (COC)
    public boolean naaccr00568(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.comorbidComplication5))
            return true
        if (dx_year < 2011) {
            if (functions.GEN_INLIST(untrimmedline.comorbidComplication5, "00000,00100-13980,24000-99990", "(\\d\\d\\d\\d\\d)"))
                return true
            else {
                if (functions.GEN_INLIST(untrimmedline.comorbidComplication5, "8700-8799,9300-9499", "(E\\d\\d\\d\\d)", 2, 4))
                    return true
                else {
                    if (functions.GEN_INLIST(untrimmedline.comorbidComplication5, "0720-0739,1000-1590,2220-2310,2540,4400-4589,5041-5049", "(V\\d\\d\\d\\d)", 2, 4))
                        return true
                    else
                        return false
                }
            }
        }
        else {
            if (!functions.GEN_ILOOKUP(untrimmedline.comorbidComplication5, context.NAACCR_ICD9CM, context.NAACCR_ICD9CM_CODE, [:]))
                return false
        }
        
        return true

    }

    // ID: NAACCR-00569; TAG: N1476; NAME: Comorbid/Complication 6, Date DX (COC)
    public boolean naaccr00569(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.comorbidComplication6))
            return true
        if (dx_year < 2011) {
            if (functions.GEN_INLIST(untrimmedline.comorbidComplication6, "00000,00100-13980,24000-99990", "(\\d\\d\\d\\d\\d)"))
                return true
            else {
                if (functions.GEN_INLIST(untrimmedline.comorbidComplication6, "8700-8799,9300-9499", "(E\\d\\d\\d\\d)", 2, 4))
                    return true
                else {
                    if (functions.GEN_INLIST(untrimmedline.comorbidComplication6, "0720-0739,1000-1590,2220-2310,2540,4400-4589,5041-5049", "(V\\d\\d\\d\\d)", 2, 4))
                        return true
                    else
                        return false
                }
            }
        }
        else {
            if (!functions.GEN_ILOOKUP(untrimmedline.comorbidComplication6, context.NAACCR_ICD9CM, context.NAACCR_ICD9CM_CODE, [:]))
                return false
        }
        
        return true

    }

    // ID: NAACCR-00570; TAG: N1477; NAME: Comorbid/Complication 7, Date DX (COC)
    public boolean naaccr00570(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.comorbidComplication7))
            return true
        if (dx_year < 2011) {
            if (functions.GEN_INLIST(untrimmedline.comorbidComplication7, "00000,00100-13980,24000-99990", "(\\d\\d\\d\\d\\d)"))
                return true
            else {
                if (functions.GEN_INLIST(untrimmedline.comorbidComplication7, "8700-8799,9300-9499", "(E\\d\\d\\d\\d)", 2, 4))
                    return true
                else {
                    if (functions.GEN_INLIST(untrimmedline.comorbidComplication7, "0720-0739,1000-1590,2220-2310,2540,4400-4589,5041-5049", "(V\\d\\d\\d\\d)", 2, 4))
                        return true
                    else
                        return false
                }
            }
        }
        else {
            if (!functions.GEN_ILOOKUP(untrimmedline.comorbidComplication7, context.NAACCR_ICD9CM, context.NAACCR_ICD9CM_CODE, [:]))
                return false
        }
        
        return true

    }

    // ID: NAACCR-00571; TAG: N1478; NAME: Comorbid/Complication 8, Date DX (COC)
    public boolean naaccr00571(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.comorbidComplication8))
            return true
        if (dx_year < 2011) {
            if (functions.GEN_INLIST(untrimmedline.comorbidComplication8, "00000,00100-13980,24000-99990", "(\\d\\d\\d\\d\\d)"))
                return true
            else {
                if (functions.GEN_INLIST(untrimmedline.comorbidComplication8, "8700-8799,9300-9499", "(E\\d\\d\\d\\d)", 2, 4))
                    return true
                else {
                    if (functions.GEN_INLIST(untrimmedline.comorbidComplication8, "0720-0739,1000-1590,2220-2310,2540,4400-4589,5041-5049", "(V\\d\\d\\d\\d)", 2, 4))
                        return true
                    else
                        return false
                }
            }
        }
        else {
            if (!functions.GEN_ILOOKUP(untrimmedline.comorbidComplication8, context.NAACCR_ICD9CM, context.NAACCR_ICD9CM_CODE, [:]))
                return false
        }
        
        return true

    }

    // ID: NAACCR-00572; TAG: N1479; NAME: Comorbid/Complication 9, Date DX (COC)
    public boolean naaccr00572(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.comorbidComplication9))
            return true
        if (dx_year < 2011) {
            if (functions.GEN_INLIST(untrimmedline.comorbidComplication9, "00000,00100-13980,24000-99990", "(\\d\\d\\d\\d\\d)"))
                return true
            else {
                if (functions.GEN_INLIST(untrimmedline.comorbidComplication9, "8700-8799,9300-9499", "(E\\d\\d\\d\\d)", 2, 4))
                    return true
                else {
                    if (functions.GEN_INLIST(untrimmedline.comorbidComplication9, "0720-0739,1000-1590,2220-2310,2540,4400-4589,5041-5049", "(V\\d\\d\\d\\d)", 2, 4))
                        return true
                    else
                        return false
                }
            }
        }
        else {
            if (!functions.GEN_ILOOKUP(untrimmedline.comorbidComplication9, context.NAACCR_ICD9CM, context.NAACCR_ICD9CM_CODE, [:]))
                return false
        }
        
        return true

    }

    // ID: NAACCR-00573; TAG: N0214; NAME: CompEthn, Date of Diag (SEER IF71)
    public boolean naaccr00573(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 1993) {
            if (functions.GEN_EMPTY(untrimmedline.computedEthnicity))
                return false
            else
                return true
        }
        
        return true

    }

    // ID: NAACCR-00574; TAG: N0215; NAME: Computed Ethnicity (SEER COMPETHN)
    public boolean naaccr00574(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.computedEthnicity, "0-7") || functions.GEN_EMPTY(untrimmedline.computedEthnicity))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00575; TAG: N0216; NAME: Computed Ethnicity Source (SEER ETHNSRC)
    public boolean naaccr00575(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.computedEthnicitySource, "0-9") || functions.GEN_EMPTY(untrimmedline.computedEthnicitySource))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00576; TAG: N0311; NAME: County (SEER IFCOUNTY)
    public boolean naaccr00576(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        
        char[] reg_county = new char[8]
        
        functions.GEN_STRCPY(reg_county, functions.GEN_SUBSTR(untrimmedline.registryId, 9, 2))
        
        functions.GEN_STRCAT(reg_county, untrimmedline.countyAtDx, 3)
        return functions.GEN_ILOOKUP(reg_county, context.NAACCR_SEERCNTY, context.NAACCR_SEERCNTY_SEERCNTY, [:])

    }

    // ID: NAACCR-00577; TAG: N0151; NAME: County at DX Reported (COC)
    public boolean naaccr00577(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.countyAtDx))
            return true
        return functions.GEN_MATCH(untrimmedline.countyAtDx, "(\\d\\d\\d)")

    }

    // ID: NAACCR-00578; TAG: N0354; NAME: County at DX Reported (NAACCR)
    public boolean naaccr00578(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_MATCH(untrimmedline.countyAtDx, "(\\d\\d\\d)")

    }

    // ID: NAACCR-00580; TAG: N0368; NAME: County at DX Reported, Addr at DX--State (NAACCR)
    public boolean naaccr00580(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] cnty_state = new char[6]
        
        if (functions.GEN_EMPTY(untrimmedline.countyAtDx) || functions.GEN_EMPTY(untrimmedline.addrAtDxState))
            return true
        if (functions.GEN_INLIST(untrimmedline.addrAtDxState, "CD,US,XX,YY,ZZ"))
            return true
        if (functions.GEN_INLIST(untrimmedline.addrAtDxState, "AB,BC,MB,NB,NL,NT,NS,NU,ON,PE,QC,SK,YT"))
            return true
        if (functions.GEN_INLIST(untrimmedline.addrAtDxState, "AA,AE,AP"))
            return true
        functions.GEN_STRCPY(cnty_state, untrimmedline.countyAtDx)
        functions.GEN_STRCAT(cnty_state, untrimmedline.addrAtDxState)
        
        if (functions.GEN_LOOKUP(cnty_state, context.NAACCR_CNTYALL, context.NAACCR_CNTYALL_CNTYSTAT, [:]))
            return true
        return false

    }

    // ID: NAACCR-00581; TAG: N0343; NAME: County at DX Reported, Date of Diagnosis (COC)
    public boolean naaccr00581(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (dx_year > 1995) {
            if (functions.GEN_EMPTY(untrimmedline.countyAtDx))
                return false
        }
        return true

    }

    // ID: NAACCR-00582; TAG: N0237; NAME: DC State File Number, Vital Status (NAACCR)
    public boolean naaccr00582(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.vitalStatus, "1")) {
            if (functions.GEN_EMPTY(untrimmedline.dcStateFileNumber))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00583; TAG: N0157; NAME: Date 1st Crs RX COC (COC)
    public boolean naaccr00583(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.date1stCrsRxCoc))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of 1st Crs RX--COC: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00584; TAG: N1095; NAME: Date 1st Crs RX COC, Date Flag (NAACCR)
    public boolean naaccr00584(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc)) {
            if (!functions.GEN_INLIST(untrimmedline.date1stCrsRxCocFlag, "10,11,12"))
                return functions.GEN_ERROR_MSG(binding, 'If Date 1st Crs RX COC is blank, corresponding Date 1st Crs RX COC Flag must = 10, 11, or 12')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.date1stCrsRxCocFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00585; TAG: N1079; NAME: Date 1st Crs RX COC Flag (NAACCR)
    public boolean naaccr00585(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.date1stCrsRxCocFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.date1stCrsRxCocFlag, "10,11,12"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00586; TAG: N1096; NAME: Date 1st Crs RX COC, Date Flag (NPCR)
    public boolean naaccr00586(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc) && functions.GEN_EMPTY(untrimmedline.date1stCrsRxCocFlag))
            return true
        if (functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc)) {
            if (!functions.GEN_INLIST(untrimmedline.date1stCrsRxCocFlag, "10,11,12"))
                return functions.GEN_ERROR_MSG(binding, 'If Date 1st Crs RX COC is blank, Date 1st Crs RX COC Flag must = 10, 11, 12, or blank')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.date1stCrsRxCocFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00587; TAG: N0798; NAME: Date 1st Crs RX COC, Date Initial RX SEER (NPCR)
    public boolean naaccr00587(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc) && functions.GEN_EMPTY(untrimmedline.date1stCrsRxCocFlag) && functions.GEN_EMPTY(untrimmedline.dateInitialRxSeerFlag) && functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer))
            return false
        return true

    }

    // ID: NAACCR-00588; TAG: N0199; NAME: Date 1st Crs RX COC, Date of Diagnosis (COC)
    public boolean naaccr00588(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        
        if (functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.date1stCrsRxCoc, untrimmedline.dateOfDiagnosis, ((Integer)context.NAACCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NAACCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.date1stCrsRxCoc))
                functions.GEN_ERROR_TEXT(binding, 'Date of 1st Crs RX--COC is invalid: %DC')
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfDiagnosis))
                    functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis is invalid: %DC')
            }
            return false
        }
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NAACCR-00589; TAG: N0200; NAME: Date 1st Crs RX COC, Date of Last Contact (COC)
    public boolean naaccr00589(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact) || functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.dateOfLastContact, untrimmedline.date1stCrsRxCoc, ((Integer)context.NAACCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NAACCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.date1stCrsRxCoc)) {
                functions.GEN_ERROR_TEXT(binding, 'Date of 1st Crs RX--COC is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact)) {
                    functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NAACCR-00590; TAG: N1348; NAME: Date 1st Crs RX COC, Dates of RX (COC)
    public boolean naaccr00590(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int earliest_dt
        int dtcmp
        
        if (functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc))
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateSurgery) && functions.GEN_EMPTY(untrimmedline.rxDateRadiation) && functions.GEN_EMPTY(untrimmedline.rxDateOther) && functions.GEN_EMPTY(untrimmedline.rxDateSystemic)) {
            return true
        }
        if ((!functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc)) && (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.date1stCrsRxCoc))) {
            functions.GEN_ERROR_TEXT(binding, 'Date of 1st Crs RX--COC: %DC')
            return false
        }
        if ((!functions.GEN_EMPTY(untrimmedline.rxDateSurgery)) && (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateSurgery))) {
            functions.GEN_ERROR_TEXT(binding, 'RX Date Surgery: %DC')
            return false
        }
        if ((!functions.GEN_EMPTY(untrimmedline.rxDateRadiation)) && (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateRadiation))) {
            functions.GEN_ERROR_TEXT(binding, 'RX Date Radiation: %DC')
            return false
        }
        if ((!functions.GEN_EMPTY(untrimmedline.rxDateSystemic)) && (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateSystemic))) {
            functions.GEN_ERROR_TEXT(binding, 'RX Date Systemic: %DC')
            return false
        }
        if ((!functions.GEN_EMPTY(untrimmedline.rxDateOther)) && (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateOther))) {
            functions.GEN_ERROR_TEXT(binding, 'RX Date Other: %DC')
            return false
        }
        if (functions.GEN_VAL(untrimmedline.rxDateSurgery) == functions.GEN_VAL(untrimmedline.date1stCrsRxCoc) || functions.GEN_VAL(untrimmedline.rxDateRadiation) == functions.GEN_VAL(untrimmedline.date1stCrsRxCoc) || functions.GEN_VAL(untrimmedline.rxDateSystemic) == functions.GEN_VAL(untrimmedline.date1stCrsRxCoc) || functions.GEN_VAL(untrimmedline.rxDateOther) == functions.GEN_VAL(untrimmedline.date1stCrsRxCoc))
            functions.GEN_NOOP()
        else {
            return false
        }
        if (functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateSurgery, untrimmedline.date1stCrsRxCoc, ((Integer)context.NAACCR_GEN_DT_MIN)) < 0 || functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateRadiation, untrimmedline.date1stCrsRxCoc, ((Integer)context.NAACCR_GEN_DT_MIN)) < 0 || functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateSystemic, untrimmedline.date1stCrsRxCoc, ((Integer)context.NAACCR_GEN_DT_MIN)) < 0 || functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateOther, untrimmedline.date1stCrsRxCoc, ((Integer)context.NAACCR_GEN_DT_MIN)) < 0)
            return false
        return true

    }

    // ID: NAACCR-00591; TAG: N1811; NAME: Date 1st Crs RX COC, Dates of RX (NAACCR)
    public boolean naaccr00591(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "10,11,12,20,30,40,82,85,86,87,88"))
            return true
        int earliest_dt
        char[] rx_flag = new char[2]
        int dtcmp
        
        if ((functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc) && functions.GEN_EMPTY(untrimmedline.date1stCrsRxCocFlag)) || (functions.GEN_EMPTY(untrimmedline.rxDateSurgery) && functions.GEN_EMPTY(untrimmedline.rxDateSurgeryFlag)) || (functions.GEN_EMPTY(untrimmedline.rxDateRadiation) && functions.GEN_EMPTY(untrimmedline.rxDateRadiationFlag)) || (functions.GEN_EMPTY(untrimmedline.rxDateOther) && functions.GEN_EMPTY(untrimmedline.rxDateOtherFlag)) || (functions.GEN_EMPTY(untrimmedline.rxDateChemo) && functions.GEN_EMPTY(untrimmedline.rxDateChemoFlag)) || (functions.GEN_EMPTY(untrimmedline.rxDateHormone) && functions.GEN_EMPTY(untrimmedline.rxDateHormoneFlag)) || (functions.GEN_EMPTY(untrimmedline.rxDateBrm) && functions.GEN_EMPTY(untrimmedline.rxDateBrmFlag)))
            return true
        if (functions.GEN_INLIST(untrimmedline.rxDateSurgeryFlag, "11") && functions.GEN_INLIST(untrimmedline.rxDateRadiationFlag, "11,15") && functions.GEN_INLIST(untrimmedline.rxDateChemoFlag, "11,15") && functions.GEN_INLIST(untrimmedline.rxDateHormoneFlag, "11,15") && functions.GEN_INLIST(untrimmedline.rxDateBrmFlag, "11,15") && functions.GEN_INLIST(untrimmedline.rxDateOtherFlag, "11,15"))
            return true
        if (functions.GEN_INLIST(untrimmedline.date1stCrsRxCocFlag, "10,12")) {
            if (functions.GEN_INLIST(untrimmedline.rxDateSurgeryFlag, "10,12") || functions.GEN_INLIST(untrimmedline.rxDateRadiationFlag, "10,12") || functions.GEN_INLIST(untrimmedline.rxDateChemoFlag, "10,12") || functions.GEN_INLIST(untrimmedline.rxDateHormoneFlag, "10,12") || functions.GEN_INLIST(untrimmedline.rxDateBrmFlag, "10,12") || functions.GEN_INLIST(untrimmedline.rxDateOtherFlag, "10,12"))
                return true
            else
                return functions.GEN_ERROR_TEXT(binding, 'Verify Date 1st Crs RX Flag with all other treatment flags')
        }
        if (!functions.GEN_INLIST(untrimmedline.rxDateSurgeryFlag, "11") || !functions.GEN_INLIST(untrimmedline.rxDateRadiationFlag, "11") || !functions.GEN_INLIST(untrimmedline.rxDateChemoFlag, "11") || !functions.GEN_INLIST(untrimmedline.rxDateHormoneFlag, "11") || !functions.GEN_INLIST(untrimmedline.rxDateBrmFlag, "11") || !functions.GEN_INLIST(untrimmedline.rxDateOtherFlag, "11")) {
            if (functions.GEN_INLIST(untrimmedline.date1stCrsRxCocFlag, "11"))
                return functions.GEN_ERROR_TEXT(binding, 'Verify Date 1st Crs RX Flag with all other treatment flags')
        }
        if (functions.GEN_VAL(untrimmedline.rxDateSurgery) == functions.GEN_VAL(untrimmedline.date1stCrsRxCoc) || functions.GEN_VAL(untrimmedline.rxDateRadiation) == functions.GEN_VAL(untrimmedline.date1stCrsRxCoc) || functions.GEN_VAL(untrimmedline.rxDateBrm) == functions.GEN_VAL(untrimmedline.date1stCrsRxCoc) || functions.GEN_VAL(untrimmedline.rxDateChemo) == functions.GEN_VAL(untrimmedline.date1stCrsRxCoc) || functions.GEN_VAL(untrimmedline.rxDateHormone) == functions.GEN_VAL(untrimmedline.date1stCrsRxCoc) || functions.GEN_VAL(untrimmedline.rxDateOther) == functions.GEN_VAL(untrimmedline.date1stCrsRxCoc))
            functions.GEN_NOOP()
        else {
            return false
        }
        if (functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateSurgery, untrimmedline.date1stCrsRxCoc, ((Integer)context.NAACCR_GEN_DT_MIN)) < 0 || functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateRadiation, untrimmedline.date1stCrsRxCoc, ((Integer)context.NAACCR_GEN_DT_MIN)) < 0 || functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateBrm, untrimmedline.date1stCrsRxCoc, ((Integer)context.NAACCR_GEN_DT_MIN)) < 0 || functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateChemo, untrimmedline.date1stCrsRxCoc, ((Integer)context.NAACCR_GEN_DT_MIN)) < 0 || functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateHormone, untrimmedline.date1stCrsRxCoc, ((Integer)context.NAACCR_GEN_DT_MIN)) < 0 || functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateOther, untrimmedline.date1stCrsRxCoc, ((Integer)context.NAACCR_GEN_DT_MIN)) < 0)
            return false
        return true

    }

    // ID: NAACCR-00592; TAG: N0827; NAME: Date Case Completed (NAACCR DATEEDIT)
    public boolean naaccr00592(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateCaseCompleted))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateCaseCompleted))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Case Completed: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00593; TAG: N0828; NAME: Date Case Completed, Date of Diagnosis (NAACCR)
    public boolean naaccr00593(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        
        if (functions.GEN_EMPTY(untrimmedline.dateCaseCompleted) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.dateCaseCompleted, untrimmedline.dateOfDiagnosis, ((Integer)context.NAACCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NAACCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateCaseCompleted))
                functions.GEN_ERROR_TEXT(binding, 'Date Case Completed is invalid: %DC')
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfDiagnosis))
                    functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis is invalid: %DC')
            }
            return false
        }
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NAACCR-00594; TAG: N1056; NAME: Date Case Completed--CoC (COC)
    public boolean naaccr00594(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateCaseCompletedCoc))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateCaseCompletedCoc))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date Case Completed--CoC: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00595; TAG: N1057; NAME: Date Case Completed--CoC, Date of Diagnosis (COC)
    public boolean naaccr00595(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (!functions.GEN_INLIST(untrimmedline.classOfCase, "00-22"))
            return true
        if (dx_year > 2009) {
            if (functions.GEN_EMPTY(untrimmedline.dateCaseCompletedCoc))
                return false
        }
        return true

    }

    // ID: NAACCR-00596; TAG: N1135; NAME: Date Case Initiated (NAACCR)
    public boolean naaccr00596(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateCaseInitiated))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateCaseInitiated))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Case Case Initiated: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00597; TAG: N1136; NAME: Date Case Last Changed (NAACCR)
    public boolean naaccr00597(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateCaseLastChanged))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateCaseLastChanged))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date Case Last Changed: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00598; TAG: N0612; NAME: Date Case Report Exported (NAACCR DATEEDIT)
    public boolean naaccr00598(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateCaseReportExported))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateCaseReportExported))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date Case Report Exported: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00599; TAG: N0613; NAME: Date Case Report Loaded (NAACCR DATEEDIT)
    public boolean naaccr00599(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateCaseReportLoaded))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateCaseReportLoaded))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date Case Report Loaded: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00600; TAG: N0489; NAME: Date Case Report Received (NAACCR DATEEDIT)
    public boolean naaccr00600(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateCaseReportReceived))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date Case Report Received: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00601; TAG: N0748; NAME: Date Conclusive DX (SEER)
    public boolean naaccr00601(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateConclusiveDx))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateConclusiveDx))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of Conclusive DX: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00602; TAG: N1076; NAME: Date Conclusive DX Flag (NAACCR)
    public boolean naaccr00602(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateConclusiveDxFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.dateConclusiveDxFlag, "10,11,12,15"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00603; TAG: N1132; NAME: Date Conclusive DX, Date Flag (NAACCR)
    public boolean naaccr00603(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateConclusiveDx) && functions.GEN_EMPTY(untrimmedline.dateConclusiveDxFlag))
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateConclusiveDx)) {
            if (!functions.GEN_INLIST(untrimmedline.dateConclusiveDxFlag, "10,11,12,15"))
                return functions.GEN_ERROR_MSG(binding, 'If date is blank, corresponding flag must = blank, 10, 11, 12, or 15')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.dateConclusiveDxFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00604; TAG: N1481; NAME: Date Conclusive DX, Date of DX (CCCR)
    public boolean naaccr00604(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int days_diff
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year > 2007) && (dx_year < 2013)) {
            if (functions.GEN_EMPTY(untrimmedline.dateConclusiveDx) && functions.GEN_EMPTY(untrimmedline.dateConclusiveDxFlag))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis = 2008-2012, then Date Conclusive DX and Date Conclusive DX Flag cannot both be blank')
        }
        if (dx_year < 2008) {
            if (!functions.GEN_EMPTY(untrimmedline.dateConclusiveDx) || !functions.GEN_EMPTY(untrimmedline.dateConclusiveDxFlag))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis < 2008, then Date Conclusive DX and Date Conclusive DX Flag must be blank')
        }
        if (functions.GEN_EMPTY(untrimmedline.dateConclusiveDx))
            return true
        days_diff = (functions.GEN_DAYDIFF_IOP(binding, untrimmedline.dateOfDiagnosis, untrimmedline.dateConclusiveDx, ((Integer)context.NAACCR_GEN_DT_MAX)))
        
        if (days_diff == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Conclusive DX: %DC')
        if (days_diff > 60)
            return true
        else
            return false
        return true

    }

    // ID: NAACCR-00605; TAG: N0883; NAME: Date Conclusive DX, Date of DX (SEER IF164)
    public boolean naaccr00605(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int days_diff
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year > 2006) && (dx_year < 2013)) {
            if (functions.GEN_EMPTY(untrimmedline.dateConclusiveDx) && functions.GEN_EMPTY(untrimmedline.dateConclusiveDxFlag))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis = 2007-2012, then Date Conclusive DX and Date Conclusive DX Flag cannot both be blank')
        }
        if (dx_year < 2007) {
            if (!functions.GEN_EMPTY(untrimmedline.dateConclusiveDx) || !functions.GEN_EMPTY(untrimmedline.dateConclusiveDxFlag))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis < 2007, then Date Conclusive DX and Date Conclusive DX Flag must be blank')
        }
        if (functions.GEN_EMPTY(untrimmedline.dateConclusiveDx))
            return true
        days_diff = (functions.GEN_DAYDIFF_IOP(binding, untrimmedline.dateOfDiagnosis, untrimmedline.dateConclusiveDx, ((Integer)context.NAACCR_GEN_DT_MAX)))
        
        if (days_diff == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Conclusive DX: %DC')
        if (days_diff > 60)
            return true
        else
            return false
        return true

    }

    // ID: NAACCR-00606; TAG: N0075; NAME: Date Initial RX SEER (NAACCR)
    public boolean naaccr00606(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateInitialRxSeer))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of Initial RX--SEER: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00607; TAG: N1080; NAME: Date Initial RX SEER Flag (NAACCR)
    public boolean naaccr00607(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateInitialRxSeerFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.dateInitialRxSeerFlag, "10,11,12"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00608; TAG: N0896; NAME: Date Initial RX SEER, Ca Dir RX 2003 (SEER IF180)
    public boolean naaccr00608(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int scope_flag
        int dx_year
        int seer_init_year
        
        scope_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2003 || dx_year >= 2018)
            return true
        seer_init_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateInitialRxSeer)
        
        if (seer_init_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Initial RX--SEER: %DC')
        if (dx_year < 2012) {
            if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90") || functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "1-7") || functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "1-5") || functions.GEN_INLIST(untrimmedline.rxSummRadiation, "1-6") || functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "2-9") || functions.GEN_INLIST(untrimmedline.rxSummBrm, "01") || functions.GEN_INLIST(untrimmedline.rxSummChemo, "01-03") || functions.GEN_INLIST(untrimmedline.rxSummHormone, "01") || functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "10-12,20,30,40") || functions.GEN_INLIST(untrimmedline.rxSummOther, "1,2,3,6")) {
                if (functions.GEN_INLIST(untrimmedline.dateInitialRxSeerFlag, "11"))
                    return false
                else
                    return true
            }
        }
        if (dx_year > 2011) {
            if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90") || functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "1,3-7") || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "2") && functions.GEN_INLIST(untrimmedline.regionalNodesExamined, "01-98")) || functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "1-5") || functions.GEN_INLIST(untrimmedline.rxSummRadiation, "1-6") || functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "2-9") || functions.GEN_INLIST(untrimmedline.rxSummBrm, "01") || functions.GEN_INLIST(untrimmedline.rxSummChemo, "01-03") || functions.GEN_INLIST(untrimmedline.rxSummHormone, "01") || functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "10-12,20,30,40") || functions.GEN_INLIST(untrimmedline.rxSummOther, "1,2,3,6")) {
                if (functions.GEN_INLIST(untrimmedline.dateInitialRxSeerFlag, "11"))
                    return false
                else
                    return true
            }
        }
        if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9729") && functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3)) || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9750,9760-9764,9800-9820,9826,9831-9920,9931-9964,9980-9989") || functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,700-729,760-768,809", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "9"))
                scope_flag = 1
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "0"))
                scope_flag = 1
            else {
                if (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "2") && functions.GEN_INLIST(untrimmedline.regionalNodesExamined, "00,99") && dx_year > 2011) {
                    scope_flag = 1
                }
            }
        }
        if (seer_init_year != ((Integer)context.NAACCR_GEN_DT_EMPTY)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "00,98") && (scope_flag == 1) && functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "0") && functions.GEN_INLIST(untrimmedline.rxSummRadiation, "0,7,8") && functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "0") && functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummOther, "0,7,8"))
                return false
        }
        return true

    }

    // ID: NAACCR-00609; TAG: N0895; NAME: Date Initial RX SEER, Ca Dir RX 98-02 (SEER IF179)
    public boolean naaccr00609(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int scope_flag
        int dx_year
        int seer_init_year
        
        scope_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year < 1998) || (dx_year > 2002))
            return true
        if ((dx_year < 2000) && functions.GEN_INLIST(untrimmedline.registryId, "0000001544", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)"))
            return true
        if (dx_year < 2003) {
            if (functions.GEN_INLIST(untrimmedline.registryId, "0000001562", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)"))
                return true
        }
        seer_init_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateInitialRxSeer)
        
        if (seer_init_year == ((Integer)context.NAACCR_GEN_DT_ERROR)) {
            return functions.GEN_ERROR_TEXT(binding, 'Date of Initial RX--SEER: %DC')
        }
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90") || functions.GEN_INLIST(untrimmedline.rxSummScopeReg9802, "1-8") || functions.GEN_INLIST(untrimmedline.rxSummSurgOth9802, "1-8") || functions.GEN_INLIST(untrimmedline.rxSummRadiation, "1-6") || functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "2-9") || functions.GEN_INLIST(untrimmedline.rxSummBrm, "01") || functions.GEN_INLIST(untrimmedline.rxSummChemo, "01-03") || functions.GEN_INLIST(untrimmedline.rxSummHormone, "01") || functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "10-12,20,30,40") || functions.GEN_INLIST(untrimmedline.rxSummOther, "1,2,3,6")) {
            if (functions.GEN_INLIST(untrimmedline.dateInitialRxSeerFlag, "11"))
                return false
            else
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummScopeReg9802, "9"))
                scope_flag = 1
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.rxSummScopeReg9802, "0")) {
                scope_flag = 1
            }
        }
        if (seer_init_year != ((Integer)context.NAACCR_GEN_DT_EMPTY)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "00") && (scope_flag == 1) && functions.GEN_INLIST(untrimmedline.rxSummSurgOth9802, "0") && functions.GEN_INLIST(untrimmedline.rxSummRadiation, "0,7,8") && functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "0") && functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummOther, "0,7,8"))
                return false
        }
        return true

    }

    // ID: NAACCR-00610; TAG: N0894; NAME: Date Initial RX SEER, Ca Dir RX Pre-98 (SEER IF34)
    public boolean naaccr00610(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int Surg_Flag, RadCNS_Flag, dx_year, seer_init_year
        
        Surg_Flag = 0
        RadCNS_Flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        seer_init_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateInitialRxSeer)
        
        if (seer_init_year == ((Integer)context.NAACCR_GEN_DT_ERROR)) {
            return functions.GEN_ERROR_TEXT(binding, 'Date of Initial RX--SEER: %DC')
        }
        if (dx_year >= 1998)
            return true
        if ((dx_year < 1988) && functions.GEN_INLIST(untrimmedline.registryId, "0000001529", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)"))
            return true
        if (functions.GEN_INLIST(untrimmedline.registryId, "0000001541,0000001544", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)"))
            return true
        if ((dx_year < 1988) && (functions.GEN_INLIST(untrimmedline.rxSummSurgeryType, "00") || (functions.GEN_INLIST(untrimmedline.rxSummSurgeryType, "09") && functions.GEN_INLIST(untrimmedline.reasonForNoSurgery, "6,8"))))
            Surg_Flag = 1
        if ((dx_year > 1987) && (functions.GEN_INLIST(untrimmedline.rxSummSurgeryType, "00-09") && functions.GEN_INLIST(untrimmedline.reasonForNoSurgery, "1-8")))
            Surg_Flag = 1
        if ((dx_year > 1987) && (functions.GEN_INLIST(untrimmedline.rxSummSurgeryType, "00-09") && functions.GEN_INLIST(untrimmedline.reasonForNoSurgery, "1-8")))
            Surg_Flag = 1
        if (Surg_Flag == 0) {
            if (functions.GEN_INLIST(untrimmedline.rxSummSurgeryType, "10-98") || functions.GEN_INLIST(untrimmedline.reasonForNoSurgery, "0"))
                Surg_Flag = 2
        }
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgeryType, "09") && functions.GEN_INLIST(untrimmedline.reasonForNoSurgery, "9"))
            Surg_Flag = 3
        if ((dx_year > 1987) && (functions.GEN_INLIST(untrimmedline.primarySite, "340-349", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9800-9941"))) {
            if (functions.GEN_INLIST(untrimmedline.rxSummRadToCns, "0,7,8"))
                RadCNS_Flag = 1
            else {
                if (functions.GEN_INLIST(untrimmedline.rxSummRadToCns, "1"))
                    RadCNS_Flag = 2
                else {
                    if (functions.GEN_INLIST(untrimmedline.rxSummRadToCns, "9")) {
                        RadCNS_Flag = 3
                    }
                }
            }
        }
        if ((Surg_Flag == 1) && functions.GEN_INLIST(untrimmedline.rxSummRadiation, "0,7,8") && ((RadCNS_Flag == 0) || (RadCNS_Flag == 1)) && functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "0") && functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00,82,85-88") && functions.GEN_INLIST(untrimmedline.rxSummOther, "0,7,8")) {
            if (functions.GEN_INLIST(untrimmedline.dateInitialRxSeerFlag, "11"))
                return true
            else
                return false
        }
        else {
            if ((Surg_Flag == 2) || functions.GEN_INLIST(untrimmedline.rxSummRadiation, "1-6") || (RadCNS_Flag == 2) || functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "2-9") || functions.GEN_INLIST(untrimmedline.rxSummBrm, "01") || functions.GEN_INLIST(untrimmedline.rxSummChemo, "01-03") || functions.GEN_INLIST(untrimmedline.rxSummHormone, "01") || functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "10-12,20,30,40") || functions.GEN_INLIST(untrimmedline.rxSummOther, "1,2,3,6")) {
                if (functions.GEN_INLIST(untrimmedline.dateInitialRxSeerFlag, "11"))
                    return false
                else
                    return true
            }
            else {
                if ((Surg_Flag == 3) || functions.GEN_INLIST(untrimmedline.rxSummRadiation, "9") || (RadCNS_Flag == 3) || functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "0") || functions.GEN_INLIST(untrimmedline.rxSummBrm, "99") || functions.GEN_INLIST(untrimmedline.rxSummChemo, "99") || functions.GEN_INLIST(untrimmedline.rxSummHormone, "99") || functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "99") || functions.GEN_INLIST(untrimmedline.rxSummOther, "9")) {
                    if (seer_init_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
                        return true
                    else
                        return false
                }
            }
        }
        return true

    }

    // ID: NAACCR-00611; TAG: N1098; NAME: Date Initial RX SEER, Date Flag. RPTSRC (SEER)
    public boolean naaccr00611(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "6") != 0) {
            if (!functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer) || functions.GEN_AT(untrimmedline.dateInitialRxSeerFlag, "11") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict among Date Initial RX SEER: ${untrimmedline.dateInitialRxSeer.formatDate()}, Date Initial RX SEER Flag: ${untrimmedline.dateInitialRxSeerFlag}, and Type of Reporting Source: ${untrimmedline.typeOfReportingSource}')
        }
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0) {
            if (!functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer) || functions.GEN_AT(untrimmedline.dateInitialRxSeerFlag, "10") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict among Date Initial RX SEER: ${untrimmedline.dateInitialRxSeer.formatDate()}, Date Initial RX SEER Flag: ${untrimmedline.dateInitialRxSeerFlag}, and Type of Reporting Source: ${untrimmedline.typeOfReportingSource}')
        }
        if (functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer)) {
            if (!functions.GEN_INLIST(untrimmedline.dateInitialRxSeerFlag, "10,11,12"))
                return functions.GEN_ERROR_MSG(binding, 'If Date Initial RX SEER is blank, corresponding Date Initial RX SEER Flag must = 10, 11, or 12')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.dateInitialRxSeerFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00612; TAG: N1099; NAME: Date Initial RX SEER, Date Flag (NPCR)
    public boolean naaccr00612(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer) && functions.GEN_EMPTY(untrimmedline.dateInitialRxSeerFlag))
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer)) {
            if (!functions.GEN_INLIST(untrimmedline.dateInitialRxSeerFlag, "10,11,12"))
                return functions.GEN_ERROR_MSG(binding, 'If Date Initial RX SEER is blank, Date Initial RX SEER Flag must = 10, 11, 12, or blank')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.dateInitialRxSeerFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00613; TAG: N0096; NAME: Date Initial RX SEER, Date Last Cont (NAACCR IF35)
    public boolean naaccr00613(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (functions.GEN_INLIST(untrimmedline.registryId, "0000001544", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            if (dx_year < 2000)
                return true
        }
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact) || functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.dateInitialRxSeer, untrimmedline.dateOfLastContact, ((Integer)context.NAACCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NAACCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateInitialRxSeer)) {
                functions.GEN_ERROR_TEXT(binding, 'Date of Initial RX--SEER is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact)) {
                    functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp <= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NAACCR-00614; TAG: N0095; NAME: Date Initial RX SEER, Date of DX (NAACCR IF18)
    public boolean naaccr00614(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        int dx_year, dx_month, dx_day, seer_year, seer_month, seer_day
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (functions.GEN_INLIST(untrimmedline.registryId, "0000001544", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            if (dx_year < 2000)
                return true
        }
        if (functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfDiagnosis))
            return true
        if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateInitialRxSeer))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.dateOfDiagnosis, untrimmedline.dateInitialRxSeer, ((Integer)context.NAACCR_GEN_DT_EXACT))
        
        if (dtcmp <= 0)
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        dx_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateOfDiagnosis)
        dx_day = functions.GEN_DATE_DAY_IOP(binding, untrimmedline.dateOfDiagnosis)
        seer_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateInitialRxSeer)
        seer_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateInitialRxSeer)
        seer_day = functions.GEN_DATE_DAY_IOP(binding, untrimmedline.dateInitialRxSeer)
        
        if (dx_month == ((Integer)context.NAACCR_GEN_DT_MONTH_EMPTY) || seer_month == ((Integer)context.NAACCR_GEN_DT_MONTH_EMPTY)) {
            if (dx_year <= seer_year)
                return true
            else
                return false
        }
        else {
            if (dx_day == ((Integer)context.NAACCR_GEN_DT_DAY_EMPTY) || seer_day == ((Integer)context.NAACCR_GEN_DT_DAY_EMPTY)) {
                if (dx_year < seer_year)
                    return true
                else {
                    if (dx_year == seer_year && dx_month <= seer_month)
                        return true
                    else
                        return false
                }
            }
            else
                return false
        }
        return false

    }

    // ID: NAACCR-00615; TAG: N0614; NAME: Date Tumor Record Availbl (NAACCR DATEEDIT)
    public boolean naaccr00615(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateTumorRecordAvailbl))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateTumorRecordAvailbl))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date Tumor Record Availbl: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00616; TAG: N0542; NAME: Date of 1st Contact (COC)
    public boolean naaccr00616(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOf1stContact))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOf1stContact))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of 1st Contact: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00617; TAG: N1070; NAME: Date of 1st Contact Flag (NAACCR)
    public boolean naaccr00617(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOf1stContactFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.dateOf1stContactFlag, "12"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00618; TAG: N1093; NAME: Date of 1st Contact, Date Flag (NAACCR)
    public boolean naaccr00618(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOf1stContact)) {
            if (!functions.GEN_INLIST(untrimmedline.dateOf1stContactFlag, "12"))
                return functions.GEN_ERROR_MSG(binding, 'If date is blank, corresponding flag must = 12, indicating unknown date')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.dateOf1stContactFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00619; TAG: N1034; NAME: Date of Birth (NAACCR)
    public boolean naaccr00619(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfBirth))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfBirth))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of Birth: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00620; TAG: N1035; NAME: Date of Birth Flag (NAACCR)
    public boolean naaccr00620(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfBirthFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.dateOfBirthFlag, "12"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00621; TAG: N1036; NAME: Date of Birth, Date Flag (NAACCR)
    public boolean naaccr00621(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfBirth)) {
            if (!functions.GEN_INLIST(untrimmedline.dateOfBirthFlag, "12"))
                return functions.GEN_ERROR_MSG(binding, 'If date is blank, corresponding flag must = 12, indicating unknown date')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.dateOfBirthFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00622; TAG: N1048; NAME: Date of Birth, Date of Diagnosis (NAACCR IF47)
    public boolean naaccr00622(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int months_diff, err_flag, dtcmp
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfBirth) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.dateOfBirth, untrimmedline.dateOfDiagnosis, ((Integer)context.NAACCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NAACCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfBirth))
                functions.GEN_ERROR_TEXT(binding, 'Date of Birth is invalid: %DC')
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfDiagnosis))
                    functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis is invalid: %DC')
            }
            return false
        }
        if (dtcmp <= 0)
            return true
        err_flag = 1
        
        // *** START function call Check_InUtero()
        int dx_year_1, birth_year_1
        
        dx_year_1 = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        birth_year_1 = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfBirth)
        
        if (dx_year_1 >= birth_year_1)
            months_diff = functions.GEN_MONTHDIFF_IOP(binding, untrimmedline.dateOfDiagnosis, untrimmedline.dateOfBirth, ((Integer)context.NAACCR_GEN_DT_MIN))
        else
            months_diff = functions.GEN_MONTHDIFF_IOP(binding, untrimmedline.dateOfBirth, untrimmedline.dateOfDiagnosis, ((Integer)context.NAACCR_GEN_DT_MIN))
        if (months_diff <= 7) {
            if (functions.GEN_INLIST(untrimmedline.overRideAgeSiteMorph, "2,3"))
                err_flag = 0
            else
                functions.GEN_ERROR_TEXT(binding, 'Please Review: Set over-ride to 2 or 3 if case diagnosed in utero')
        }
        else
            functions.GEN_ERROR_TEXT(binding, 'Please Review: Date of Birth cannot be more than 7 months after Diagnosis')
        null// *** END function call Check_InUtero()
        
        
        if (err_flag == 1)
            return false
        
        return true

    }

    // ID: NAACCR-00623; TAG: N1097; NAME: Date of Death Canada, Date Flag (CCCR)
    public boolean naaccr00623(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfDeathCanada) && functions.GEN_EMPTY(untrimmedline.dateOfDeathCanadaFlag))
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateOfDeathCanada)) {
            if (!functions.GEN_INLIST(untrimmedline.dateOfDeathCanadaFlag, "10,11,12"))
                return functions.GEN_ERROR_MSG(binding, 'If Date of Death--Canada is blank, Date of Death--CanadaFlag must = 10, 11, 12, or blank')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.dateOfDeathCanadaFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00624; TAG: N0957; NAME: Date of Death--Canada (CCCR)
    public boolean naaccr00624(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfDeathCanada))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfDeathCanada))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of Death--Canada: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00625; TAG: N1028; NAME: Date of Death--Canada, Vital Status (NAACCR)
    public boolean naaccr00625(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.vitalStatus))
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateOfDeathCanada) && functions.GEN_EMPTY(untrimmedline.dateOfDeathCanadaFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.vitalStatus, "1")) {
            if (functions.GEN_INLIST(untrimmedline.dateOfDeathCanadaFlag, "11"))
                return true
            else
                return false
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.dateOfDeathCanadaFlag, "11"))
                return false
            else
                return true
        }
        return true

    }

    // ID: NAACCR-00626; TAG: N1081; NAME: Date of Death--CanadaFlag (NAACCR)
    public boolean naaccr00626(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfDeathCanadaFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.dateOfDeathCanadaFlag, "10,11,12"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00627; TAG: N0021; NAME: Date of Diagnosis (NAACCR DATEEDIT)
    public boolean naaccr00627(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfDiagnosis))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00628; TAG: N0968; NAME: Date of Diagnosis Flag (NAACCR)
    public boolean naaccr00628(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfDiagnosisFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.dateOfDiagnosisFlag, "12"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00629; TAG: N0970; NAME: Date of Diagnosis, Date Flag (NAACCR)
    public boolean naaccr00629(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis)) {
            if (!functions.GEN_INLIST(untrimmedline.dateOfDiagnosisFlag, "12"))
                return functions.GEN_ERROR_MSG(binding, 'If date is blank, corresponding flag must = 12, indicating unknown date')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.dateOfDiagnosisFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00630; TAG: N2041; NAME: Date of Diagnosis, EOD Coding Sys, EOD (SEER IF33)
    public boolean naaccr00630(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int err_flag
        err_flag = 0
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((functions.GEN_INLIST(untrimmedline.registryId, "0000001544") && (dx_year == 1998 || dx_year == 1999)) && functions.GEN_EMPTY(untrimmedline.codingSystemForEod))
            return true
        if ((functions.GEN_INLIST(untrimmedline.registryId, "0000001535", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)") && dx_year < 1992))
            return true
        if (functions.GEN_INLIST(untrimmedline.registryId, "0000001563", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)"))
            return true
        if ((functions.GEN_INLIST(untrimmedline.registryId, "0000001544", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)") && dx_year < 1998)) {
            if (!functions.GEN_EMPTY(untrimmedline.codingSystemForEod))
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.registryId, "0000001561,0000001562", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            if (!functions.GEN_EMPTY(untrimmedline.codingSystemForEod))
                return false
            else
                return true
        }
        if (dx_year < 1983) {
            if (functions.GEN_INLIST(untrimmedline.codingSystemForEod, "0,1")) {
                if (functions.GEN_EMPTY(untrimmedline.eodOld13Digit) && functions.GEN_EMPTY(untrimmedline.eodOld4Digit) && functions.GEN_EMPTY(untrimmedline.extentOfDisease10Dig))
                    return true
                else
                    return false
            }
            if (functions.GEN_INLIST(untrimmedline.codingSystemForEod, "2")) {
                if (functions.GEN_EMPTY(untrimmedline.eodOld2Digit) && functions.GEN_EMPTY(untrimmedline.eodOld4Digit) && functions.GEN_EMPTY(untrimmedline.extentOfDisease10Dig) && (functions.GEN_MATCH(untrimmedline.eodOld13Digit, "([^ \\t\\r\\n\\v\\f]((\\d)|(\\-)|(&))*((\\s))*)") && functions.GEN_STRLEN(functions.GEN_TRIM(untrimmedline.eodOld13Digit, ((Integer)context.NAACCR_GEN_BOTH))) == 13))
                    return true
                else
                    return false
            }
            else
                return false
        }
        if (dx_year < 1988 && !functions.GEN_INLIST(untrimmedline.registryId, "0000001529", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            if (functions.GEN_INLIST(untrimmedline.codingSystemForEod, "3")) {
                if (functions.GEN_EMPTY(untrimmedline.eodOld2Digit) && functions.GEN_EMPTY(untrimmedline.eodOld13Digit) && functions.GEN_EMPTY(untrimmedline.extentOfDisease10Dig) && functions.GEN_MATCH(untrimmedline.eodOld4Digit, "(\\d\\d\\d\\d)"))
                    return true
                else
                    return false
            }
            else
                return false
        }
        if (dx_year < 2004) {
            if (functions.GEN_INLIST(untrimmedline.codingSystemForEod, "4")) {
                if (functions.GEN_EMPTY(untrimmedline.eodOld2Digit) && functions.GEN_EMPTY(untrimmedline.eodOld13Digit) && functions.GEN_EMPTY(untrimmedline.eodOld4Digit) && (functions.GEN_MATCH(untrimmedline.extentOfDisease10Dig, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)") || functions.GEN_MATCH(untrimmedline.extentOfDisease10Dig, "(\\d\\d\\d\\d\\d  \\d\\d\\d\\d\\d)")))
                    return true
                else
                    return false
            }
            else
                return false
        }
        if (dx_year > 2003) {
            if (!functions.GEN_EMPTY(untrimmedline.codingSystemForEod)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Coding System for EOD must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.eodOld2Digit)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, EOD--Old 2 Digit must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.eodOld13Digit)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, EOD--Old 13 Digit must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.eodOld4Digit)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, EOD--Old 4 Digit must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.eodTumorSize)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, EOD--Tumor Size must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.eodExtension)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, EOD--Extension must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.eodLymphNodeInvolv)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, EOD--Lymph Node Involv must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.eodExtensionProstPath)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, EOD--Extension Prost Path must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NAACCR-00631; TAG: N1102; NAME: Date of Inpt Adm (NAACCR)
    public boolean naaccr00631(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfInptAdm))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfInptAdm))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of Inpatient Adm: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00632; TAG: N1082; NAME: Date of Inpt Adm Flag (NAACCR)
    public boolean naaccr00632(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfInptAdmFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.dateOfInptAdmFlag, "10,11,12"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00633; TAG: N1100; NAME: Date of Inpt Adm, Date Flag (NAACCR)
    public boolean naaccr00633(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfInptAdm) && functions.GEN_EMPTY(untrimmedline.dateOfInptAdmFlag))
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateOfInptAdm)) {
            if (!functions.GEN_INLIST(untrimmedline.dateOfInptAdmFlag, "10,11,12"))
                return functions.GEN_ERROR_MSG(binding, 'If Date of Inpt Adm is blank, Date of Inpt Adm Flag must = 10, 11, 12, or blank')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.dateOfInptAdmFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00634; TAG: N1103; NAME: Date of Inpt Disch (NAACCR)
    public boolean naaccr00634(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfInptDisch))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfInptDisch))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of Inpatient Disch: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00635; TAG: N1083; NAME: Date of Inpt Disch Flag (NAACCR)
    public boolean naaccr00635(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfInptDischFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.dateOfInptDischFlag, "10,11,12"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00636; TAG: N1101; NAME: Date of Inpt Disch, Date Flag (NAACCR)
    public boolean naaccr00636(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfInptDisch) && functions.GEN_EMPTY(untrimmedline.dateOfInptDischFlag))
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateOfInptDisch)) {
            if (!functions.GEN_INLIST(untrimmedline.dateOfInptDischFlag, "10,11,12"))
                return functions.GEN_ERROR_MSG(binding, 'If Date of Inpt Disch is blank, Date of Inpt Disch Flag must = 10, 11, 12, or blank')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.dateOfInptDischFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00637; TAG: N0022; NAME: Date of Last Contact (NAACCR DATEEDIT)
    public boolean naaccr00637(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00638; TAG: N1069; NAME: Date of Last Contact Flag (NAACCR)
    public boolean naaccr00638(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContactFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.dateOfLastContactFlag, "12"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00639; TAG: N0312; NAME: Date of Last Contact, Cause of Death (SEER IF12)
    public boolean naaccr00639(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dolc_year
        
        dolc_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfLastContact)
        
        if (dolc_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dolc_year == ((Integer)context.NAACCR_GEN_DT_ERROR)) {
            return functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact: %DC')
        }
        if (functions.GEN_INLIST(untrimmedline.causeOfDeath, "0420-0449", "(\\d\\d\\d\\d)")) {
            if ((dolc_year <= 1986) || (!functions.GEN_INLIST(untrimmedline.vitalStatus, "0")) || (!functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "9")))
                return false
        }
        if (functions.GEN_AT(untrimmedline.icdRevisionNumber, "1") != 0 && functions.GEN_AT(untrimmedline.vitalStatus, "0") != 0 && functions.GEN_AT(untrimmedline.causeOfDeath, "U070U071U072", 4) != 0) {
            if (dolc_year >= 2019)
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00640; TAG: N1094; NAME: Date of Last Contact, Date Flag (NAACCR)
    public boolean naaccr00640(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact)) {
            if (!functions.GEN_INLIST(untrimmedline.dateOfLastContactFlag, "12"))
                return functions.GEN_ERROR_MSG(binding, 'If date is blank, corresponding flag must = 12, indicating unknown date')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.dateOfLastContactFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00641; TAG: N0024; NAME: Date of Last Contact, Date of Diag (NAACCR IF19)
    public boolean naaccr00641(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        int dx_year, dx_month, dx_day, last_year, last_month, last_day
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfDiagnosis))
            return true
        if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.dateOfDiagnosis, untrimmedline.dateOfLastContact, ((Integer)context.NAACCR_GEN_DT_EXACT))
        
        if (dtcmp <= 0)
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        dx_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateOfDiagnosis)
        dx_day = functions.GEN_DATE_DAY_IOP(binding, untrimmedline.dateOfDiagnosis)
        last_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfLastContact)
        last_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateOfLastContact)
        last_day = functions.GEN_DATE_DAY_IOP(binding, untrimmedline.dateOfLastContact)
        
        if (dx_month == ((Integer)context.NAACCR_GEN_DT_MONTH_EMPTY) || last_month == ((Integer)context.NAACCR_GEN_DT_MONTH_EMPTY)) {
            if (dx_year <= last_year)
                return true
            else
                return false
        }
        else {
            if (dx_day == ((Integer)context.NAACCR_GEN_DT_DAY_EMPTY) || last_day == ((Integer)context.NAACCR_GEN_DT_DAY_EMPTY)) {
                if (dx_year < last_year)
                    return true
                else {
                    if (dx_year == last_year && dx_month <= last_month)
                        return true
                    else
                        return false
                }
            }
            else
                return false
        }
        return false

    }

    // ID: NAACCR-00642; TAG: N1620; NAME: Date of Mult Tum, Lymphoma/Leukem/Unk Site (NAACCR)
    public boolean naaccr00642(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateOfMultTumors) && functions.GEN_EMPTY(untrimmedline.dateOfMultTumorsFlag))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2010) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9992")) || (functions.GEN_INLIST(untrimmedline.primarySite, "809", "(C\\d\\d\\d)", 2, 3))) {
                if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Date of Mult Tumors Flag must = 11')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11"))
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Date of Mult Tumors Flag must not = 11')
            }
            return true
        }
        if (dx_year > 2009) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9751-9758,9765-9769,9970"))
                return true
        }
        if (dx_year == 2010) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9729,9732-9733,9735-9738,9741-9742,9759-9764,9800-9920,9931-9967,9971-9992")) || (functions.GEN_INLIST(untrimmedline.primarySite, "809", "(C\\d\\d\\d)", 2, 3))) {
                if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Date of Mult Tumors Flag must = 11')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11"))
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Date of Mult Tumors Flag must not = 11')
            }
        }
        if (dx_year == 2011) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9729,9735-9738")) && (!functions.GEN_INLIST(untrimmedline.primarySite, "421,770-779", "(C\\d\\d\\d)", 2, 3)))
                return true
        }
        if (dx_year > 2010) {
            if ((functions.GEN_INLIST(untrimmedline.primarySite, "C809")) || ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9729,9735-9738")) && (functions.GEN_INLIST(untrimmedline.primarySite, "421,770-779", "(C\\d\\d\\d)", 2, 3))) || (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9732-9733,9741-9742,9759-9764,9800-9920,9931-9967,9971-9992"))) {
                if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Date of Mult Tumors Flag must = 11')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11"))
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Date of Mult Tumors Flag must not = 11')
            }
        }
        
        return true

    }

    // ID: NAACCR-00643; TAG: N0749; NAME: Date of Mult Tumors (SEER)
    public boolean naaccr00643(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfMultTumors))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfMultTumors))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Multiple Tumors: %DC')
            return false
        }
        
        return true

    }

    // ID: NAACCR-00644; TAG: N1077; NAME: Date of Mult Tumors Flag (NAACCR)
    public boolean naaccr00644(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfMultTumorsFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11,12,15"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00645; TAG: N1134; NAME: Date of Mult Tumors, Date Flag (NAACCR)
    public boolean naaccr00645(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfMultTumors) && functions.GEN_EMPTY(untrimmedline.dateOfMultTumorsFlag))
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateOfMultTumors)) {
            if (!functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11,12,15"))
                return functions.GEN_ERROR_MSG(binding, 'If Date of Mult Tumors is blank, Date of Mult Tumors Flag must = blank, 11, 12, or 15')
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.dateOfMultTumorsFlag))
                return functions.GEN_ERROR_MSG(binding, 'Either date or corresponding date flag must be blank if other is present')
        }
        return true

    }

    // ID: NAACCR-00646; TAG: N1482; NAME: Date of Mult Tumors, Date of DX (CCCR)
    public boolean naaccr00646(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year > 2007) && (dx_year < 2013)) {
            if (functions.GEN_EMPTY(untrimmedline.dateOfMultTumors) && functions.GEN_EMPTY(untrimmedline.dateOfMultTumorsFlag))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis = 2008-2012, then Date of Mult Tumors and Date of Mult Tumors Flag cannot both be blank')
        }
        if (dx_year < 2008) {
            if (!functions.GEN_EMPTY(untrimmedline.dateOfMultTumors) || !functions.GEN_EMPTY(untrimmedline.dateOfMultTumorsFlag))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis < 2008, then Date of Mult Tumors and Date of Mult Tumors Flag must be blank')
        }
        return true

    }

    // ID: NAACCR-00647; TAG: N0884; NAME: Date of Mult Tumors, Date of DX (SEER IF165)
    public boolean naaccr00647(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year > 2006) && (dx_year < 2013)) {
            if (functions.GEN_EMPTY(untrimmedline.dateOfMultTumors) && functions.GEN_EMPTY(untrimmedline.dateOfMultTumorsFlag))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis = 2007-2012, then Date of Mult Tumors and Date of Mult Tumors Flag cannot both be blank')
        }
        if (dx_year < 2007) {
            if (!functions.GEN_EMPTY(untrimmedline.dateOfMultTumors) || !functions.GEN_EMPTY(untrimmedline.dateOfMultTumorsFlag))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis < 2007, then Date of Mult Tumors and Date of Mult Tumors Flag must be blank')
        }
        return true

    }

    // ID: NAACCR-00648; TAG: N0830; NAME: Death Certificate Only, RX (NPCR)
    public boolean naaccr00648(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int err_flag
        err_flag = 0
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR) || dx_year < 2006)
            return true
        if (!functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (!functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "98,99", "(\\d\\d)")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Surg Prim Site')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "9")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Scope Reg LN Sur')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "9")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Surg Oth Reg/Dis')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.reasonForNoSurgery, "9")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & Reason for No Surgery')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummBrm, "99")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--BRM')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummChemo, "99")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Chemo')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummHormone, "99")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Hormone')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummOther, "9")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Other')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "99")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Transplnt/Endocr')
            err_flag = 1
        }
        if (dx_year < 2018) {
            if (!functions.GEN_INLIST(untrimmedline.radRegionalRxModality, "99")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & Rad--Regional RX Modality')
                err_flag = 1
            }
        }
        if (dx_year >= 2018) {
            if (!functions.GEN_INLIST(untrimmedline.phase1RadiationTreatmentModality, "99")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & Phase I Radiation Treatment Modality')
                err_flag = 1
            }
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "0")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Surg/Rad Seq')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummSystemicSurSeq, "0")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Systemic/Sur Seq ')
            err_flag = 1
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NAACCR-00649; TAG: N0674; NAME: Derived AJCC--Flag (CS)
    public boolean naaccr00649(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjccFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjccFlag, "1,2"))
            return true
        return false

    }

    // ID: NAACCR-00650; TAG: N0679; NAME: Derived AJCC--Flag, Derived AJCC (COC)
    public boolean naaccr00650(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int err_flag
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if ((dx_year == 2016 || dx_year == 2017) && (functions.GEN_EMPTY(untrimmedline.csExtension)))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        err_flag = 0
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjccFlag)) {
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6T)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 T')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 T Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6N)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 N')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 N Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6M)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 M')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 M Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 Stage Group')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7T)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 T')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 T Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7N)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 N')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 N Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7M)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 M')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 M Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 Stage Group')
                err_flag = 1
            }
        }
        else {
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6T)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 T')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 T Descriptor')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6N)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 N')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 N Descriptor')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6M)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 M')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 M Descriptor')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 Stage Group')
                err_flag = 1
            }
            if (dx_year > 2009) {
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7T)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 T')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7TDescript)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 T Descriptor')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7N)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 N')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7NDescript)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 N Descriptor')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7M)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 M')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7MDescript)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 M Descriptor')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7StageGrp)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 Stage Group')
                    err_flag = 1
                }
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NAACCR-00651; TAG: N0708; NAME: Derived AJCC--Flag, Derived AJCC (SEER)
    public boolean naaccr00651(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        char[] CS_code = new char[4]
        int t_schema_number, t_max_schemas, t_result
        int err_flag
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if ((dx_year == 2016 || dx_year == 2017) && (functions.GEN_EMPTY(untrimmedline.csExtension)))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        err_flag = 0
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjccFlag)) {
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6T)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 T')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 T Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6N)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 N')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 N Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6M)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 M')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 M Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 Stage Group')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7T)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 T')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 T Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7N)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 N')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 N Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7M)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 M')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 M Descriptor')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 Stage Group')
                err_flag = 1
            }
        }
        else {
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6T)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 T')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6N)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 N')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6M)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 M')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 Stage Group')
                err_flag = 1
            }
            if (dx_year > 2007) {
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6TDescript)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 T Descriptor')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6NDescript)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 N Descriptor')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6MDescript)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-6 M Descriptor')
                    err_flag = 1
                }
            }
            if (dx_year > 2009) {
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7T)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 T')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7TDescript)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 T Descriptor')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7N)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 N')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7NDescript)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 N Descriptor')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7M)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 M')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7MDescript)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 M Descriptor')
                    err_flag = 1
                }
                if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7StageGrp)) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Derived AJCC--Flag and Derived AJCC-7 Stage Group')
                    err_flag = 1
                }
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NAACCR-00652; TAG: N0670; NAME: Derived AJCC-6 M (CS)
    public boolean naaccr00652(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6M))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc6M, "00,10-13,19,88,99", "(\\d\\d)"))
            return true
        return false

    }

    // ID: NAACCR-00653; TAG: N0680; NAME: Derived AJCC-6 M Descriptor (CS)
    public boolean naaccr00653(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6MDescript))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc6MDescript, "c,p,a,y,N"))
            return true
        return false

    }

    // ID: NAACCR-00654; TAG: N0669; NAME: Derived AJCC-6 N (CS)
    public boolean naaccr00654(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6N))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc6N, "00-04,10-13,18-23,29,30-33,39,88,99", "(\\d\\d)"))
            return true
        return false

    }

    // ID: NAACCR-00655; TAG: N0681; NAME: Derived AJCC-6 N Descriptor (CS)
    public boolean naaccr00655(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6NDescript))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc6NDescript, "c,p,a,y,N"))
            return true
        return false

    }

    // ID: NAACCR-00656; TAG: N0671; NAME: Derived AJCC-6 Stage Group (CS)
    public boolean naaccr00656(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6StageGrp))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc6StageGrp, "00-02,10-24,30-43,50-63,70-74,88,90,99", "(\\d\\d)"))
            return true
        return false

    }

    // ID: NAACCR-00657; TAG: N0668; NAME: Derived AJCC-6 T (CS)
    public boolean naaccr00657(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6T))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc6T, "00,01,05-07,10-23,29-33,39-44,49,80,81,88,99", "(\\d\\d)"))
            return true
        return false

    }

    // ID: NAACCR-00658; TAG: N0682; NAME: Derived AJCC-6 T Descriptor (CS)
    public boolean naaccr00658(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6TDescript))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc6TDescript, "c,p,a,y,N"))
            return true
        return false

    }

    // ID: NAACCR-00659; TAG: N1019; NAME: Derived AJCC-7 M (CS)
    public boolean naaccr00659(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7M))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7M, "000,010,100,110,120,130,140,150,199,888,999", "(\\d\\d\\d)"))
            return true
        return false

    }

    // ID: NAACCR-00660; TAG: N1020; NAME: Derived AJCC-7 M Descriptor (CS)
    public boolean naaccr00660(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7MDescript))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7MDescript, "c,p,a,y,N"))
            return true
        return false

    }

    // ID: NAACCR-00661; TAG: N1017; NAME: Derived AJCC-7 N (CS)
    public boolean naaccr00661(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7N))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7N, "000,010,020,030,040,100,110,120,130,180,199,200", "(\\d\\d\\d)"))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7N, "210,220,230,299,300,310,320,330,399,400,888,999", "(\\d\\d\\d)"))
            return true
        return false

    }

    // ID: NAACCR-00662; TAG: N1021; NAME: Derived AJCC-7 N Descript (CS)
    public boolean naaccr00662(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7NDescript))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7NDescript, "c,p,a,y,N"))
            return true
        return false

    }

    // ID: NAACCR-00663; TAG: N1022; NAME: Derived AJCC-7 Stage Group (CS)
    public boolean naaccr00663(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7StageGrp))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7StageGrp, "000,010,020,100,110,120,121,130,140,150,151,160,170,180,190", "(\\d\\d\\d)"))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7StageGrp, "200,210,220,230,240,300,310,320,321,322,323,330,340,350,360,370,380,390, ", "(\\d\\d\\d)"))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7StageGrp, "400,410,420,430,500,510,520,530,540,541,542,550,560,570,580,590", "(\\d\\d\\d)"))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7StageGrp, "600,610,620,630,700,710,720,721,722,730,740,888,900,999", "(\\d\\d\\d)"))
            return true
        return false

    }

    // ID: NAACCR-00664; TAG: N1015; NAME: Derived AJCC-7 T (CS)
    public boolean naaccr00664(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7T))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7T, "000,010,050,060,070,100,110,120,121,122,130,140", "(\\d\\d\\d)"))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7T, "150,151,152,160,170,180,181,191,192,199, ", "(\\d\\d\\d)"))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7T, "200,201,202,210-213,220,230,240,299,300,301,302,310,320,330,340,399", "(\\d\\d\\d)"))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7T, "400,410,411,412,420,421,422,430,440,450,491,492,499,800,810,888,999", "(\\d\\d\\d)"))
            return true
        return false

    }

    // ID: NAACCR-00665; TAG: N1016; NAME: Derived AJCC-7 T Descript (CS)
    public boolean naaccr00665(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7TDescript))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedAjcc7TDescript, "c,p,a,y,N"))
            return true
        return false

    }

    // ID: NAACCR-00666; TAG: N0702; NAME: Derived CS Items, DX Pre-2004 (CS)
    public boolean naaccr00666(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int err_flag
        err_flag = 0
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2004) {
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6T)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-6 T must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-6 T Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6N)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-6 N must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-6 N Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6M)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-6 M must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-6 M Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-6 Stage Group must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7T)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-7 T must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-7 T Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7N)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-7 N must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-7 N Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7M)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-7 M must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-7 M Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived AJCC-7 Stage Group must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedSs1977)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived SS1977 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedSs2000)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived SS2000 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csVersionInputOriginal)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, CS Version Input Original must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csVersionInputCurrent)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, CS Version Input Current must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csVersionDerived)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, CS Version Derived must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NAACCR-00667; TAG: N1469; NAME: Derived CS Items, Date of DX (CCCR)
    public boolean naaccr00667(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        int dx_year
        int err_flag
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR) || dx_year > 2017)
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        functions.GEN_STRCPY(t_discrim, untrimmedline.csSiteSpecificFactor25)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if (dx_year > 2003) {
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6T)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 T cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 T Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6N)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 N cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 N Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6M)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 M cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 M Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 Stage Group cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedSs1977)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived SS1977 cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedSs2000)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived SS2000 cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.csVersionDerived)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, CS Version Derived cannot be blank')
                err_flag = 1
            }
        }
        if (dx_year > 2009) {
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7T)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 T cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 T Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7N)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 N cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 N Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7M)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 M cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 M Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 Stage Group cannot be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NAACCR-00668; TAG: N0699; NAME: Derived CS Items, Date of DX (COC)
    public boolean naaccr00668(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        int dx_year
        int err_flag
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        functions.GEN_STRCPY(t_discrim, untrimmedline.csSiteSpecificFactor25)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if (dx_year > 2015)
            return true
        if (dx_year > 2003) {
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6T)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 T cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 T Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6N)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 N cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 N Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6M)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 M cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 M Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived AJCC-6 Stage Group cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedSs1977)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived SS1977 cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedSs2000)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, Derived SS2000 cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.csVersionDerived)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2003, CS Version Derived cannot be blank')
                err_flag = 1
            }
        }
        if (dx_year > 2009) {
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7T)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 T cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 T Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7N)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 N cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 N Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7M)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 M cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 M Descriptor cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX > 2009, Derived AJCC-7 Stage Group cannot be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NAACCR-00669; TAG: N2351; NAME: Derived CS Items, Date of DX (NPCR)
    public boolean naaccr00669(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        int dx_year
        int err_flag
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2015)
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        functions.GEN_STRCPY(t_discrim, untrimmedline.csSiteSpecificFactor25)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if ((dx_year > 2003 && dx_year < 2016) && functions.GEN_EMPTY(untrimmedline.overRideCs20)) {
            if (functions.GEN_EMPTY(untrimmedline.derivedSs2000)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2016, Derived SS2000 cannot be blank')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.csVersionDerived)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2016, CS Version Derived cannot be blank')
                err_flag = 1
            }
            if (err_flag == 1)
                return false
        }
        functions.GEN_ERROR_MSG(binding, 'Conflict between Over-ride CS 20 (${untrimmedline.overRideCs20}) and Derived items')
        if (functions.GEN_INLIST(untrimmedline.overRideCs20, "1")) {
            if (!functions.GEN_EMPTY(untrimmedline.csVersionDerived)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, CS Version Derived must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedSs1977)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived SS1977 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedSs2000)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived SS2000 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6T)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-6 T must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-6 T Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6N)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-6 N must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-6 N Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6M)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-6 M must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-6 M Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc6StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-6 Stage Group must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7T)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-7 T must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-7 T Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7N)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-7 N must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-7 N Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7M)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-7 M must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-7 M Descriptor must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.derivedAjcc7StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived AJCC-7 Stage Group must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NAACCR-00670; TAG: N2408; NAME: Derived CS Items, Date of DX (SEER)
    public boolean naaccr00670(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        int dx_year
        int err_flag
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR) || dx_year > 2017)
            return true
        if (functions.GEN_INLIST(untrimmedline.registryId, "0000001562", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)"))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        functions.GEN_STRCPY(t_discrim, untrimmedline.csSiteSpecificFactor25)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if (((dx_year > 2003) && (dx_year < 2016)) || ((dx_year == 2016 || dx_year == 2017) && (!functions.GEN_EMPTY(untrimmedline.csExtension)))) {
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6T)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-6 T cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6N)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-6 N cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6M)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-6 M cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-6 Stage Group cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedSs1977)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived SS1977 cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedSs2000)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived SS2000 cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.csVersionDerived)) {
                functions.GEN_SAVE_TEXT(binding, 'CS Version Derived cannot be blank for this DX year')
                err_flag = 1
            }
        }
        if (((dx_year > 2007) && (dx_year < 2016)) || ((dx_year == 2016 || dx_year == 2017) && (!functions.GEN_EMPTY(untrimmedline.csExtension)))) {
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6TDescript)) {
                functions.GEN_SAVE_TEXT(binding, ' Derived AJCC-6 T Descriptor cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-6 N Descriptor cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc6MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-6 M Descriptor cannot be blank for this DX year')
                err_flag = 1
            }
        }
        if (((dx_year > 2009) && (dx_year < 2016)) || ((dx_year == 2016 || dx_year == 2017) && (!functions.GEN_EMPTY(untrimmedline.csExtension)))) {
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7T)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-7 T cannot be blank for this dx year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7TDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-7 T Descriptor cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7N)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-7 N cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7NDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-7 N Descriptor cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7M)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-7 M cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7MDescript)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-7 M Descriptor cannot be blank for this DX year')
                err_flag = 1
            }
            if (functions.GEN_EMPTY(untrimmedline.derivedAjcc7StageGrp)) {
                functions.GEN_SAVE_TEXT(binding, 'Derived AJCC-7 Stage Group cannot be blank for this DX year')
                err_flag = 1
            }
        }
        if (err_flag == 1) {
            functions.GEN_STRCPY(t_schema_msg, "Schema: ")
            functions.GEN_STRCAT(t_schema_msg, t_schema_name)
            functions.GEN_SAVE_TEXT(binding, t_schema_msg)
            return false
        }
        return true

    }

    // ID: NAACCR-00671; TAG: N0672; NAME: Derived SS1977 (CS)
    public boolean naaccr00671(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedSs1977))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedSs1977, "0-5, 7-9"))
            return true
        return false

    }

    // ID: NAACCR-00672; TAG: N0675; NAME: Derived SS1977--Flag (CS)
    public boolean naaccr00672(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedSs1977Flag))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedSs1977Flag, "1,2"))
            return true
        return false

    }

    // ID: NAACCR-00673; TAG: N0678; NAME: Derived SS1977--Flag, Derived SS1977 (CS)
    public boolean naaccr00673(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedSs1977Flag)) {
            if (functions.GEN_EMPTY(untrimmedline.derivedSs1977))
                return true
            else
                return false
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.derivedSs1977))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00674; TAG: N0673; NAME: Derived SS2000 (CS)
    public boolean naaccr00674(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedSs2000))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedSs2000, "0-5, 7-9"))
            return true
        return false

    }

    // ID: NAACCR-00675; TAG: N1029; NAME: Derived SS2000, Behavior ICDO3 (CS)
    public boolean naaccr00675(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        char[] CS_code = new char[4]
        int t_schema_number, t_max_schemas, t_result
        
        if (functions.GEN_EMPTY(untrimmedline.derivedSs2000))
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        functions.GEN_STRCPY(t_discrim, untrimmedline.csSiteSpecificFactor25)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1")) {
            if (functions.GEN_INLIST(untrimmedline.derivedSs2000, "8"))
                return true
            else {
                functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                return false
            }
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2") && functions.GEN_INLIST(t_schema_name, "Bladder") && functions.GEN_INLIST(untrimmedline.csExtension, "100")) {
                if (!functions.GEN_INLIST(untrimmedline.derivedSs2000, "0,8"))
                    return true
                else {
                    functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                    functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                    functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                    return false
                }
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
                    if (functions.GEN_INLIST(untrimmedline.derivedSs2000, "0"))
                        return true
                    else {
                        functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                        functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                        functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                        return false
                    }
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3") && functions.GEN_INLIST(t_schema_name, "Prostate") && functions.GEN_INLIST(untrimmedline.csExtension, "999") && functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor3, "000")) {
                        if (!functions.GEN_INLIST(untrimmedline.derivedSs2000, "8"))
                            return true
                        else {
                            functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                            functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                            functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                            return false
                        }
                    }
                    else {
                        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
                            if (!functions.GEN_INLIST(untrimmedline.derivedSs2000, "0,8"))
                                return true
                            else {
                                functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                                functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                                functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                                return false
                            }
                        }
                    }
                }
            }
        }
        return true

    }

    // ID: NAACCR-00676; TAG: N0676; NAME: Derived SS2000--Flag (CS)
    public boolean naaccr00676(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedSs2000Flag))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedSs2000Flag, "1,2"))
            return true
        return false

    }

    // ID: NAACCR-00677; TAG: N0677; NAME: Derived SS2000--Flag, Derived SS2000 (CS)
    public boolean naaccr00677(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedSs2000Flag)) {
            if (functions.GEN_EMPTY(untrimmedline.derivedSs2000))
                return true
            else
                return false
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.derivedSs2000))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00678; TAG: N0217; NAME: Diagnostic Confirm, Seq Num--Central (SEER IF23)
    public boolean naaccr00678(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.overRideSeqnoDxconf, "1") || functions.GEN_INLIST(untrimmedline.primarySite, "760-768, 809", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.sequenceNumberCentral, "60-99"))
            return true
        if (functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "6-9") && !functions.GEN_MATCH(untrimmedline.sequenceNumberCentral, "(00)"))
            return false
        return true

    }

    // ID: NAACCR-00679; TAG: N0369; NAME: Diagnostic Confirm, Seq Num--Hosp (NAACCR)
    public boolean naaccr00679(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.overRideHospseqDxconf, "1") || functions.GEN_INLIST(untrimmedline.primarySite, "760-768, 809", "(C\\d\\d\\d)", 2, 3))
            return true
        if (functions.GEN_INLIST(untrimmedline.sequenceNumberHospital, "60-99"))
            return true
        if (functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "6-9") && functions.GEN_INLIST(untrimmedline.sequenceNumberHospital, "01-99"))
            return false
        return true

    }

    // ID: NAACCR-00680; TAG: N0003; NAME: Diagnostic Confirmation (SEER DXCONF)
    public boolean naaccr00680(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "1-9")

    }

    // ID: NAACCR-00681; TAG: N0044; NAME: Diagnostic Confirmation, Behavior ICDO2 (SEER IF31)
    public boolean naaccr00681(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.behaviorIcdO2))
            return true
        if (functions.GEN_MATCH(untrimmedline.overRideHistology, "(2)|(3)"))
            return true
        if (functions.GEN_MATCH(untrimmedline.behaviorIcdO2, "(2)")) {
            if (!functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "1,2,4"))
                return false
        }
        return true

    }

    // ID: NAACCR-00682; TAG: N0471; NAME: Diagnostic Confirmation, Behavior ICDO3 (SEER IF31)
    public boolean naaccr00682(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        if (functions.GEN_MATCH(untrimmedline.overRideHistology, "(2)|(3)"))
            return true
        if (functions.GEN_MATCH(untrimmedline.behaviorCodeIcdO3, "(2)")) {
            if (!functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "1,2,4"))
                return false
        }
        return true

    }

    // ID: NAACCR-00683; TAG: N0313; NAME: Diagnostic Confirmation, Date of Diag (SEER IF55)
    public boolean naaccr00683(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 1988)
            return functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "1,2,4,6-9")
        else {
            if (dx_year < 2010)
                return functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "1,2,4-9")
            else
                return functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "1-9")
        }
        
        return true

    }

    // ID: NAACCR-00684; TAG: N0004; NAME: Diagnostic Confirmation, Histology ICDO2 (SEER IF48)
    public boolean naaccr00684(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2000)
            return true
        if (functions.GEN_INLIST(untrimmedline.overRideLeukLymphoma, "1"))
            return true
        if ((functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9590-9717", "(\\d\\d\\d\\d)") && functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "6,8")))
            return false
        if ((functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9720-9941", "(\\d\\d\\d\\d)") && functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "6")))
            return false
        return true

    }

    // ID: NAACCR-00685; TAG: N0444; NAME: Diagnostic Confirmation, Histology ICDO3 (SEER IF48)
    public boolean naaccr00685(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_INLIST(untrimmedline.overRideLeukLymphoma, "1"))
            return true
        if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9993", "(\\d\\d\\d\\d)") && functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "6")))
            return false
        if (functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "3")) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9993"))
                return false
        }
        return true

    }

    // ID: NAACCR-00686; TAG: N0314; NAME: Diagnostic Proc 73-87 (SEER DXINFO)
    public boolean naaccr00686(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.diagnosticProc7387, "00-91", "(\\d\\d)|(\\s\\s)")

    }

    // ID: NAACCR-00687; TAG: N0731; NAME: EOD--Ext Prost Path,RX Summ--Surg Prim Site (SEER)
    public boolean naaccr00687(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.eodExtensionProstPath) || functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite) || !functions.GEN_INLIST(untrimmedline.primarySite, "619", "(C\\d\\d\\d)", 2, 3))
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "6,7"))
            return true
        if (!functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "30,50,70,80,90")) {
            if (!functions.GEN_INLIST(untrimmedline.eodExtensionProstPath, "90,98,99"))
                return false
        }
        return true

    }

    // ID: NAACCR-00688; TAG: N0775; NAME: EOD--Ext Prost Path,RX Summ--Surg Sit 98-02 (SEER)
    public boolean naaccr00688(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.eodExtensionProstPath) || functions.GEN_EMPTY(untrimmedline.rxSummSurgSite9802) || !functions.GEN_INLIST(untrimmedline.primarySite, "619", "(C\\d\\d\\d)", 2, 3))
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "6,7"))
            return true
        if (!functions.GEN_INLIST(untrimmedline.rxSummSurgSite9802, "30,40,50,70,80,90")) {
            if (!functions.GEN_INLIST(untrimmedline.eodExtensionProstPath, "90,98,99"))
                return false
        }
        return true

    }

    // ID: NAACCR-00689; TAG: N0232; NAME: EOD--Extension (SEER)
    public boolean naaccr00689(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.eodExtension))
            return true
        return functions.GEN_MATCH(untrimmedline.eodExtension, "(\\d\\d)")

    }

    // ID: NAACCR-00690; TAG: N0615; NAME: EOD--Extension Prost Path (SEER)
    public boolean naaccr00690(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.eodExtensionProstPath))
            return true
        return functions.GEN_MATCH(untrimmedline.eodExtensionProstPath, "(\\d\\d)")

    }

    // ID: NAACCR-00691; TAG: N0420; NAME: EOD--Extension Prost Path, Prim Site, ICDO2 (NAACCR)
    public boolean naaccr00691(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int histo
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (functions.GEN_AT(untrimmedline.codingSystemForEod, "4") == 0)
            return true
        if (dx_year < 1995 || dx_year > 1997 || dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
            return true
        if (functions.GEN_EMPTY(untrimmedline.behaviorIcdO2))
            return true
        if (functions.GEN_AT(untrimmedline.primarySite, "C619") == 0) {
            if (!functions.GEN_EMPTY(untrimmedline.eodExtensionProstPath))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'EOD--Extension Prost Path must be blank for non-prostate cases')
        }
        if (functions.GEN_AT(untrimmedline.primarySite, "C619") != 0 && (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "8000-9589") && !functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9140"))) {
            if (functions.GEN_EMPTY(untrimmedline.eodExtensionProstPath))
                return false
            if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0) {
                if (functions.GEN_AT(untrimmedline.eodExtensionProstPath, "90") == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Death Certificate Only, EOD--Extension Prost Path must = 90')
            }
            if (functions.GEN_AT(untrimmedline.behaviorIcdO2, "2") != 0) {
                if (functions.GEN_AT(untrimmedline.eodExtensionProstPath, "0099", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'In Situ EOD--Extension Prost Path is invalid')
            }
            if (functions.GEN_AT(untrimmedline.behaviorIcdO2, "3") != 0) {
                if (!functions.GEN_INLIST(untrimmedline.eodExtensionProstPath, "20-23,30-34,41-45,49,50-53,60-61,70,85,90,98,99"))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Malignant EOD--Extension Prost Path is invalid')
            }
        }
        return true

    }

    // ID: NAACCR-00692; TAG: N0474; NAME: EOD--Extension Prost Path, Prim Site, ICDO3 (NAACCR)
    public boolean naaccr00692(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (functions.GEN_AT(untrimmedline.codingSystemForEod, "4") == 0)
            return true
        if (dx_year < 1998 || dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        if (functions.GEN_AT(untrimmedline.primarySite, "C619") == 0) {
            if (!functions.GEN_EMPTY(untrimmedline.eodExtensionProstPath))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'EOD--Extension Prost Path must be blank for non-prostate cases')
        }
        if (functions.GEN_AT(untrimmedline.primarySite, "C619") != 0 && (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9589") && !functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140"))) {
            if (functions.GEN_EMPTY(untrimmedline.eodExtensionProstPath))
                return false
            if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0) {
                if (functions.GEN_AT(untrimmedline.eodExtensionProstPath, "90") == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Death Certificate Only, EOD--Extension Prost Path must = 90')
            }
            if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "2") != 0) {
                if (functions.GEN_AT(untrimmedline.eodExtensionProstPath, "0099", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'In Situ EOD--Extension Prost Path is invalid')
            }
            if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "3") != 0) {
                if (!functions.GEN_INLIST(untrimmedline.eodExtensionProstPath, "20,23,30-34,40-43,45,48,50,60,70,85,90,98,99"))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Malignant EOD--Extension Prost Path is invalid')
            }
        }
        return true

    }

    // ID: NAACCR-00694; TAG: N2362; NAME: EOD--Extension, Primary Site, ICDO3 (NAACCR)
    public boolean naaccr00694(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, extflg
        
        char[] W_SiteExt = new char[7], W_HistExt = new char[7]
        
        extflg = 0
        
        if (functions.GEN_EMPTY(untrimmedline.eodExtension) || functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if ((dx_year < 1998) || (dx_year > 2003))
            return true
        if (!(functions.GEN_MATCH(untrimmedline.eodExtension, "(\\d\\d)")))
            return functions.GEN_ERROR_MSG(binding, 'EOD--Extension must be a two-digit number')
        if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1,2,3"))
            return true
        if (!functions.GEN_MATCH(untrimmedline.primarySite, "(C\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Primary Site not valid')
        if (!functions.GEN_MATCH(untrimmedline.histologicTypeIcdO3, "(\\d\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Histologic Type not valid - ICDO3')
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7")) {
            if (!functions.GEN_INLIST(untrimmedline.primarySite, "C619")) {
                if (functions.GEN_INLIST(untrimmedline.eodExtension, "99"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'Death Certificate Only, EOD--Extension for this site must = 99')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.eodExtension, "90"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'Death Certificate Only, EOD--Extension for prostate must = 90')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140,9590-9699,9702-9729,9731-9989")) {
                if (!functions.GEN_EMPTY(untrimmedline.eodExtension))
                    extflg = 1
                else
                    return true
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632,690, 691-694,698-699", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                    if (!functions.GEN_INLIST(untrimmedline.eodExtension, "00"))
                        extflg = 1
                    else
                        return true
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9701")) {
                        if (!functions.GEN_EMPTY(untrimmedline.eodExtension))
                            extflg = 1
                        else
                            return true
                    }
                    else {
                        functions.GEN_STRCPY(W_SiteExt, untrimmedline.primarySite)
                        functions.GEN_STRCAT(W_SiteExt, untrimmedline.eodExtension)
                        if (!functions.GEN_ILOOKUP(W_SiteExt, context.NAACCR_EXT03INS, context.NAACCR_EXT03INS_SITEEXT, [:]))
                            extflg = 1
                        else
                            return true
                    }
                }
            }
            if (extflg == 1)
                return functions.GEN_ERROR_MSG(binding, 'In Situ EOD--Extension (${untrimmedline.eodExtension}) invalid for this site/histology/behavior')
            else
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1,3")) {
        
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140")) {
                if (!functions.GEN_INLIST(untrimmedline.eodExtension, "11,12,13,21,22,23,24,25,26,27,29,99"))
                    extflg = 1
                else
                    return true
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9699,9702-9729")) {
                    if (functions.GEN_INLIST(untrimmedline.primarySite, "778", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.eodExtension, "10,11"))
                        extflg = 1
                    else {
                        if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,11,20,21,30,31,32,33,80,99"))
                            extflg = 1
                        else
                            return true
                    }
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731-9992")) {
                        if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,80,99"))
                            extflg = 1
                        else {
                            if (functions.GEN_INLIST(untrimmedline.eodExtension, "10") && !functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731,9734,9740,9750-9752,9755-9758,9764,9930"))
                                extflg = 1
                            else {
                                if (functions.GEN_INLIST(untrimmedline.eodExtension, "80") && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9751,9752"))
                                    extflg = 1
                                else {
                                    if (functions.GEN_INLIST(untrimmedline.eodExtension, "99") && !functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731,9734,9740,9750-9758,9764,9930"))
                                        extflg = 1
                                    else
                                        return true
                                }
                            }
                        }
                    }
                    else {
                        if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                            if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,11,20,21,30,31,40,41,50,51,60,62,64,70,80,85,87,99"))
                                extflg = 1
                            else
                                return true
                        }
                        else {
                            if (functions.GEN_INLIST(untrimmedline.primarySite, "690", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                                if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,12,15,20,30,70,80,85,99"))
                                    extflg = 1
                                else
                                    return true
                            }
                            else {
                                if (functions.GEN_INLIST(untrimmedline.primarySite, "691-694,698,699", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                                    if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,12,15,17,20,25,30,40,43,44,45,50,55,56,70,80,85,99"))
                                        extflg = 1
                                    else
                                        return true
                                }
                                else {
                                    if (functions.GEN_INLIST(untrimmedline.primarySite, "692", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9510-9514")) {
                                        if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,12,15,30,40,45,48,50,55,60,70,72,75,80,85,99"))
                                            extflg = 1
                                        else
                                            return true
                                    }
                                    else {
                                        if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9701")) {
                                            if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,20,25,30,50,70,85,99"))
                                                extflg = 1
                                            else
                                                return true
                                        }
                                        else {
                                            functions.GEN_STRCPY(W_SiteExt, untrimmedline.primarySite)
                                            functions.GEN_STRCAT(W_SiteExt, untrimmedline.eodExtension)
                                            if (!functions.GEN_ILOOKUP(W_SiteExt, context.NAACCR_EXT3SITM, context.NAACCR_EXT3SITM_SITEEXT, [:]))
                                                extflg = 1
                                            else
                                                return true
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if (extflg == 1)
            return functions.GEN_ERROR_MSG(binding, 'Malignant EOD--Extension (${untrimmedline.eodExtension}) invalid for this site/histology/behavior')
        return true

    }

    // ID: NAACCR-00695; TAG: N0233; NAME: EOD--Lymph Node Involv (SEER)
    public boolean naaccr00695(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.eodLymphNodeInvolv))
            return true
        return functions.GEN_MATCH(untrimmedline.eodLymphNodeInvolv, "(\\d)")

    }

    // ID: NAACCR-00697; TAG: N2363; NAME: EOD--Lymph Node Involv, Prim Site, ICDO3 (NAACCR)
    public boolean naaccr00697(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, LNflg
        
        char[] W_SiteLN = new char[7]
        
        if (functions.GEN_EMPTY(untrimmedline.eodLymphNodeInvolv) || functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if ((dx_year < 1998) || (dx_year > 2003))
            return true
        if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1,2,3"))
            return true
        if (!(functions.GEN_MATCH(untrimmedline.eodLymphNodeInvolv, "(\\d)")))
            return functions.GEN_ERROR_MSG(binding, 'EOD--Lymph Node Involv must be a one-digit number')
        if (!functions.GEN_MATCH(untrimmedline.primarySite, "(C\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Primary Site not valid')
        if (!functions.GEN_MATCH(untrimmedline.histologicTypeIcdO3, "(\\d\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Histologic Type not valid - ICDO3')
        if (functions.GEN_VAL(untrimmedline.typeOfReportingSource) == 7) {
            if (functions.GEN_VAL(untrimmedline.eodLymphNodeInvolv) == 9)
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'Death Certificate Only, EOD--Lymph Node Involv must = 9')
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140,9590-9699,9702-9729,9731-9989")) {
                if (!functions.GEN_EMPTY(untrimmedline.eodLymphNodeInvolv))
                    LNflg = 1
                else
                    return true
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632,690,691-694,698-699", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                    if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0"))
                        LNflg = 1
                    else
                        return true
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9701")) {
                        if (!functions.GEN_EMPTY(untrimmedline.eodLymphNodeInvolv))
                            LNflg = 1
                        else
                            return true
                    }
                    else {
                        functions.GEN_STRCPY(W_SiteLN, untrimmedline.primarySite)
                        functions.GEN_STRCAT(W_SiteLN, untrimmedline.eodLymphNodeInvolv)
                        if (!functions.GEN_ILOOKUP(W_SiteLN, context.NAACCR_LN03INS, context.NAACCR_LN03INS_SITE_LN, [:]))
                            LNflg = 1
                        else
                            return true
                    }
                }
            }
            if (LNflg == 1)
                return functions.GEN_ERROR_MSG(binding, 'In Situ EOD--Lymph Node Involv (${untrimmedline.eodLymphNodeInvolv}) invalid for this site/histology/behavior')
            else
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1,3")) {
        
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140,9590-9699,9702-9729")) {
                if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0,1,2,3,9"))
                    LNflg = 1
                else
                    return true
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731-9992")) {
                    if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "9"))
                        LNflg = 1
                    else
                        return true
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                        if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0-5,7-9"))
                            LNflg = 1
                        else
                            return true
                    }
                    else {
                        if (functions.GEN_INLIST(untrimmedline.primarySite, "690", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                            if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0,1,7-9"))
                                LNflg = 1
                            else
                                return true
                        }
                        else {
                            if (functions.GEN_INLIST(untrimmedline.primarySite, "691-694,698,699", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                                if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0,1,7-9"))
                                    LNflg = 1
                                else
                                    return true
                            }
                            else {
                                if (functions.GEN_INLIST(untrimmedline.primarySite, "692", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9510-9514")) {
                                    if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0,1,7-9"))
                                        LNflg = 1
                                    else
                                        return true
                                }
                                else {
                                    if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9701")) {
                                        if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0-3,9"))
                                            LNflg = 1
                                        else
                                            return true
                                    }
                                    else {
                                        functions.GEN_STRCPY(W_SiteLN, untrimmedline.primarySite)
                                        functions.GEN_STRCAT(W_SiteLN, untrimmedline.eodLymphNodeInvolv)
                                        if (!functions.GEN_ILOOKUP(W_SiteLN, context.NAACCR_LN03MAL, context.NAACCR_LN03MAL_SITE_LN, [:]))
                                            LNflg = 1
                                        else
                                            return true
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if (LNflg == 1)
            return functions.GEN_ERROR_MSG(binding, 'Malignant EOD--Lymph Node Involv (${untrimmedline.eodLymphNodeInvolv}) invalid for this site/histology/behavior')
        return true

    }

    // ID: NAACCR-00698; TAG: N0422; NAME: EOD--Lymph Node Involv, Reg Nodes Pos,ICDO2 (NAACCR)
    public boolean naaccr00698(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int hist4, rnp, year
        boolean kaposi, hematop, lympho, mycosis, brain, othcns, othill
        char[] hist4c = new char[5]
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.eodLymphNodeInvolv) || functions.GEN_EMPTY(untrimmedline.regionalNodesPositive) || functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year < 1998) || (dx_year > 2000)) {
            return true
        }
        if (!functions.GEN_MATCH(untrimmedline.primarySite, "(C\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Primary Site not valid')
        if (!functions.GEN_MATCH(untrimmedline.histologyIcdO2, "(\\d\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Histologic Type not valid - ICDO2')
        rnp = functions.GEN_VAL(untrimmedline.regionalNodesPositive)
        
        functions.GEN_STRCPY(hist4c, untrimmedline.histologyIcdO2)
        hist4 = functions.GEN_VAL(hist4c)
        
        
        if (!(functions.GEN_MATCH(untrimmedline.regionalNodesPositive, "(\\d\\d)")))
            return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Positive must be numeric (00-90, 95-99)')
        kaposi = functions.GEN_INLIST(hist4c, "9140")
        hematop = functions.GEN_INLIST(hist4c, "9720,9722,9723,9731,9732,9760-9768,9800-9941,9950-9989")
        lympho = functions.GEN_INLIST(hist4c, "9590-9595,9650-9698,9702-9717")
        mycosis = functions.GEN_INLIST(hist4c, "9700,9701")
        brain = functions.GEN_MATCH(untrimmedline.primarySite, "(C700)|(C71[0-9])")
        othcns = functions.GEN_MATCH(untrimmedline.primarySite, "(C701)|(C709)|(C72[0-5])|(C72[8-9])")
        othill = functions.GEN_MATCH(untrimmedline.primarySite, "(C76[0-5])|(C765)|(C76[7-8])|(C809)|(C42[0-9])|(C77[0-9])")
        
        if (!(kaposi || hematop || lympho || mycosis || brain || othcns || othill)) {
            if (rnp >= 1 && rnp <= 97) {
                if (!(functions.GEN_MATCH(untrimmedline.eodLymphNodeInvolv, "([1-8])")))
                    return functions.GEN_ERROR_MSG(binding, 'If Regional Nodes Positive = 01-97, EOD--Lymph Node Involv must = 1-8')
            }
        }
        return true

    }

    // ID: NAACCR-00699; TAG: N0462; NAME: EOD--Lymph Node Involv, Reg Nodes Pos,ICDO3 (NAACCR)
    public boolean naaccr00699(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int hist4, rnp, year
        boolean kaposi, hematop, lympho, mycosis, brain, othcns, othill
        char[] hist4c = new char[5]
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.eodLymphNodeInvolv) || functions.GEN_EMPTY(untrimmedline.regionalNodesPositive) || functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if ((dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY)) || (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR)))
            return true
        if ((dx_year < 1998) || (dx_year > 2003)) {
            return true
        }
        if (!functions.GEN_MATCH(untrimmedline.primarySite, "(C\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Primary Site not valid')
        if (!functions.GEN_MATCH(untrimmedline.histologicTypeIcdO3, "(\\d\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Histologic Type not valid - ICDO3')
        rnp = functions.GEN_VAL(untrimmedline.regionalNodesPositive)
        
        functions.GEN_STRCPY(hist4c, untrimmedline.histologicTypeIcdO3)
        hist4 = functions.GEN_VAL(hist4c)
        
        
        if (!(functions.GEN_MATCH(untrimmedline.regionalNodesPositive, "(\\d\\d)")))
            return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Positive must be numeric (00-90, 95-99)')
        kaposi = functions.GEN_INLIST(hist4c, "9140")
        hematop = functions.GEN_INLIST(hist4c, "9731-9734, 9740-9758, 9760-9989")
        lympho = functions.GEN_INLIST(hist4c, "9590-9699,9702-9729")
        mycosis = functions.GEN_INLIST(hist4c, "9700,9701")
        brain = functions.GEN_MATCH(untrimmedline.primarySite, "(C700)|(C71[0-9])")
        othcns = functions.GEN_MATCH(untrimmedline.primarySite, "(C701)|(C709)|(C72[0-5])|(C72[8-9])")
        othill = functions.GEN_MATCH(untrimmedline.primarySite, "(C76[0-5])|(C765)|(C76[7-8])|(C809)|(C42[0-9])|(C77[0-9])")
        
        if (!(kaposi || hematop || lympho || mycosis || brain || othcns || othill)) {
            if (rnp >= 1 && rnp <= 97) {
                if (!(functions.GEN_MATCH(untrimmedline.eodLymphNodeInvolv, "([1-8])")))
                    return functions.GEN_ERROR_MSG(binding, 'If Regional Nodes Positive = 01-97, EOD--Lymph Node Involv must = 1-8')
            }
        }
        return true

    }

    // ID: NAACCR-00700; TAG: N0616; NAME: EOD--Old 13 digit (SEER)
    public boolean naaccr00700(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.eodOld13Digit))
            return true
        if (!functions.GEN_MATCH(untrimmedline.eodOld13Digit, "(((\\d)|(\\s)|(&)|(\\-))*)"))
            return false
        
        return true

    }

    // ID: NAACCR-00701; TAG: N0317; NAME: EOD--Old 13 digit, Primary Site (SEER IF2613DG)
    public boolean naaccr00701(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int j, k, l, m, skip2, cc, t
        char[] c1 = new char[2], idxi = new char[5], cl212 = new char[3]
        char[] idxa = new char[4], fillerb = new char[100], idxb1 = new char[100], idxb2 = new char[100], idxb3 = new char[100], idxb4 = new char[100], field13i = new char[100]
        
        if (functions.GEN_STRCMP(untrimmedline.codingSystemForEod, "2") != 0) {
            return true
        }
        if (functions.GEN_MATCH(untrimmedline.primarySite, "(C44[0-7])|(C51[0-2])|(C51[8-9])|(C60[0-1])|(C60[8-9])") && !(functions.GEN_INLIST(untrimmedline.histologyIcdO2, "8720-8799", "(\\d\\d\\d\\d)"))) {
            return functions.GEN_ERROR_MSG(binding, 'EOD_2dig & Site conflict')
        }
        if (functions.GEN_MATCH(untrimmedline.primarySite, "(C77[0-5])|(C77[8-9])|(C024)|(C09[8-9])|(C142)|(C379)|(C422)") && !(functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9590-9698,9702-9717", "(\\d\\d\\d\\d)")))
            return functions.GEN_ERROR_MSG(binding, 'EOD_2dig & Site conflict')
        if (!(functions.GEN_LOOKUP(untrimmedline.primarySite, context.NAACCR_IF2613A1, context.NAACCR_IF2613A1_AFIELD1, ['IDXA':idxa]))) {
            return functions.GEN_ERROR_MSG(binding, 'EOD_2dig & Site conflict')
        }
        cc = 8191
        skip2 = 0
        l = 1
        t = 1
        functions.GEN_STRCPY(cl212, functions.GEN_LEFT(untrimmedline.eodOld13Digit, 2), 2)
        
        
        functions.GEN_STRCPY(idxi, functions.GEN_RIGHT(idxa, 2), 2)
        functions.GEN_STRCAT(idxi, functions.GEN_SUBSTR("01020304050607080910111213", l, 2), 2)
        
        functions.GEN_LOOKUP(idxi, context.NAACCR_IF2613X, context.NAACCR_IF2613X_BFIELD1, ['FILLERB':fillerb, 'IDXB1':idxb1, 'IDXB2':idxb2, 'IDXB3':idxb3, 'IDXB4':idxb4])
        if (functions.GEN_INLIST(fillerb, "C")) {
            if ((functions.GEN_MATCH(cl212, "(\\d\\d)") && functions.GEN_VAL(cl212) < 99) || functions.GEN_STRCMP(idxb1, cl212, 2) == 0 || functions.GEN_STRCMP(idxb2, cl212, 2) == 0 || functions.GEN_STRCMP(idxb3, cl212, 2) == 0 || functions.GEN_STRCMP(idxb4, cl212, 2) == 0) {
                cc = cc - 1
                cc = cc - 2
                t = t * 2
                t = t * 2
                skip2 = 1
            }
            else
                skip2 = 1
        }
        if (skip2 == 0)
            l = 1
        else
            l = 3
        while (l < 9) {
            functions.GEN_STRCPY(c1, functions.GEN_SUBSTR(untrimmedline.eodOld13Digit, l, 1), 1)
            if (functions.GEN_MATCH(c1, "(\\d)"))
                k = functions.GEN_VAL(c1) + 1
            else {
                if (functions.GEN_STRCMP(c1, "-", 1) == 0)
                    k = 11
                else
                    k = 12
            }
            functions.GEN_STRCPY(idxi, functions.GEN_RIGHT(idxa, 2), 2)
            m = ((l - 1) * 2) + 1
            idxi[2] = (char)0
            functions.GEN_STRCAT(idxi, functions.GEN_SUBSTR("01020304050607080910111213", m, 2), 2)
            idxi[4] = (char)0
            functions.GEN_LOOKUP(idxi, context.NAACCR_IF2613ST, context.NAACCR_IF2613ST_FIELD13, ['FIELD13I':field13i])
            m = functions.GEN_VAL(c1)
            m = functions.GEN_VAL(functions.GEN_SUBSTR(field13i, k, 1))
            if (functions.GEN_STRCMP(c1, functions.GEN_SUBSTR(field13i, k, 1), 1) == 0) {
                cc = cc - t
                t = t * 2
            }
            l = l + 1
        }
        skip2 = 0
        l = 9
        
        functions.GEN_STRCPY(cl212, functions.GEN_SUBSTR(untrimmedline.eodOld13Digit, 9, 2), 2)
        
        
        functions.GEN_STRCPY(idxi, functions.GEN_RIGHT(idxa, 2), 2)
        idxi[2] = (char)0
        functions.GEN_STRCAT(idxi, functions.GEN_SUBSTR("01020304050607080910111213", 17, 2), 2)
        idxi[4] = (char)0
        
        functions.GEN_LOOKUP(idxi, context.NAACCR_IF2613X, context.NAACCR_IF2613X_BFIELD1, ['FILLERB':fillerb, 'IDXB1':idxb1, 'IDXB2':idxb2, 'IDXB3':idxb3, 'IDXB4':idxb4])
        if (functions.GEN_INLIST(fillerb, "C")) {
            if ((functions.GEN_MATCH(cl212, "(\\d\\d)") && functions.GEN_VAL(cl212) < 99) || functions.GEN_STRCMP(idxb1, cl212, 2) == 0 || functions.GEN_STRCMP(idxb2, cl212, 2) == 0 || functions.GEN_STRCMP(idxb3, cl212, 2) == 0 || functions.GEN_STRCMP(idxb4, cl212, 2) == 0) {
                cc = cc - t
                t = t * 2
                cc = cc - t
                t = t * 2
                skip2 = 1
            }
            else
                skip2 = 1
        }
        if (skip2 == 0)
            l = 9
        else
            l = 11
        while (l < 14) {
            functions.GEN_STRCPY(c1, functions.GEN_SUBSTR(untrimmedline.eodOld13Digit, l, 1), 1)
            if (functions.GEN_MATCH(c1, "(\\d)"))
                k = functions.GEN_VAL(c1) + 1
            else {
                if (functions.GEN_STRCMP(c1, "-", 1) == 0)
                    k = 11
                else
                    k = 12
            }
            functions.GEN_STRCPY(idxi, functions.GEN_RIGHT(idxa, 2), 2)
            m = ((l - 1) * 2) + 1
            idxi[2] = (char)0
            functions.GEN_STRCAT(idxi, functions.GEN_SUBSTR("01020304050607080910111213", m, 2), 2)
            idxi[4] = (char)0
            functions.GEN_LOOKUP(idxi, context.NAACCR_IF2613ST, context.NAACCR_IF2613ST_FIELD13, ['FIELD13I':field13i])
            m = functions.GEN_VAL(c1)
            m = functions.GEN_VAL(functions.GEN_SUBSTR(field13i, k, 1))
            if (functions.GEN_STRCMP(c1, functions.GEN_SUBSTR(field13i, k, 1), 1) == 0) {
                cc = cc - t
                t = t * 2
            }
            l = l + 1
        }
        if (cc > 0) {
            return false
        }
        if (!(functions.GEN_MATCH(untrimmedline.primarySite, "(C77[0-5])|(C77[8-9])|(C024)|(C09[8-9])|(C142)|(C379)|(C422)")) && !(functions.GEN_MATCH(untrimmedline.primarySite, "(C34[0-3])|(C34[8-9])")) && !(functions.GEN_MATCH(untrimmedline.primarySite, "(C44[0-7])|(C51[0-2])|(C51[8-9])|(C60[0-1])|(C60[8-9])") && functions.GEN_INLIST(untrimmedline.histologyIcdO2, "8720-8799", "(\\d\\d\\d\\d)"))) {
            if (functions.GEN_STRCMP(untrimmedline.behaviorIcdO2, "2", 1) == 0) {
                if (!(functions.GEN_STRCMP(functions.GEN_SUBSTR(untrimmedline.eodOld13Digit, 5, 1), "0", 1) == 0))
                    return functions.GEN_ERROR_MSG(binding, 'InSitu Behavior & EOD13dig conflict')
            }
            else {
                if ((functions.GEN_STRCMP(functions.GEN_SUBSTR(untrimmedline.eodOld13Digit, 5, 1), "0", 1) == 0))
                    return functions.GEN_ERROR_MSG(binding, 'InSitu Behavior & EOD13dig conflict')
            }
        }
        if (functions.GEN_MATCH(untrimmedline.primarySite, "(C34[0-3])|(C34[8-9])")) {
            if (functions.GEN_STRCMP(untrimmedline.behaviorIcdO2, "2", 1) == 0) {
                if (!(functions.GEN_INLIST(functions.GEN_SUBSTR(untrimmedline.eodOld13Digit, 4, 2), "01,10")))
                    return functions.GEN_ERROR_MSG(binding, 'InSitu Behavior & EOD13dig conflict')
            }
            else {
                if ((functions.GEN_MATCH(functions.GEN_SUBSTR(untrimmedline.eodOld13Digit, 4, 2), "(00)")))
                    return functions.GEN_ERROR_MSG(binding, 'InSitu Behavior & EOD13dig conflict')
            }
        }
        if (functions.GEN_MATCH(untrimmedline.primarySite, "(C44[0-7])|(C51[0-2])|(C51[8-9])|(C60[0-1])|(C60[8-9])")) {
            if (functions.GEN_STRCMP(untrimmedline.behaviorIcdO2, "2", 1) == 0) {
                if (!(functions.GEN_INLIST(functions.GEN_SUBSTR(untrimmedline.eodOld13Digit, 5, 1), "1")))
                    return functions.GEN_ERROR_MSG(binding, 'InSitu Behavior & EOD13dig conflict')
            }
            else {
                if ((functions.GEN_INLIST(functions.GEN_SUBSTR(untrimmedline.eodOld13Digit, 5, 1), "1")))
                    return functions.GEN_ERROR_MSG(binding, 'InSitu Behavior & EOD13dig conflict')
            }
        }
        return true

    }

    // ID: NAACCR-00702; TAG: N0318; NAME: EOD--Old 13 digit, Primary Site, Hist (SEER IF01)
    public boolean naaccr00702(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, dx_month
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        dx_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (functions.GEN_INLIST(untrimmedline.registryId, "0000001544", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return true
        }
        if ((dx_year < 1975) || (dx_year > 1982) || (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7")))
            return true
        if (dx_year == 1975) {
            if ((functions.GEN_INLIST(untrimmedline.registryId, "01", "(00000015\\d\\d)", 9, 2) && functions.GEN_INLIST(untrimmedline.countyAtDx, "075,081")) || !functions.GEN_INLIST(untrimmedline.registryId, "01", "(00000015\\d\\d)", 9, 2)) {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "500-509,180,182-187,199,209", "(C\\d\\d\\d)", 2, 3)) {
                    if (functions.GEN_VAL(untrimmedline.codingSystemForEod) == 2)
                        return true
                    else
                        return false
                }
            }
        }
        if ((dx_year > 1975) && (dx_year < 1983)) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "500-509,180,182-187,199,209", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_VAL(untrimmedline.codingSystemForEod) == 2)
                    return true
                else
                    return false
            }
        }
        if (((dx_year >= 1978) || ((dx_year == 1977) && (dx_month >= 5) && (dx_month != ((Integer)context.NAACCR_GEN_DT_MONTH_EMPTY)))) && ((functions.GEN_INLIST(untrimmedline.primarySite, "770-779,024,099,111,142,379,422", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9590-9698")) || (functions.GEN_INLIST(untrimmedline.primarySite, "440-447,510-519,600-601,608-609", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologyIcdO2, "8720-8790")))) {
            if (functions.GEN_VAL(untrimmedline.codingSystemForEod) == 2)
                return true
            else
                return false
        }
        if (((dx_year >= 1978) || ((dx_year == 1977) && (dx_month >= 11) && (dx_month != ((Integer)context.NAACCR_GEN_DT_MONTH_EMPTY)))) && functions.GEN_INLIST(untrimmedline.primarySite, "161-169,341-349,530-539,540-548,619,670-676,678-679", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_VAL(untrimmedline.codingSystemForEod) == 2)
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00703; TAG: N0617; NAME: EOD--Old 2 digit (SEER)
    public boolean naaccr00703(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.eodOld2Digit))
            return true
        if (!functions.GEN_MATCH(untrimmedline.eodOld2Digit, "(((\\d)|(\\s)|(&)|(\\-))*)"))
            return false
        
        return true

    }

    // ID: NAACCR-00704; TAG: N0319; NAME: EOD--Old 2 digit, Morphology (SEER IF26NSPC)
    public boolean naaccr00704(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_STRCMP(untrimmedline.codingSystemForEod, "0") != 0) {
            return true
        }
        if (!functions.GEN_MATCH(untrimmedline.eodOld2Digit, "(((0)|([4-9])|(&)|(\\-))\\-)")) {
            return functions.GEN_ERROR_MSG(binding, 'EOD_2dig & Site conflict')
        }
        if (functions.GEN_STRCMP(untrimmedline.behaviorIcdO2, "2") == 0 && functions.GEN_STRCMP(untrimmedline.eodOld2Digit, "0-") != 0)
            return false /* Error flag 362 */
        if (functions.GEN_STRCMP(untrimmedline.behaviorIcdO2, "3") == 0 && functions.GEN_STRCMP(untrimmedline.eodOld2Digit, "0-") == 0)
            return false /* Error flag 362 */
        return true

    }

    // ID: NAACCR-00707; TAG: N0431; NAME: EOD--Reg Nodes Ex,ReNodes Pos, Site, ICDO2 (NAACCR)
    public boolean naaccr00707(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int beh, lymflg, rnp, rne, year
        boolean kaposi, hematop, lympho, brain, othcns, othill
        char[] hist4c = new char[5]
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
            return true
        if (functions.GEN_EMPTY(untrimmedline.regionalNodesPositive) || functions.GEN_EMPTY(untrimmedline.regionalNodesExamined))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year < 1998) || (dx_year > 2000))
            return true
        if (!functions.GEN_INLIST(untrimmedline.behaviorIcdO2, "2,3"))
            return true
        if (!(functions.GEN_MATCH(untrimmedline.regionalNodesPositive, "(\\d\\d)")))
            return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Positive must be numeric (00-90, 95-99)')
        if (!(functions.GEN_MATCH(untrimmedline.regionalNodesExamined, "(\\d\\d)")))
            return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Examined must be a two-digit number')
        if (!functions.GEN_MATCH(untrimmedline.primarySite, "(C\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Primary Site not valid')
        if (!functions.GEN_MATCH(untrimmedline.histologyIcdO2, "(\\d\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Histologic Type not valid - ICDO2')
        rnp = functions.GEN_VAL(untrimmedline.regionalNodesPositive)
        rne = functions.GEN_VAL(untrimmedline.regionalNodesExamined)
        beh = functions.GEN_VAL(untrimmedline.behaviorIcdO2)
        
        if (functions.GEN_VAL(untrimmedline.typeOfReportingSource) == 7) {
            if ((rne != 99) || (rnp != 99))
                return functions.GEN_ERROR_MSG(binding, 'Death Certificate Only, Regional Nodes Positive and Examined must both = 99')
            else
                return true
        }
        functions.GEN_STRCPY(hist4c, untrimmedline.histologyIcdO2)
        kaposi = functions.GEN_INLIST(hist4c, "9140")
        hematop = functions.GEN_INLIST(hist4c, "9720-9989")
        lympho = functions.GEN_INLIST(hist4c, "9590-9698,9702-9717")
        brain = functions.GEN_MATCH(untrimmedline.primarySite, "(C700)|(C71[0-9])")
        othcns = functions.GEN_MATCH(untrimmedline.primarySite, "(C701)|(C709)|(C72[0-5])|(C72[8-9])")
        othill = functions.GEN_MATCH(untrimmedline.primarySite, "(C76[0-5])|(C765)|(C76[7-8])|(C809)|(C42[0-9])|(C77[0-9])")
        
        if ((brain || othcns || othill || hematop || lympho) && (!kaposi)) {
            if ((rnp != 99) || (rne != 99))
                return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Positive and Examined must both = 99 for this site/histology')
        }
        if (beh == 2) {
            if (rnp != 0 && rnp != 98)
                return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Positive must = 00 or 98 for in situ cases')
        }
        if (beh == 2) {
            if (rne > 98)
                return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Examined cannot be greater than 98 for in situ cases')
        }
        if (rne == 0 && rnp != 98)
            return false
        else {
            if (rne >= 1 && rne <= 89) {
                if (rnp == 97 || rnp == 99 || rnp <= rne)
                    return true
                else
                    return false
            }
            else {
                if (rne == 96 || rne == 97 || rne == 98) {
                    if ((rnp >= 0 && rnp <= 97) || (rnp == 99))
                        return true
                    else
                        return false
                }
                else {
                    if (rne == 90) {
                        if (rnp == 97 || rnp == 99 || rnp <= 96)
                            return true
                        else
                            return false
                    }
                    else {
                        if (rne == 99) {
                            if (rnp == 99)
                                return true
                            else
                                return false
                        }
                        else {
                            if (rne == 95) {
                                if (rnp == 0 || rnp == 95 || rnp == 99)
                                    return true
                                else
                                    return false
                            }
                        }
                    }
                }
            }
        }
        return true

    }

    // ID: NAACCR-00708; TAG: N0461; NAME: EOD--Reg Nodes Ex,ReNodes Pos, Site, ICDO3 (NAACCR)
    public boolean naaccr00708(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int beh, lymflg, rnp, rne, year
        boolean kaposi, hematop, lympho, brain, othcns, othill
        char[] hist4c = new char[5]
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_EMPTY(untrimmedline.regionalNodesPositive) || functions.GEN_EMPTY(untrimmedline.regionalNodesExamined))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 1998 || dx_year > 2003)
            return true
        if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1,2,3"))
            return true
        if (!(functions.GEN_MATCH(untrimmedline.regionalNodesPositive, "(\\d\\d)")))
            return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Positive must be numeric (00-90, 95-99)')
        if (!(functions.GEN_MATCH(untrimmedline.regionalNodesExamined, "(\\d\\d)")))
            return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Examined must be a two-digit number')
        if (!functions.GEN_MATCH(untrimmedline.primarySite, "(C\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Primary Site not valid')
        if (!functions.GEN_MATCH(untrimmedline.histologicTypeIcdO3, "(\\d\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Histologic Type not valid - ICDO3')
        rnp = functions.GEN_VAL(untrimmedline.regionalNodesPositive)
        rne = functions.GEN_VAL(untrimmedline.regionalNodesExamined)
        beh = functions.GEN_VAL(untrimmedline.behaviorCodeIcdO3)
        
        if (functions.GEN_VAL(untrimmedline.typeOfReportingSource) == 7) {
            if ((rne != 99) || (rnp != 99))
                return functions.GEN_ERROR_MSG(binding, 'Death Certificate Only, Regional Nodes Positive and Examined must both = 99')
            else
                return true
        }
        functions.GEN_STRCPY(hist4c, untrimmedline.histologicTypeIcdO3)
        kaposi = functions.GEN_INLIST(hist4c, "9140")
        hematop = functions.GEN_INLIST(hist4c, "9731-9989")
        lympho = functions.GEN_INLIST(hist4c, "9590-9699,9702-9729")
        brain = functions.GEN_MATCH(untrimmedline.primarySite, "(C700)|(C71[0-9])")
        othcns = functions.GEN_MATCH(untrimmedline.primarySite, "(C701)|(C709)|(C72[0-5])|(C72[8-9])")
        othill = functions.GEN_MATCH(untrimmedline.primarySite, "(C76[0-5])|(C765)|(C76[7-8])|(C809)|(C42[0-9])|(C77[0-9])")
        
        if ((brain || othcns || othill || hematop || lympho) && (!kaposi)) {
            if ((rnp != 99) || (rne != 99))
                return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Positive and Examined must both = 99 for this site/histology')
        }
        if (beh == 2) {
            if (rnp != 0 && rnp != 98)
                return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Positive must = 00 or 98 for in situ cases')
        }
        if (beh == 2) {
            if (rne > 98)
                return functions.GEN_ERROR_MSG(binding, 'Regional Nodes Examined cannot be greater than 98 for in situ cases')
        }
        if (rne == 0 && rnp != 98)
            return false
        else {
            if (rne >= 1 && rne <= 89) {
                if (rnp == 97 || rnp == 99 || rnp <= rne)
                    return true
                else
                    return false
            }
            else {
                if (rne == 96 || rne == 97 || rne == 98) {
                    if ((rnp >= 0 && rnp <= 97) || (rnp == 99))
                        return true
                    else
                        return false
                }
                else {
                    if (rne == 90) {
                        if (rnp == 97 || rnp == 99 || rnp <= 96)
                            return true
                        else
                            return false
                    }
                    else {
                        if (rne == 99) {
                            if (rnp == 99)
                                return true
                            else
                                return false
                        }
                    }
                }
            }
        }
        return true

    }

    // ID: NAACCR-00709; TAG: N0370; NAME: EOD--Tumor Size (COC)
    public boolean naaccr00709(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.eodTumorSize))
            return true
        return functions.GEN_MATCH(untrimmedline.eodTumorSize, "(\\d\\d\\d)")

    }

    // ID: NAACCR-00710; TAG: N0709; NAME: EOD--Tumor Size, Date of Diagnosis (COC)
    public boolean naaccr00710(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2004) {
            if (functions.GEN_EMPTY(untrimmedline.eodTumorSize))
                return false
        }
        return true

    }

    // ID: NAACCR-00712; TAG: N2364; NAME: EOD--Tumor Size, Primary Site, ICDO3 (NAACCR)
    public boolean naaccr00712(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.eodTumorSize) || functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if ((dx_year < 1998) || (dx_year > 2003))
            return true
        if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1,2,3"))
            return true
        if (!functions.GEN_MATCH(untrimmedline.primarySite, "(C\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Primary Site not valid')
        if (!functions.GEN_MATCH(untrimmedline.histologicTypeIcdO3, "(\\d\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'Histologic Type not valid - ICDO3')
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7")) {
            if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "999"))
                return functions.GEN_ERROR_MSG(binding, 'Death Certificate Only, EOD--Tumor Size must = 999')
            else
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140,9590-9699,9702-9729")) {
            if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "001-002,999", "(\\d\\d\\d)"))
                return functions.GEN_ERROR_MSG(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
            else
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731-9734,9760-9989")) {
            if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "999"))
                return functions.GEN_ERROR_MSG(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
            else
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9701")) {
            if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "000-003,999", "(\\d\\d\\d)"))
                return functions.GEN_ERROR_MSG(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
            else
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "500-506,508-509", "(C\\d\\d\\d)", 2, 3)) {
            if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "000-990,997-999", "(\\d\\d\\d)"))
                return functions.GEN_ERROR_MSG(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
            else
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "150-155,158-159,160-166,168-169,340-343,348-349", "(C\\d\\d\\d)", 2, 3)) {
            if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "000-990,998-999", "(\\d\\d\\d)"))
                return functions.GEN_ERROR_MSG(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
            else
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8220-8221")) {
            if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "000-990,998-999", "(\\d\\d\\d)"))
                return functions.GEN_ERROR_MSG(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
            else
                return true
        }
        if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "000-990,999", "(\\d\\d\\d)"))
            return functions.GEN_ERROR_MSG(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
        else
            return true
        return true

    }

    // ID: NAACCR-00716; TAG: N0488; NAME: Edit Over-rides (NAACCR)
    public boolean naaccr00716(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_MATCH(untrimmedline.overRideSiteType, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideHistology, "([1-3])|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideAgeSiteMorph, "([1-3])|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSeqnoDxconf, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteLatSeqno, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSurgDxconf, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideReportSource, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideIllDefineSite, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideLeukLymphoma, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteBehavior, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteEodDxDt, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteLatEod, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteLatMorph, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSsNodespos, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSsTnmN, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSsTnmM, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideAcsnClassSeq, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideHospseqDxconf, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideCocSiteType, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideHospseqSite, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteTnmStggrp, "(1)|(\\s)"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00717; TAG: N0027; NAME: Edit Over-rides (SEER REVIEWFL)
    public boolean naaccr00717(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_MATCH(untrimmedline.overRideSiteType, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideHistology, "([1-3])|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideAgeSiteMorph, "([1-3])|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSeqnoDxconf, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteLatSeqno, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSurgDxconf, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideReportSource, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideIllDefineSite, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideLeukLymphoma, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteBehavior, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteEodDxDt, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteLatEod, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteLatMorph, "(1)|(\\s)"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00718; TAG: N0120; NAME: EthnSrc, Date of Diag (SEER IF72)
    public boolean naaccr00718(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 1993) {
            if (functions.GEN_EMPTY(untrimmedline.computedEthnicitySource))
                return false
            else
                return true
        }
        
        return true

    }

    // ID: NAACCR-00720; TAG: N2365; NAME: Extent of Disease 12-Digit ICDO3 (SEER IF26E98)
    public boolean naaccr00720(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int hist4, i, j, n, beh, n_site_idx, extflg, lymflg, nodflg, rnp, rne, tsz, dx_year, pextflg
        int site, pext, mycosis
        boolean kaposi, hematop, lympho, brain, othcns, othill
        char[] c_site_idx = new char[4], hist4c = new char[5], idxxx1 = new char[3]
        
        int LNflg
        
        char[] W_SiteExt = new char[7], W_HistExt = new char[7]
        
        char[] W_SiteLN = new char[7]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_STRCMP(untrimmedline.codingSystemForEod, "4") != 0 || (dx_year < 1998) || dx_year > 2003)
            return true
        if (functions.GEN_EMPTY(untrimmedline.morphTypebehavIcdO3))
            return true
        if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1,2,3")) {
            return true
        }
        if (!(functions.GEN_MATCH(untrimmedline.primarySite, "(C\\d\\d\\d)")) || !(functions.GEN_MATCH(untrimmedline.morphTypebehavIcdO3, "(\\d\\d\\d\\d1)|(\\d\\d\\d\\d2)|(\\d\\d\\d\\d3)")))
            return functions.GEN_ERROR_MSG(binding, 'Catastropic Error in IF2610DG - ICDO3')
        rnp = functions.GEN_VAL(untrimmedline.regionalNodesPositive)
        rne = functions.GEN_VAL(untrimmedline.regionalNodesExamined)
        tsz = functions.GEN_VAL(untrimmedline.eodTumorSize)
        pext = functions.GEN_VAL(untrimmedline.eodExtensionProstPath)
        
        if (functions.GEN_VAL(untrimmedline.typeOfReportingSource) == 7) {
            if (!(functions.GEN_MATCH(untrimmedline.primarySite, "(C619)"))) {
                if ((tsz != 999) || (functions.GEN_VAL(untrimmedline.eodExtension) != 99) || (functions.GEN_VAL(untrimmedline.eodLymphNodeInvolv) != 9) || (rne != 99) || (rnp != 99) || (!functions.GEN_EMPTY(untrimmedline.eodExtensionProstPath)))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Type of Reporting Source and EOD 12 digit conflict')
                return true
            }
            else {
                if ((tsz != 999) || (functions.GEN_VAL(untrimmedline.eodExtension) != 90) || (functions.GEN_VAL(untrimmedline.eodLymphNodeInvolv) != 9) || (rne != 99) || (rnp != 99) || (pext != 90))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Type of Reporting Source and EOD 12 digit conflict')
                return true
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140,9590-9699,9702-9729")) {
            if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "001-002,999", "(\\d\\d\\d)"))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731-9734,9760-9989")) {
                if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "999"))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9701")) {
                    if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "000-003,999", "(\\d\\d\\d)"))
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.primarySite, "500-506,508-509", "(C\\d\\d\\d)", 2, 3)) {
                        if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "000-990,997-999", "(\\d\\d\\d)"))
                            functions.GEN_SAVE_ERROR_TEXT(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
                    }
                    else {
                        if (functions.GEN_INLIST(untrimmedline.primarySite, "150-155,158-159,160-166,168-169,340-343,348-349", "(C\\d\\d\\d)", 2, 3)) {
                            if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "000-990,998-999", "(\\d\\d\\d)"))
                                functions.GEN_SAVE_ERROR_TEXT(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
                        }
                        else {
                            if (functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8220-8221")) {
                                if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "000-990,998-999", "(\\d\\d\\d)"))
                                    return functions.GEN_ERROR_MSG(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
                            }
                            else {
                                if (!functions.GEN_INLIST(untrimmedline.eodTumorSize, "000-990,999", "(\\d\\d\\d)")) {
                                    functions.GEN_SAVE_ERROR_TEXT(binding, 'EOD--Tumor Size invalid for this site/histology/behavior')
                                }
                            }
                        }
                    }
                }
            }
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140,9590-9699,9702-9729,9731-9989")) {
                if (!functions.GEN_EMPTY(untrimmedline.eodExtension))
                    extflg = 1
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632,690, 691-694,698-699", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                    if (!functions.GEN_INLIST(untrimmedline.eodExtension, "00"))
                        extflg = 1
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9701")) {
                        if (!functions.GEN_EMPTY(untrimmedline.eodExtension))
                            extflg = 1
                    }
                    else {
                        functions.GEN_STRCPY(W_SiteExt, untrimmedline.primarySite)
                        functions.GEN_STRCAT(W_SiteExt, untrimmedline.eodExtension)
                        if (!functions.GEN_ILOOKUP(W_SiteExt, context.NAACCR_EXT03INS, context.NAACCR_EXT03INS_SITEEXT, [:]))
                            extflg = 1
                    }
                }
            }
            if (extflg == 1)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'In Situ EOD--Extension invalid for this site/histology/behavior')
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1,3")) {
        
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140")) {
                if (!functions.GEN_INLIST(untrimmedline.eodExtension, "11,12,13,21,22,23,24,25,26,27,29,99"))
                    extflg = 1
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9699,9702-9729")) {
                    if (functions.GEN_INLIST(untrimmedline.primarySite, "778", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.eodExtension, "10,11"))
                        extflg = 1
                    else {
                        if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,11,20,21,30,31,32,33,80,99"))
                            extflg = 1
                    }
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731-9992")) {
                        if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,80,99"))
                            extflg = 1
                        else {
                            if (functions.GEN_INLIST(untrimmedline.eodExtension, "10") && !functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731,9734,9740,9750-9752,9755-9758,9764,9930"))
                                extflg = 1
                            else {
                                if (functions.GEN_INLIST(untrimmedline.eodExtension, "80") && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9751,9752"))
                                    extflg = 1
                                else {
                                    if (functions.GEN_INLIST(untrimmedline.eodExtension, "99") && !functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731,9734,9740,9750-9758,9764,9930"))
                                        extflg = 1
                                }
                            }
                        }
                    }
                    else {
                        if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                            if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,11,20,21,30,31,40,41,50,51,60,62,64,70,80,85,87,99"))
                                extflg = 1
                        }
                        else {
                            if (functions.GEN_INLIST(untrimmedline.primarySite, "690", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                                if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,12,15,20,30,70,80,85,99"))
                                    extflg = 1
                            }
                            else {
                                if (functions.GEN_INLIST(untrimmedline.primarySite, "691-694,698,699", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                                    if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,12,15,17,20,25,30,40,43,44,45,50,55,56,70,80,85,99"))
                                        extflg = 1
                                }
                                else {
                                    if (functions.GEN_INLIST(untrimmedline.primarySite, "692", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9510-9514")) {
                                        if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,12,15,30,40,45,48,50,55,60,70,72,75,80,85,99"))
                                            extflg = 1
                                    }
                                    else {
                                        if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9701")) {
                                            if (!functions.GEN_INLIST(untrimmedline.eodExtension, "10,20,25,30,50,70,85,99"))
                                                extflg = 1
                                        }
                                        else {
                                            functions.GEN_STRCPY(W_SiteExt, untrimmedline.primarySite)
                                            functions.GEN_STRCAT(W_SiteExt, untrimmedline.eodExtension)
                                            if (!functions.GEN_ILOOKUP(W_SiteExt, context.NAACCR_EXT3SITM, context.NAACCR_EXT3SITM_SITEEXT, [:]))
                                                extflg = 1
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if (extflg == 1) {
            functions.GEN_SAVE_ERROR_TEXT(binding, 'Malignant EOD--Extension invalid for this site/histology/behavior')
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140,9590-9699,9702-9729,9731-9989")) {
                if (!functions.GEN_EMPTY(untrimmedline.eodLymphNodeInvolv))
                    LNflg = 1
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632,690,691-694,698-699", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                    if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0"))
                        LNflg = 1
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9701")) {
                        if (!functions.GEN_EMPTY(untrimmedline.eodLymphNodeInvolv))
                            LNflg = 1
                    }
                    else {
                        functions.GEN_STRCPY(W_SiteLN, untrimmedline.primarySite)
                        functions.GEN_STRCAT(W_SiteLN, untrimmedline.eodLymphNodeInvolv)
                        if (!functions.GEN_ILOOKUP(W_SiteLN, context.NAACCR_LN03INS, context.NAACCR_LN03INS_SITE_LN, [:]))
                            LNflg = 1
                    }
                }
            }
            if (LNflg == 1)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'In Situ EOD--Lymph Node Involvement invalid for this site/histology/behavior')
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1,3")) {
        
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140,9590-9699,9702-9729")) {
                if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0,1,2,3,9"))
                    LNflg = 1
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731-9992")) {
                    if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "9"))
                        LNflg = 1
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                        if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0-5,7-9"))
                            LNflg = 1
                    }
                    else {
                        if (functions.GEN_INLIST(untrimmedline.primarySite, "690", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                            if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0,1,7-9"))
                                LNflg = 1
                        }
                        else {
                            if (functions.GEN_INLIST(untrimmedline.primarySite, "691-694,698,699", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8720-8790")) {
                                if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0,1,7-9"))
                                    LNflg = 1
                            }
                            else {
                                if (functions.GEN_INLIST(untrimmedline.primarySite, "692", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9510-9514")) {
                                    if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0,1,7-9"))
                                        LNflg = 1
                                }
                                else {
                                    if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608,609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9701")) {
                                        if (!functions.GEN_INLIST(untrimmedline.eodLymphNodeInvolv, "0-3,9"))
                                            LNflg = 1
                                    }
                                    else {
                                        functions.GEN_STRCPY(W_SiteLN, untrimmedline.primarySite)
                                        functions.GEN_STRCAT(W_SiteLN, untrimmedline.eodLymphNodeInvolv)
                                        if (!functions.GEN_ILOOKUP(W_SiteLN, context.NAACCR_LN03MAL, context.NAACCR_LN03MAL_SITE_LN, [:]))
                                            LNflg = 1
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if (LNflg == 1) {
            functions.GEN_SAVE_ERROR_TEXT(binding, 'Malignant EOD--Lymph Node Involvement invalid for this site/histology/behavior')
        }
        functions.GEN_STRCPY(hist4c, untrimmedline.histologicTypeIcdO3)
        kaposi = functions.GEN_INLIST(hist4c, "9140")
        hematop = functions.GEN_INLIST(hist4c, "9731-9989")
        lympho = functions.GEN_INLIST(hist4c, "9590-9699,9702-9729")
        brain = functions.GEN_MATCH(untrimmedline.primarySite, "(C700)|(C71[0-9])")
        othcns = functions.GEN_MATCH(untrimmedline.primarySite, "(C701)|(C709)|(C72[0-5])|(C72[8-9])")
        othill = functions.GEN_MATCH(untrimmedline.primarySite, "(C76[0-5])|(C765)|(C76[7-8])|(C809)|(C42[0-9])|(C77[0-9])")
        
        if (!(kaposi || hematop || lympho || mycosis || brain || othcns || othill)) {
            if (rnp >= 1 && rnp <= 97) {
                if (!(functions.GEN_MATCH(untrimmedline.eodLymphNodeInvolv, "([1-8])")))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'If Regional Nodes Positive = 01-97, EOD--Lymph Node Involv must = 1-8')
            }
        }
        if ((brain || othcns || othill || hematop || lympho) && (!kaposi)) {
            if ((rnp != 99) || (rne != 99))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Regional Nodes Positive and Examined must both = 99 for this site/histology')
        }
        else {
            if (beh == 2) {
                if (rnp != 0 && rnp != 98)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Regional Nodes Positive must = 00 or 98 for in situ cases')
            }
        }
        if (beh == 2) {
            if (rne > 98)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Regional Nodes Examined cannot be greater than 98 for in situ cases')
        }
        if (rne == 0 && rnp != 98)
            functions.GEN_SAVE_ERROR_TEXT(binding, 'Regional Nodes Positive/Examined conflict')
        else {
            if (rne >= 1 && rne <= 89) {
                if (rnp == 97 || rnp == 99 || rnp <= rne)
                    functions.GEN_NOOP()
                else
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Regional Nodes Positive/Examined conflict')
            }
            else {
                if (rne == 96 || rne == 97 || rne == 98) {
                    if ((rnp >= 0 && rnp <= 97) || (rnp == 99))
                        functions.GEN_NOOP()
                    else
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'Regional Nodes Positive/Examined conflict')
                }
                else {
                    if (rne == 90) {
                        if (rnp == 97 || rnp == 99 || rnp <= 96)
                            functions.GEN_NOOP()
                        else
                            functions.GEN_SAVE_ERROR_TEXT(binding, 'Regional Nodes Positive/Examined conflict')
                    }
                    else {
                        if (rne == 99) {
                            if (rnp == 99)
                                functions.GEN_NOOP()
                            else
                                functions.GEN_SAVE_ERROR_TEXT(binding, 'Regional Nodes Positive/Examined conflict')
                        }
                    }
                }
            }
        }
        return true

    }

    // ID: NAACCR-00721; TAG: N0325; NAME: Follow-Up Contact--City (SEER)
    public boolean naaccr00721(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpContactCity))
            return true
        return functions.GEN_MATCH(untrimmedline.followUpContactCity, "([A-Za-z]((\\s)|([A-Za-z]))*)")

    }

    // ID: NAACCR-00722; TAG: N0329; NAME: Follow-Up Contact--Name (SEER)
    public boolean naaccr00722(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpContactName))
            return true
        return functions.GEN_MATCH(untrimmedline.followUpContactName, "([A-Za-z]((\\-)|([A-Za-z])|(\\s))*)")

    }

    // ID: NAACCR-00723; TAG: N0328; NAME: Follow-Up Contact--No/St (SEER)
    public boolean naaccr00723(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpContactNost)) {
            return true
        }
        if (!functions.GEN_MATCH(untrimmedline.followUpContactNost, "([^ \\t\\r\\n\\v\\f]((.))*)")) {
            return false
        }
        char[] searchchar = new char[2]
        int len
        int idx
        
        if (functions.GEN_EMPTY(untrimmedline.followUpContactNost))
            return false
        len = (functions.GEN_STRLEN(functions.GEN_TRIM(untrimmedline.followUpContactNost, ((Integer)context.NAACCR_GEN_RIGHT))))
        
        idx = 1
        while (idx < len) {
            functions.GEN_STRCPY(searchchar, functions.GEN_SUBSTR(untrimmedline.followUpContactNost, idx, 1), 1)
            if (!functions.GEN_LOOKUP(searchchar, context.NAACCR_STREET, context.NAACCR_STREET_ONE_CHAR, [:]))
                return false
            idx = idx + 1
        }
        return true

    }

    // ID: NAACCR-00724; TAG: N0327; NAME: Follow-Up Contact--Postal (SEER)
    public boolean naaccr00724(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpContactPostal))
            return true
        return functions.GEN_MATCH(untrimmedline.followUpContactPostal, "([A-Za-z0-9](([A-Za-z0-9]))*((\\s))*)")

    }

    // ID: NAACCR-00725; TAG: N0326; NAME: Follow-Up Contact--State (SEER)
    public boolean naaccr00725(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpContactState))
            return true
        return functions.GEN_LOOKUP(untrimmedline.followUpContactState, context.NAACCR_STATE, context.NAACCR_STATE_CODE, [:])

    }

    // ID: NAACCR-00726; TAG: N0539; NAME: Follow-Up Contact--Suppl (SEER)
    public boolean naaccr00726(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpContactSuppl))
            return true /* must be left justified */
        if (!functions.GEN_MATCH(untrimmedline.followUpContactSuppl, "([^ \\t\\r\\n\\v\\f]((.))*)")) {
            return false
        }
        char[] searchchar = new char[2]
        int len
        int idx
        
        if (functions.GEN_EMPTY(untrimmedline.followUpContactSuppl))
            return false
        len = (functions.GEN_STRLEN(functions.GEN_TRIM(untrimmedline.followUpContactSuppl, ((Integer)context.NAACCR_GEN_RIGHT))))
        
        idx = 1
        while (idx < len) {
            functions.GEN_STRCPY(searchchar, functions.GEN_SUBSTR(untrimmedline.followUpContactSuppl, idx, 1), 1)
            if (!functions.GEN_LOOKUP(searchchar, context.NAACCR_STREET, context.NAACCR_STREET_ONE_CHAR, [:]))
                return false
            idx = idx + 1
        }
        return true

    }

    // ID: NAACCR-00727; TAG: N0213; NAME: Follow-Up Source (COC)
    public boolean naaccr00727(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpSource))
            return true
        return functions.GEN_INLIST(untrimmedline.followUpSource, "0-5,7-9")

    }

    // ID: NAACCR-00728; TAG: N0577; NAME: Follow-Up Source (NAACCR)
    public boolean naaccr00728(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.followUpSource, "0-5,7-9")

    }

    // ID: NAACCR-00729; TAG: N1030; NAME: Follow-Up Source Central, Vital Status (NPCR)
    public boolean naaccr00729(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpSourceCentral) || functions.GEN_EMPTY(untrimmedline.vitalStatus))
            return true
        if (functions.GEN_INLIST(untrimmedline.followUpSourceCentral, "04, 05, 06, 07, 64", "(\\d\\d)")) {
            if (functions.GEN_INLIST(untrimmedline.vitalStatus, "1"))
                return false
        }
        return true

    }

    // ID: NAACCR-00730; TAG: N0543; NAME: Follow-Up Source, Date of Diagnosis (COC)
    public boolean naaccr00730(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2002) {
            if (functions.GEN_EMPTY(untrimmedline.followUpSource))
                return false
        }
        return true

    }

    // ID: NAACCR-00731; TAG: N0372; NAME: Follow-Up Source, Vital Status (COC)
    public boolean naaccr00731(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpSource) || functions.GEN_EMPTY(untrimmedline.vitalStatus))
            return true
        if (functions.GEN_INLIST(untrimmedline.followUpSource, "7")) {
            if (functions.GEN_INLIST(untrimmedline.vitalStatus, "1"))
                return false
        }
        return true

    }

    // ID: NAACCR-00732; TAG: N0750; NAME: Follow-up Source Central (NAACCR)
    public boolean naaccr00732(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpSourceCentral))
            return true
        return functions.GEN_INLIST(untrimmedline.followUpSourceCentral, "00-12,29-35,39-43,48-51,59-65,98,99", "(\\d\\d)")

    }

    // ID: NAACCR-00733; TAG: N0751; NAME: Follow-up Source Central, Date of DX (NPCR)
    public boolean naaccr00733(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2005) {
            if (functions.GEN_EMPTY(untrimmedline.followUpSourceCentral))
                return false
        }
        return true

    }

    // ID: NAACCR-00734; TAG: N0158; NAME: Following Registry (COC)
    public boolean naaccr00734(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followingRegistry))
            return true
        return functions.GEN_MATCH(untrimmedline.followingRegistry, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")

    }

    // ID: NAACCR-00735; TAG: N0212; NAME: Following Registry (NAACCR)
    public boolean naaccr00735(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_MATCH(untrimmedline.followingRegistry, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")

    }

    // ID: NAACCR-00736; TAG: N0578; NAME: Following Registry, Date of Diagnosis (COC)
    public boolean naaccr00736(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2002) {
            if (functions.GEN_EMPTY(untrimmedline.followingRegistry))
                return false
        }
        return true

    }

    // ID: NAACCR-00737; TAG: N1669; NAME: Followup Contact--Country (NAACCR)
    public boolean naaccr00737(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followupContactCountry))
            return true
        if (!functions.GEN_LOOKUP(untrimmedline.followupContactCountry, context.NAACCR_CNTRY_ST, context.NAACCR_CNTRY_ST_COUNTRY, [:]))
            return false
        
        return true

    }

    // ID: NAACCR-00738; TAG: N1687; NAME: Followup Contact--Country, Date of Diag (NAACCR)
    public boolean naaccr00738(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.followupContactCountry))
            return true
        if (dx_year > 2012) {
            if (functions.GEN_INLIST(untrimmedline.followupContactCountry, "XNI,XCB,XEN,XSC,XGR,XSL,XUM"))
                return false
            if (functions.GEN_INLIST(untrimmedline.followupContactCountry, "XNF,XSD,XWF,XSF,XEF,XIF,XET,XAP,XIS"))
                return false
            if (functions.GEN_INLIST(untrimmedline.followupContactCountry, "XCR,XOR,XSE,XMS,XCH,XML,XMC,XPL"))
                return false
        }
        
        return true

    }

    // ID: NAACCR-00739; TAG: N0752; NAME: GIS Coordinate Quality (NAACCR)
    public boolean naaccr00739(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.gisCoordinateQuality))
            return true
        return functions.GEN_INLIST(untrimmedline.gisCoordinateQuality, "00-12,98,99", "(\\d\\d)")

    }

    // ID: NAACCR-00740; TAG: N0621; NAME: Grade (73-91) ICD-O-1 (SEER)
    public boolean naaccr00740(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.gradeIcdO1))
            return true
        return functions.GEN_INLIST(untrimmedline.gradeIcdO1, "1-9")

    }

    // ID: NAACCR-00741; TAG: N0373; NAME: Grade (COC)
    public boolean naaccr00741(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.grade))
            return true
        if (functions.GEN_INLIST(untrimmedline.grade, "1-9"))
            return true
        return false

    }

    // ID: NAACCR-00742; TAG: N0979; NAME: Grade Path System (COC)
    public boolean naaccr00742(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.gradePathSystem))
            return true
        if (!functions.GEN_INLIST(untrimmedline.gradePathSystem, "2, 3, 4"))
            return false
        
        return true

    }

    // ID: NAACCR-00743; TAG: N0981; NAME: Grade Path System, Grade Path Value, Grade (COC)
    public boolean naaccr00743(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.gradePathSystem)) {
            if (!functions.GEN_EMPTY(untrimmedline.gradePathValue))
                return false
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.gradePathSystem, "2")) {
                if (!functions.GEN_INLIST(untrimmedline.gradePathValue, "1,2"))
                    return false
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.gradePathSystem, "3")) {
                    if (!functions.GEN_INLIST(untrimmedline.gradePathValue, "1-3"))
                        return false
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.gradePathSystem, "4")) {
                        if (!functions.GEN_INLIST(untrimmedline.gradePathValue, "1-4"))
                            return false
                    }
                }
            }
        }
        
        return true

    }

    // ID: NAACCR-00744; TAG: N0980; NAME: Grade Path Value (COC)
    public boolean naaccr00744(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.gradePathValue))
            return true
        if (!functions.GEN_INLIST(untrimmedline.gradePathValue, "1-4"))
            return false
        
        return true

    }

    // ID: NAACCR-00745; TAG: N0433; NAME: Hemato ICDO2, Summ Stg 1977, Class of Case (NAACCR
    public boolean naaccr00745(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year > 2000)
            return true
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
            return true
        if (functions.GEN_INLIST(untrimmedline.classOfCase, "49"))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9731,9740,9764,9930")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "1,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'SEER Summary Stage must = 1, 7, or 9 for this histology')
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9720,9722,9723,9732,9741,9760-9763,9765-9910,9931-9989")) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "7"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'SEER Summary Stage must = 7 for this histology')
            }
        }
        return true

    }

    // ID: NAACCR-00746; TAG: N0432; NAME: Hemato ICDO2, Summ Stg 1977, Type Rpt Srce (NAACCR
    public boolean naaccr00746(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year > 2000)
            return true
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9731,9740,9764,9930")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "1,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'SEER Summary Stage must = 1, 7, or 9 for this histology')
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9720,9722,9723,9732,9741,9760-9763,9765-9910,9931-9989")) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "7"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'SEER Summary Stage must = 7 for this histology')
            }
        }
        return true

    }

    // ID: NAACCR-00747; TAG: N0839; NAME: Hemato ICDO3, Summ Stg 1977 (NAACCR)
    public boolean naaccr00747(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731-9989"))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731,9734,9740,9750-9752,9755-9758,9764,9930")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "1,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'SEER Summary Stage must = 1, 7, or 9 for this histology')
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "7"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'SEER Summary Stage must = 7 for this histology')
        }
        return true

    }

    // ID: NAACCR-00748; TAG: N0374; NAME: Hematopoietic, TNM, ICDO2 (NAACCR)
    public boolean naaccr00748(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if ((dx_year < 1996) || (dx_year > 2000))
            return true
        if (functions.GEN_EMPTY(untrimmedline.tnmClinT) && functions.GEN_EMPTY(untrimmedline.tnmClinN) && functions.GEN_EMPTY(untrimmedline.tnmClinM) && functions.GEN_EMPTY(untrimmedline.tnmClinStageGroup) && functions.GEN_EMPTY(untrimmedline.tnmPathT) && functions.GEN_EMPTY(untrimmedline.tnmPathN) && functions.GEN_EMPTY(untrimmedline.tnmPathM) && functions.GEN_EMPTY(untrimmedline.tnmPathStageGroup))
            return true
        if (functions.GEN_INLIST(untrimmedline.classOfCase, "49") || functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9720,9722,9723,9731,9732,9740,9741,9760-9989")) {
            if (functions.GEN_INLIST(untrimmedline.tnmClinT, "88") && functions.GEN_INLIST(untrimmedline.tnmClinN, "88") && functions.GEN_INLIST(untrimmedline.tnmClinM, "88") && functions.GEN_INLIST(untrimmedline.tnmClinStageGroup, "88") && functions.GEN_INLIST(untrimmedline.tnmPathT, "88") && functions.GEN_INLIST(untrimmedline.tnmPathN, "88") && functions.GEN_INLIST(untrimmedline.tnmPathM, "88") && functions.GEN_INLIST(untrimmedline.tnmPathStageGroup, "88"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00749; TAG: N0932; NAME: Hematopoietic, TNM, ICDO3 (COC)
    public boolean naaccr00749(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 1996)
            return true
        if (dx_year > 2009)
            return true
        if (functions.GEN_EMPTY(untrimmedline.tnmClinT) && functions.GEN_EMPTY(untrimmedline.tnmClinN) && functions.GEN_EMPTY(untrimmedline.tnmClinM) && functions.GEN_EMPTY(untrimmedline.tnmClinStageGroup) && functions.GEN_EMPTY(untrimmedline.tnmPathT) && functions.GEN_EMPTY(untrimmedline.tnmPathN) && functions.GEN_EMPTY(untrimmedline.tnmPathM) && functions.GEN_EMPTY(untrimmedline.tnmPathStageGroup))
            return true
        if (functions.GEN_INLIST(untrimmedline.classOfCase, "49") || functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731-9992"))
            return true
        if (dx_year < 2008) {
            if (functions.GEN_INLIST(untrimmedline.tnmClinT, "88") && functions.GEN_INLIST(untrimmedline.tnmClinN, "88") && functions.GEN_INLIST(untrimmedline.tnmClinM, "88") && functions.GEN_INLIST(untrimmedline.tnmClinStageGroup, "88") && functions.GEN_INLIST(untrimmedline.tnmPathT, "88") && functions.GEN_INLIST(untrimmedline.tnmPathN, "88") && functions.GEN_INLIST(untrimmedline.tnmPathM, "88") && functions.GEN_INLIST(untrimmedline.tnmPathStageGroup, "88"))
                return true
            else
                return false
        }
        if (dx_year > 2007) {
            if (functions.GEN_INLIST(untrimmedline.tnmClinT, "88") && functions.GEN_INLIST(untrimmedline.tnmClinN, "88") && functions.GEN_INLIST(untrimmedline.tnmClinM, "88") && functions.GEN_INLIST(untrimmedline.tnmClinStageGroup, "88") && (functions.GEN_INLIST(untrimmedline.tnmPathT, "88") || functions.GEN_EMPTY(untrimmedline.tnmPathT)) && (functions.GEN_INLIST(untrimmedline.tnmPathN, "88") || functions.GEN_EMPTY(untrimmedline.tnmPathN)) && (functions.GEN_INLIST(untrimmedline.tnmPathM, "88") || functions.GEN_EMPTY(untrimmedline.tnmPathM)) && (functions.GEN_INLIST(untrimmedline.tnmPathStageGroup, "88") || functions.GEN_EMPTY(untrimmedline.tnmPathStageGroup)))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'Hematopoietic, all Clin TNM fields must = 88, Path TNM fields must = 88 or blank')
        }
        return true

    }

    // ID: NAACCR-00750; TAG: N0451; NAME: Hematopoietic, TNM, ICDO3 (NAACCR)
    public boolean naaccr00750(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 1996)
            return true
        if (dx_year > 2009)
            return true
        if (functions.GEN_EMPTY(untrimmedline.tnmClinT) && functions.GEN_EMPTY(untrimmedline.tnmClinN) && functions.GEN_EMPTY(untrimmedline.tnmClinM) && functions.GEN_EMPTY(untrimmedline.tnmClinStageGroup) && functions.GEN_EMPTY(untrimmedline.tnmPathT) && functions.GEN_EMPTY(untrimmedline.tnmPathN) && functions.GEN_EMPTY(untrimmedline.tnmPathM) && functions.GEN_EMPTY(untrimmedline.tnmPathStageGroup))
            return true
        if (functions.GEN_INLIST(untrimmedline.classOfCase, "49") || functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731-9992")) {
            if (functions.GEN_INLIST(untrimmedline.tnmClinT, "88") && functions.GEN_INLIST(untrimmedline.tnmClinN, "88") && functions.GEN_INLIST(untrimmedline.tnmClinM, "88") && functions.GEN_INLIST(untrimmedline.tnmClinStageGroup, "88") && functions.GEN_INLIST(untrimmedline.tnmPathT, "88") && functions.GEN_INLIST(untrimmedline.tnmPathN, "88") && functions.GEN_INLIST(untrimmedline.tnmPathM, "88") && functions.GEN_INLIST(untrimmedline.tnmPathStageGroup, "88"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00751; TAG: N0625; NAME: Hist ICDO2, Date of DX, ICDO2 Conv Flag (SEER IF84)
    public boolean naaccr00751(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (functions.GEN_INLIST(untrimmedline.registryId, "0000001562", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)"))
            return true
        if (dx_year < 2001) {
            if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
                return false
        }
        if (dx_year > 2000) {
            if (!functions.GEN_EMPTY(untrimmedline.histologyIcdO2)) {
                if (!functions.GEN_INLIST(untrimmedline.icdO2ConversionFlag, "0,5,6"))
                    return false
            }
        }
        return true

    }

    // ID: NAACCR-00752; TAG: N0627; NAME: Hist ICDO3, Date of DX, ICDO3 Conv Flag (SEER IF86)
    public boolean naaccr00752(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (functions.GEN_INLIST(untrimmedline.registryId, "0000001562", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)"))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY)) {
            if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
                return false
        }
        if (dx_year > 2000) {
            if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
                return false
        }
        if (dx_year < 2001) {
            if (!functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3)) {
                if (!functions.GEN_INLIST(untrimmedline.icdO3ConversionFlag, "1,3"))
                    return false
            }
        }
        return true

    }

    // ID: NAACCR-00753; TAG: N0740; NAME: Hist/Behav ICDO2, Hist/Behav ICDO3 (SEER IF126)
    public boolean naaccr00753(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.morphTypebehavIcdO2) && functions.GEN_EMPTY(untrimmedline.morphTypebehavIcdO3))
            return false
        if (!functions.GEN_EMPTY(functions.GEN_SUBSTR(untrimmedline.morphTypebehavIcdO2, 1, 4)) && functions.GEN_EMPTY(functions.GEN_SUBSTR(untrimmedline.morphTypebehavIcdO2, 5, 1)))
            return functions.GEN_ERROR_MSG(binding, 'Histology (92-00) ICD-O-2/Behavior (92-00) ICD-O-2 conflict')
        if (!functions.GEN_EMPTY(functions.GEN_SUBSTR(untrimmedline.morphTypebehavIcdO2, 5, 1)) && functions.GEN_EMPTY(functions.GEN_SUBSTR(untrimmedline.morphTypebehavIcdO2, 1, 4)))
            return functions.GEN_ERROR_MSG(binding, 'Histology (92-00) ICD-O-2/Behavior (92-00) ICD-O-2 conflict')
        if (!functions.GEN_EMPTY(functions.GEN_SUBSTR(untrimmedline.morphTypebehavIcdO3, 1, 4)) && functions.GEN_EMPTY(functions.GEN_SUBSTR(untrimmedline.morphTypebehavIcdO3, 5, 1)))
            return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3/Behavior Code ICD-O-3 conflict')
        if (!functions.GEN_EMPTY(functions.GEN_SUBSTR(untrimmedline.morphTypebehavIcdO3, 5, 1)) && functions.GEN_EMPTY(functions.GEN_SUBSTR(untrimmedline.morphTypebehavIcdO3, 1, 4)))
            return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3/Behavior Code ICD-O-3 conflict')
        return true

    }

    // ID: NAACCR-00754; TAG: N1784; NAME: Histologic Type ICD-O-3, Behavior, Grade (SEER)
    public boolean naaccr00754(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR) || dx_year > 2017)
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3) || functions.GEN_EMPTY(untrimmedline.grade))
            return true
        if (functions.GEN_INLIST(untrimmedline.grade, "5,6,7,8")) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9992"))
                return functions.GEN_ERROR_MSG(binding, 'Grades 5-8 allowed only for histologies 9590-9992')
        }
        if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3"))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8331,9511")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "1"))
                return functions.GEN_ERROR_MSG(binding, 'This histology (${untrimmedline.histologicTypeIcdO3}) carries an implied grade of 1')
            else
                return true
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8020,8021,9082,9083")) {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "C809") && functions.GEN_INLIST(untrimmedline.grade, "9"))
                    return true
                else {
                    if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9083")) {
                        if (!functions.GEN_INLIST(untrimmedline.grade, "2"))
                            return functions.GEN_ERROR_MSG(binding, 'This histology (${untrimmedline.histologicTypeIcdO3}) carries an implied grade of 2')
                        else
                            return true
                    }
                    else {
                        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8020,8021,9082")) {
                            if (!functions.GEN_INLIST(untrimmedline.grade, "4"))
                                return functions.GEN_ERROR_MSG(binding, 'This histology (${untrimmedline.histologicTypeIcdO3}) carries an implied grade of 4')
                            else
                                return true
                        }
                        else {
                            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9401,9451,9512")) {
                                if (!functions.GEN_INLIST(untrimmedline.grade, "4"))
                                    return functions.GEN_ERROR_MSG(binding, 'This histology (${untrimmedline.histologicTypeIcdO3}) carries an implied grade of 4')
                                else
                                    return true
                            }
                        }
                    }
                }
            }
        }
        return true

    }

    // ID: NAACCR-00755; TAG: N0355; NAME: Histologic Type ICDO2 (COC)
    public boolean naaccr00755(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
            return true
        if (!functions.GEN_ILOOKUP(untrimmedline.histologyIcdO2, context.NAACCR_HISICDO2, context.NAACCR_HISICDO2_HISTOLOGY, [:]))
            return false
        return true

    }

    // ID: NAACCR-00756; TAG: N0795; NAME: Histologic Type ICDO3 (SEER)
    public boolean naaccr00756(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NAACCR_HISICDO3, (com.imsweb.validation.entities.ContextTableIndex)context.NAACCR_HISICDO3_HISTOLOGY, untrimmedline.histologicTypeIcdO3, [:]))
            return false
        return true

    }

    // ID: NAACCR-00757; TAG: N0840; NAME: Histologic Type ICDO3 Conversion (NAACCR)
    public boolean naaccr00757(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NAACCR_HISICDO3, (com.imsweb.validation.entities.ContextTableIndex)context.NAACCR_HISICDO3_HISTOLOGY, untrimmedline.histologicTypeIcdO3, [:]))
            return false
        return true

    }

    // ID: NAACCR-00758; TAG: N0622; NAME: Histology (73-91) ICD-O-1 (SEER)
    public boolean naaccr00758(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.histologyIcdO1))
            return true
        return functions.GEN_INLIST(untrimmedline.histologyIcdO1, "8000-9990")

    }

    // ID: NAACCR-00759; TAG: N0499; NAME: Histology ICDO2, Date DX, Date 1st Contact (NAACCR)
    public boolean naaccr00759(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, fc_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year != ((Integer)context.NAACCR_GEN_DT_EMPTY)) {
            if (dx_year < 2001) {
                if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
                    return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis < 2001, Histology (92-00) ICD-O-2 cannot be blank')
                else
                    return true
            }
            else
                return true
        }
        fc_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOf1stContact)
        
        if (fc_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (fc_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of 1st Contact: %DC')
        if (fc_year < 2001) {
            if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
                return functions.GEN_ERROR_MSG(binding, 'If Date of Diagnosis is unknown and Date of 1st Contact < 2001, then Histology (92-00) ICD-O-2 cannot be blank')
            else
                return true
        }
        return true

    }

    // ID: NAACCR-00760; TAG: N0458; NAME: Histology ICDO2, Date of Diagnosis (NAACCR)
    public boolean naaccr00760(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2001) {
            if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
                return false
        }
        return true

    }

    // ID: NAACCR-00761; TAG: N0478; NAME: Histology ICDO2, Histology ICDO3 (SEER IF94)
    public boolean naaccr00761(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2) && functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return false
        return true

    }

    // ID: NAACCR-00762; TAG: N0500; NAME: Histology ICDO3, Date DX, Date 1st Cont (NAACCR)
    public boolean naaccr00762(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, fc_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year != ((Integer)context.NAACCR_GEN_DT_EMPTY)) {
            if (dx_year > 2000) {
                if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
                    return functions.GEN_ERROR_MSG(binding, 'If Date of Diagnosis > 2000, Histologic Type ICD-O-3 cannot be blank')
                else
                    return true
            }
            else
                return true
        }
        fc_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOf1stContact)
        
        if (fc_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (fc_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of 1st Contact: %DC')
        if (fc_year > 2000) {
            if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
                return functions.GEN_ERROR_MSG(binding, 'If Date of Diagnosis is unknown and Date of 1st Contact > 2000, then Histologic Type ICD-O-3 cannot be blank')
            else
                return true
        }
        return true

    }

    // ID: NAACCR-00763; TAG: N0459; NAME: Histology ICDO3, Date of Diagnosis (NAACCR)
    public boolean naaccr00763(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2000) {
            if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
                return false
        }
        return true

    }

    // ID: NAACCR-00764; TAG: N1965; NAME: Histology ICDO3, Grade, Date of DX (SEER)
    public boolean naaccr00764(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if ((dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY)) || (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR)))
            return true
        if (dx_year < 2010 || dx_year > 2017)
            return true
        if ((functions.GEN_EMPTY(untrimmedline.grade)) || (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3)))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9702,9705,9708,9709,9716-9718,9724-9726")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "5"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 5 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9714")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "5,6"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 5 or 6 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9827,9834,9837")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "5"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 5 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9591,9596,9597,9659,9671,9673,9678-9680,9687-9691")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "6"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 6 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9695,9698,9699,9712,9731,9732,9734,9737,9738,9761,9762,9811-9818")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "6"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 6 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9823,9826,9833,9940")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "6"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 6 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9719,9948")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "8"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 8 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9740-9742,9751,9755-9759,9801,9806-9809,9875,9876,9945,9946")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "9"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 9 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9950,9961-9964,9975,9980,9982,9983,9985,9986,9989,9991,9992")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "9"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 9 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9831")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "5,8,9"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 5, 8, or 9 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590,9650,9651,9652,9653,9655,9663,9727,9735,9800,9820,9832")) {
            if (functions.GEN_INLIST(untrimmedline.grade, "1-4"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must not = 1-4 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9840,9860,9861,9863,9865-9867,9869,9870-9874,9891,9895-9898,9910,9911")) {
            if (functions.GEN_INLIST(untrimmedline.grade, "1-4"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must not = 1-4 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9920,9930,9931,9965,9966,9967,9971")) {
            if (functions.GEN_INLIST(untrimmedline.grade, "1-4"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must not = 1-4 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        
        return true

    }

    // ID: NAACCR-00765; TAG: N0375; NAME: Histology, Primary Site, Tumor Size, ICDO2 (COC)
    public boolean naaccr00765(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.morphTypebehavIcdO2))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year > 2000)
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
            return true
        if (functions.GEN_EMPTY(untrimmedline.eodTumorSize))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9720,9722,9732,9760-9764,9800-9820,9826,9840-9894,9910,9931-9962,9980-9989")) {
            if (functions.GEN_VAL(untrimmedline.eodTumorSize) == 999)
                return true
            else
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,760-765,767-768,809", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_VAL(untrimmedline.eodTumorSize) == 999)
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00766; TAG: N0452; NAME: Histology, Primary Site, Tumor Size, ICDO3 (COC)
    public boolean naaccr00766(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_EMPTY(untrimmedline.eodTumorSize))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2003)
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9750,9760-9764,9800-9820,9826,9831-9920,9931-9964,9980-9989")) {
            if (functions.GEN_VAL(untrimmedline.eodTumorSize) == 999)
                return true
            else
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,760-765,767-768,809", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_VAL(untrimmedline.eodTumorSize) == 999)
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00767; TAG: N0849; NAME: ICD Revision Comorbid (COC)
    public boolean naaccr00767(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.icdRevisionComorbid))
            return true
        return functions.GEN_INLIST(untrimmedline.icdRevisionComorbid, "0,1,9")

    }

    // ID: NAACCR-00769; TAG: N0832; NAME: ICD Revision Number (NPCR)
    public boolean naaccr00769(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0-1,7-9")

    }

    // ID: NAACCR-00770; TAG: N0051; NAME: ICD Revision Number (SEER ICDCODE)
    public boolean naaccr00770(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.icdRevisionNumber))
            return true
        return functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0-1,7-9")

    }

    // ID: NAACCR-00771; TAG: N0846; NAME: ICD Revision Number, Cause of Death (NAACCR)
    public boolean naaccr00771(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int cod_num
        char[] COD = new char[5]
        
        if (functions.GEN_EMPTY(untrimmedline.causeOfDeath) || functions.GEN_EMPTY(untrimmedline.icdRevisionNumber)) {
            return true
        }
        if (functions.GEN_MATCH(untrimmedline.causeOfDeath, "(\\d\\d\\d\\d)")) {
            cod_num = functions.GEN_VAL(untrimmedline.causeOfDeath)
            if (cod_num == 0) {
                if (!functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0"))
                    return false
                else
                    return true
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0"))
                    return false
                else {
                    if (cod_num == 7777 || cod_num == 7797)
                        return true
                }
            }
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0")) {
                return false
            }
        }
        if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "9")) {
            if (functions.GEN_INLIST(untrimmedline.causeOfDeath, "9599"))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "1")) {
            if (functions.GEN_INLIST(untrimmedline.causeOfDeath, "U070,U071,U072"))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "1")) {
            if (functions.GEN_MATCH(untrimmedline.causeOfDeath, "([A-Z]\\d\\d((\\s)|(9)))")) {
                functions.GEN_STRCPY(COD, functions.GEN_SUBSTR(untrimmedline.causeOfDeath, 1, 3))
                functions.GEN_STRCAT(COD, " ")
        
                if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NAACCR_ICD10COD, (com.imsweb.validation.entities.ContextTableIndex)context.NAACCR_ICD10COD_CODE, COD, [:]))
                    return true
            }
            else {
        
                if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NAACCR_ICD10COD, (com.imsweb.validation.entities.ContextTableIndex)context.NAACCR_ICD10COD_CODE, untrimmedline.causeOfDeath, [:]))
                    return false
            }
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "7")) {
                if (!functions.GEN_ILOOKUP(untrimmedline.causeOfDeath, context.NAACCR_ICD7COD, context.NAACCR_ICD7COD_CODE, [:]))
                    return false
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "8")) {
                    if (!functions.GEN_ILOOKUP(untrimmedline.causeOfDeath, context.NAACCR_ICD8COD, context.NAACCR_ICD8COD_CODE, [:]))
                        return false
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "9")) {
                        if (!functions.GEN_ILOOKUP(untrimmedline.causeOfDeath, context.NAACCR_ICD9COD, context.NAACCR_ICD9COD_CODE, [:]))
                            return false
                    }
                }
            }
        }
        return true

    }

    // ID: NAACCR-00772; TAG: N0093; NAME: ICD Revision Number, Cause of Death (SEER IF37)
    public boolean naaccr00772(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int cod_num
        char[] COD = new char[5]
        
        if (functions.GEN_MATCH(untrimmedline.causeOfDeath, "(\\d\\d\\d\\d)")) {
            cod_num = functions.GEN_VAL(untrimmedline.causeOfDeath)
            if (cod_num == 0) {
                if (!functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0"))
                    return false
                else
                    return true
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0"))
                    return false
                else {
                    if (cod_num == 7777 || cod_num == 7797)
                        return true
                }
            }
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0")) {
                return false
            }
        }
        if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "9")) {
            if (functions.GEN_INLIST(untrimmedline.causeOfDeath, "9599"))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "1")) {
            if (functions.GEN_MATCH(untrimmedline.causeOfDeath, "([A-Z]\\d\\d\\s)")) {
                functions.GEN_STRCPY(COD, functions.GEN_SUBSTR(untrimmedline.causeOfDeath, 1, 3))
                functions.GEN_STRCAT(COD, "9")
            }
            if (functions.GEN_MATCH(untrimmedline.causeOfDeath, "([A-Z]\\d\\d\\d)"))
                functions.GEN_STRCPY(COD, untrimmedline.causeOfDeath)
            if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NAACCR_ICD10COD, (com.imsweb.validation.entities.ContextTableIndex)context.NAACCR_ICD10COD_CODE, COD, [:]))
                return false
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "7")) {
                if (!functions.GEN_ILOOKUP(untrimmedline.causeOfDeath, context.NAACCR_ICD7COD, context.NAACCR_ICD7COD_CODE, [:]))
                    return false
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "8")) {
                    if (!functions.GEN_ILOOKUP(untrimmedline.causeOfDeath, context.NAACCR_ICD8COD, context.NAACCR_ICD8COD_CODE, [:]))
                        return false
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "9")) {
                        if (!functions.GEN_ILOOKUP(untrimmedline.causeOfDeath, context.NAACCR_ICD9COD, context.NAACCR_ICD9COD_CODE, [:]))
                            return false
                    }
                }
            }
        }
        return true

    }

    // ID: NAACCR-00773; TAG: N0713; NAME: ICD Revision, Vital Stat, Date Last Contact (NPCR)
    public boolean naaccr00773(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dolc_year
        
        if (functions.GEN_EMPTY(untrimmedline.causeOfDeath))
            functions.GEN_NOOP()
        if (functions.GEN_EMPTY(untrimmedline.icdRevisionNumber))
            return true
        dolc_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfLastContact)
        
        if (dolc_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dolc_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact: %DC')
        if (functions.GEN_INLIST(untrimmedline.vitalStatus, "0")) {
            if (dolc_year > 1978 && dolc_year < 1999) {
                if (!functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0,1"))
                    return true
                else
                    return false
            }
            else {
                if (dolc_year == 1999) {
                    if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "9,1"))
                        return true
                    else
                        return false
                }
                else {
                    if (dolc_year > 1999) {
                        if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "1"))
                            return true
                        else
                            return false
                    }
                }
            }
        }
        if (functions.GEN_INLIST(untrimmedline.vitalStatus, "1")) {
            if (!functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0"))
                return false
        }
        return true

    }

    // ID: NAACCR-00774; TAG: N0738; NAME: ICD Revisn, Vital Stat, Date Last Cont (SEER IF113)
    public boolean naaccr00774(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dolc_year
        
        dolc_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfLastContact)
        
        if (dolc_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dolc_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact: %DC')
        if (dolc_year > 1998) {
            if (functions.GEN_INLIST(untrimmedline.vitalStatus, "0")) {
                if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "1"))
                    return true
                else
                    return false
            }
        }
        if (dolc_year > 1978 && dolc_year < 1999) {
            if (functions.GEN_INLIST(untrimmedline.vitalStatus, "0")) {
                if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "9"))
                    return true
                else
                    return false
            }
        }
        return true

    }

    // ID: NAACCR-00775; TAG: N0147; NAME: ICD-O-2 Conversion Flag (SEER ICDOREV)
    public boolean naaccr00775(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.icdO2ConversionFlag, "0-6") || functions.GEN_EMPTY(untrimmedline.icdO2ConversionFlag))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00776; TAG: N0629; NAME: ICD-O-2 Conversion Flag, Hist, Behav (SEER IF70)
    public boolean naaccr00776(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2) && functions.GEN_EMPTY(untrimmedline.behaviorIcdO2)) {
            if (functions.GEN_EMPTY(untrimmedline.icdO2ConversionFlag))
                return true
            else
                return false
        }
        if (!functions.GEN_EMPTY(untrimmedline.histologyIcdO2) && !functions.GEN_EMPTY(untrimmedline.behaviorIcdO2)) {
            if (!functions.GEN_EMPTY(untrimmedline.icdO2ConversionFlag))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00777; TAG: N0487; NAME: ICD-O-3 Conversion Flag (NAACCR)
    public boolean naaccr00777(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.icdO3ConversionFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.icdO3ConversionFlag, "0,1,3"))
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00778; TAG: N0498; NAME: ICD-O-3 Conversion Flag, Histology ICDO3 (SEER IF95)
    public boolean naaccr00778(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (!functions.GEN_EMPTY(untrimmedline.icdO3ConversionFlag)) {
            if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
                return false
        }
        return true

    }

    // ID: NAACCR-00779; TAG: N0753; NAME: IHS Link (NPCR)
    public boolean naaccr00779(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.ihsLink))
            return true
        return functions.GEN_INLIST(untrimmedline.ihsLink, "0,1")

    }

    // ID: NAACCR-00780; TAG: N0164; NAME: Industry Source (NPCR)
    public boolean naaccr00780(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.industrySource, "0-3,7-9", "(\\d)") || functions.GEN_EMPTY(untrimmedline.industrySource)

    }

    // ID: NAACCR-00781; TAG: N0982; NAME: Inpatient Status (NAACCR)
    public boolean naaccr00781(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.inpatientStatus))
            return true
        if (!functions.GEN_INLIST(untrimmedline.inpatientStatus, "0,1,9"))
            return false
        
        return true

    }

    // ID: NAACCR-00782; TAG: N0159; NAME: Institution Referred From (COC)
    public boolean naaccr00782(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.institutionReferredFrom))
            return true
        return functions.GEN_MATCH(untrimmedline.institutionReferredFrom, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")

    }

    // ID: NAACCR-00783; TAG: N0594; NAME: Institution Referred From, Date of Diagnosis (COC)
    public boolean naaccr00783(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2002) {
            if (functions.GEN_EMPTY(untrimmedline.institutionReferredFrom))
                return false
        }
        return true

    }

    // ID: NAACCR-00784; TAG: N0160; NAME: Institution Referred To (COC)
    public boolean naaccr00784(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.institutionReferredTo))
            return true
        return functions.GEN_MATCH(untrimmedline.institutionReferredTo, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")

    }

    // ID: NAACCR-00785; TAG: N0595; NAME: Institution Referred To, Date of Diagnosis (COC)
    public boolean naaccr00785(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2002) {
            if (functions.GEN_EMPTY(untrimmedline.institutionReferredTo))
                return false
        }
        return true

    }

    // ID: NAACCR-00786; TAG: N0005; NAME: Laterality (SEER LATERAL)
    public boolean naaccr00786(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.laterality, "0,1,2,3,4,5,9")

    }

    // ID: NAACCR-00787; TAG: N0715; NAME: Laterality, Primary Site (COC)
    public boolean naaccr00787(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR) || dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year > 2003) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "700,710-714,722-725", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_AT(untrimmedline.laterality, "0") != 0)
                    return false
                else
                    return true
            }
        }
        if (dx_year >= 2021) {
            if (functions.GEN_AT(untrimmedline.primarySite, "C444") != 0) {
                if (functions.GEN_AT(untrimmedline.laterality, "0") != 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Laterality must not = 0 for Primary Site" ${untrimmedline.primarySite} for Date of Diagnosis >= 2021')
                else
                    return true
            }
        }
        if ((functions.GEN_INLIST(untrimmedline.primarySite, "079,080,081,090,091,098,099,301,310,312", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.primarySite, "341-349,384,400-403,441-443,445-447,471", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.primarySite, "472,491,492,500-509,569,570,620-629,630", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.primarySite, "631,649,659,669,690-699,740-749,754", "(C\\d\\d\\d)", 2, 3))) {
            if (functions.GEN_AT(untrimmedline.laterality, "0") != 0)
                return false
            else
                return true
        }
        return true

    }

    // ID: NAACCR-00788; TAG: N0652; NAME: Laterality, Primary Site, Date of Diag (SEER IF24)
    public boolean naaccr00788(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year >= 2021) {
            if (functions.GEN_AT(untrimmedline.primarySite, "C444") != 0) {
                if (functions.GEN_AT(untrimmedline.laterality, "0") != 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Laterality must not = 0 for Primary Site: ${untrimmedline.primarySite} for Date of Diagnosis > 2021')
                else
                    return true
            }
        }
        if (dx_year >= 2018) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "090,091", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_AT(untrimmedline.laterality, "0"))
                    return true
            }
        }
        if (functions.GEN_INLIST(untrimmedline.laterality, "0")) {
            if ((functions.GEN_INLIST(untrimmedline.primarySite, "079,080,091,098,099,301,310,312", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.primarySite, "341-349,384,500-509,569,570", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.primarySite, "620-629,630,631,649,659,669", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.primarySite, "690-699,740-749,754", "(C\\d\\d\\d)", 2, 3)) || (dx_year > 1978 && (functions.GEN_INLIST(untrimmedline.primarySite, "081,090,400-403,441-443", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.primarySite, "445-447,471,472,491,492", "(C\\d\\d\\d)", 2, 3))) || (dx_year > 2003 && (functions.GEN_INLIST(untrimmedline.primarySite, "700,710-714,722-725", "(C\\d\\d\\d)", 2, 3))))
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.laterality, "5")) {
            if (!functions.GEN_INLIST(untrimmedline.primarySite, "443,445,700,710-714,722-725", "(C\\d\\d\\d)", 2, 3))
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.laterality, "5")) {
            if (dx_year > 2009)
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00789; TAG: N0445; NAME: Laterality, Primary Site, Morph ICDO3 (SEER IF42)
    public boolean naaccr00789(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        boolean paired_organ
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_MATCH(untrimmedline.overRideSiteLatMorph, "(1)"))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "2") == 0)
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9999", "(\\d\\d\\d\\d)"))
            return true
        if (dx_year > 1987 && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140,9700,9701,9590-9980", "(\\d\\d\\d\\d)"))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year >= 2021) {
            if (functions.GEN_AT(untrimmedline.primarySite, "C444C443C445", 4) != 0) {
                if (functions.GEN_AT(untrimmedline.laterality, "0") != 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Laterality must not = 0 for Primary Site: ${untrimmedline.primarySite} for Date of Diagnosis >= 2021')
                else
                    return true
            }
        }
        if (dx_year >= 2018) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "090,091", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_AT(untrimmedline.laterality, "0"))
                    return true
            }
        }
        paired_organ = functions.GEN_ILOOKUP(untrimmedline.primarySite, context.NAACCR_PAIRORGN, context.NAACCR_PAIRORGN_PAIRSITE, [:]) || (dx_year > 1978 && functions.GEN_INLIST(untrimmedline.primarySite, "081,090,400-403,441,442,446,447,471,472,491,492", "(C\\d\\d\\d)", 2, 3))
        
        if (paired_organ) {
            if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
                if (!functions.GEN_INLIST(untrimmedline.laterality, "1-3,5"))
                    return false
            }
        }
        return true

    }

    // ID: NAACCR-00790; TAG: N1014; NAME: Lymphovascular Invasion (CS)
    public boolean naaccr00790(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR) || dx_year > 2017)
            return true
        if (functions.GEN_EMPTY(untrimmedline.lymphVascularInvasion))
            return true
        if (!functions.GEN_INLIST(untrimmedline.lymphVascularInvasion, "0,1,8,9"))
            return false
        
        return true

    }

    // ID: NAACCR-00793; TAG: N1763; NAME: Lymphovascular Invasion, Penis and Testis (CS)
    public boolean naaccr00793(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if ((dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY)) || (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR)) || (dx_year > 2017))
            return true
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        int err_flag
        err_flag = 0
        
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        functions.GEN_STRCPY(t_discrim, untrimmedline.csSiteSpecificFactor25)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,"))
            return true
        if (functions.GEN_INLIST(t_schema_name, "Penis,Testis")) {
            if (functions.GEN_INLIST(untrimmedline.lymphVascularInvasion, "8")) {
                functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                return false
            }
        }
        
        return true

    }

    // ID: NAACCR-00794; TAG: N0841; NAME: Lymphoma ICDO3, Site, Summ Stg 1977 (NAACCR)
    public boolean naaccr00794(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9699, 9702-9729")) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "3,4"))
                    return false
            }
            if (functions.GEN_INLIST(untrimmedline.primarySite, "778", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "1"))
                    return false
            }
        }
        return true

    }

    // ID: NAACCR-00795; TAG: N0376; NAME: Lymphoma, EOD--Ext, Summ Stg 1977, ICDO2 (NAACCR)
    public boolean naaccr00795(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2000)
            return true
        if (functions.GEN_EMPTY(untrimmedline.eodExtension) || functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9590-9595,9650-9698,9702-9717")) {
                if (functions.GEN_INLIST(untrimmedline.eodExtension, "10-11")) {
                    if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "1"))
                        return true
                    else
                        return false
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.eodExtension, "20-21")) {
                        if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "5"))
                            return true
                        else
                            return false
                    }
                    else {
                        if (functions.GEN_INLIST(untrimmedline.eodExtension, "30-80")) {
                            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "7"))
                                return true
                            else
                                return false
                        }
                        else {
                            if (functions.GEN_INLIST(untrimmedline.eodExtension, "99")) {
                                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "9"))
                                    return true
                                else
                                    return false
                            }
                        }
                    }
                }
            }
        }
        return true

    }

    // ID: NAACCR-00796; TAG: N0443; NAME: Lymphoma, EOD--Ext, Summ Stg 2000, ICDO3 (NAACCR)
    public boolean naaccr00796(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.eodExtension) || functions.GEN_EMPTY(untrimmedline.seerSummaryStage2000))
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9596,9650-9699,9702-9719,9727-9729")) {
                if (functions.GEN_INLIST(untrimmedline.eodExtension, "10-11")) {
                    if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1"))
                        return true
                    else
                        return false
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.eodExtension, "20-21")) {
                        if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "5"))
                            return true
                        else
                            return false
                    }
                    else {
                        if (functions.GEN_INLIST(untrimmedline.eodExtension, "30-80")) {
                            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "7"))
                                return true
                            else
                                return false
                        }
                        else {
                            if (functions.GEN_INLIST(untrimmedline.eodExtension, "99")) {
                                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "9"))
                                    return true
                                else
                                    return false
                            }
                        }
                    }
                }
            }
        }
        return true

    }

    // ID: NAACCR-00797; TAG: N0377; NAME: Lymphoma, EOD--Tumor Size, ICDO2 (NAACCR)
    public boolean naaccr00797(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2000)
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
            return true
        if (functions.GEN_EMPTY(untrimmedline.eodTumorSize))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9590-9698,9702-9717")) {
            if (functions.GEN_INLIST(untrimmedline.eodTumorSize, "001,002,999"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00798; TAG: N0453; NAME: Lymphoma, EOD--Tumor Size, ICDO3 (NAACCR)
    public boolean naaccr00798(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_EMPTY(untrimmedline.eodTumorSize))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2003)
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9699,9702-9729")) {
            if (functions.GEN_INLIST(untrimmedline.eodTumorSize, "001,002,999"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00799; TAG: N0378; NAME: Lymphoma, Prim Site, Summ Stg 1977, ICDO2 (NAACCR)
    public boolean naaccr00799(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2000)
            return true
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9590-9595,9650-9698,9702-9717")) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "3,4"))
                    return false
            }
            if (functions.GEN_INLIST(untrimmedline.primarySite, "778", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "1"))
                    return false
            }
        }
        return true

    }

    // ID: NAACCR-00800; TAG: N0379; NAME: Lymphoma, TNM, ICDO2 (NAACCR)
    public boolean naaccr00800(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2000)
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
            return true
        if (functions.GEN_EMPTY(untrimmedline.tnmClinT) && functions.GEN_EMPTY(untrimmedline.tnmClinN) && functions.GEN_EMPTY(untrimmedline.tnmClinM) && functions.GEN_EMPTY(untrimmedline.tnmPathT) && functions.GEN_EMPTY(untrimmedline.tnmPathN) && functions.GEN_EMPTY(untrimmedline.tnmPathM))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9590-9698,9702-9717")) {
            if (functions.GEN_INLIST(untrimmedline.tnmClinT, "88") && functions.GEN_INLIST(untrimmedline.tnmPathT, "88") && functions.GEN_INLIST(untrimmedline.tnmClinN, "88") && functions.GEN_INLIST(untrimmedline.tnmPathN, "88") && functions.GEN_INLIST(untrimmedline.tnmClinM, "88") && functions.GEN_INLIST(untrimmedline.tnmPathM, "88"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00801; TAG: N0933; NAME: Lymphoma, TNM, ICDO3 (COC)
    public boolean naaccr00801(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (dx_year > 2009) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "441, 690, 695, 696", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_EMPTY(untrimmedline.tnmClinT) && functions.GEN_EMPTY(untrimmedline.tnmClinN) && functions.GEN_EMPTY(untrimmedline.tnmClinM) && functions.GEN_EMPTY(untrimmedline.tnmPathT) && functions.GEN_EMPTY(untrimmedline.tnmPathN) && functions.GEN_EMPTY(untrimmedline.tnmPathM))
            return true
        if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9699,9702-9729"))
            return true
        if (dx_year < 2008) {
            if (functions.GEN_INLIST(untrimmedline.tnmClinT, "88") && functions.GEN_INLIST(untrimmedline.tnmClinN, "88") && functions.GEN_INLIST(untrimmedline.tnmClinM, "88") && functions.GEN_INLIST(untrimmedline.tnmPathT, "88") && functions.GEN_INLIST(untrimmedline.tnmPathN, "88") && functions.GEN_INLIST(untrimmedline.tnmPathM, "88"))
                return true
            else
                return false
        }
        if (dx_year > 2007) {
            if (functions.GEN_INLIST(untrimmedline.tnmClinT, "88") && functions.GEN_INLIST(untrimmedline.tnmClinN, "88") && functions.GEN_INLIST(untrimmedline.tnmClinM, "88") && (functions.GEN_INLIST(untrimmedline.tnmPathT, "88") || functions.GEN_EMPTY(untrimmedline.tnmPathT)) && (functions.GEN_INLIST(untrimmedline.tnmPathN, "88") || functions.GEN_EMPTY(untrimmedline.tnmPathN)) && (functions.GEN_INLIST(untrimmedline.tnmPathM, "88") || functions.GEN_EMPTY(untrimmedline.tnmPathM)))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'Lymphoma, all Clin T,N,M fields must = 88, Path T,N,M fields must = 88 or blank')
        }
        return true

    }

    // ID: NAACCR-00802; TAG: N0454; NAME: Lymphoma, TNM, ICDO3 (NAACCR)
    public boolean naaccr00802(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (dx_year > 2009) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "441, 690, 695, 696", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_EMPTY(untrimmedline.tnmClinT) && functions.GEN_EMPTY(untrimmedline.tnmClinN) && functions.GEN_EMPTY(untrimmedline.tnmClinM) && functions.GEN_EMPTY(untrimmedline.tnmPathT) && functions.GEN_EMPTY(untrimmedline.tnmPathN) && functions.GEN_EMPTY(untrimmedline.tnmPathM))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9699,9702-9729")) {
            if (functions.GEN_INLIST(untrimmedline.tnmClinT, "88") && functions.GEN_INLIST(untrimmedline.tnmPathT, "88") && functions.GEN_INLIST(untrimmedline.tnmClinN, "88") && functions.GEN_INLIST(untrimmedline.tnmPathN, "88") && functions.GEN_INLIST(untrimmedline.tnmClinM, "88") && functions.GEN_INLIST(untrimmedline.tnmPathM, "88"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00803; TAG: N0219; NAME: Marital Status at DX (SEER MARITAL)
    public boolean naaccr00803(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.maritalStatusAtDx))
            return true
        return functions.GEN_INLIST(untrimmedline.maritalStatusAtDx, "1,2,3,4,5,6,9")

    }

    // ID: NAACCR-00804; TAG: N0220; NAME: Marital Status at DX, Age at Diagnosis (SEER IF14)
    public boolean naaccr00804(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (functions.GEN_INLIST(untrimmedline.registryId, "0000001542")) {
            dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
            if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
                return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
            else {
                if (dx_year < 2000 || dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY)) {
                    if (functions.GEN_EMPTY(untrimmedline.maritalStatusAtDx))
                        return true
                }
            }
        }
        if (functions.GEN_VAL(untrimmedline.ageAtDiagnosis) < 15) {
            if (!functions.GEN_INLIST(untrimmedline.maritalStatusAtDx, "1"))
                return false
        }
        return true

    }

    // ID: NAACCR-00806; TAG: N0231; NAME: Medical Record Number (NAACCR)
    public boolean naaccr00806(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.medicalRecordNumber))
            return false
        return functions.GEN_MATCH(functions.GEN_TRIM(untrimmedline.medicalRecordNumber, ((Integer)context.NAACCR_GEN_BOTH)), "(((\\s))*((.))+)")

    }

    // ID: NAACCR-00807; TAG: N0380; NAME: Medical Record Number, Date of Diagnosis (COC)
    public boolean naaccr00807(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 1995) {
            if (functions.GEN_EMPTY(untrimmedline.medicalRecordNumber))
                return false
        }
        return true

    }

    // ID: NAACCR-00808; TAG: N0168; NAME: Military Record No Suffix (COC)
    public boolean naaccr00808(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.militaryRecordNoSuffix))
            return true
        if (!functions.GEN_MATCH(untrimmedline.militaryRecordNoSuffix, "(\\d\\d)"))
            return false
        if (functions.GEN_INLIST(untrimmedline.militaryRecordNoSuffix, "01-20, 30-69, 98, 99"))
            return true
        return false

    }

    // ID: NAACCR-00809; TAG: N0240; NAME: Military Record No Suffix, Primary Payer (COC)
    public boolean naaccr00809(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2002) {
            if (functions.GEN_INLIST(untrimmedline.primaryPayerAtDx, "66")) {
                if (functions.GEN_EMPTY(untrimmedline.militaryRecordNoSuffix))
                    return false
            }
        }
        return true

    }

    // ID: NAACCR-00810; TAG: N0221; NAME: Morph (1973-91) ICD-O-1 (SEER OMORPnos)
    public boolean naaccr00810(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int i, dx_yr, hist_num, histlimit
        boolean morphflg, test_is_malignant, test_is_benign
        char[] histbeh = new char[6]
        
        morphflg = false
        
        dx_yr = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_yr == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_yr == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_yr > 1987) && (dx_yr < 1992)) {
            if (functions.GEN_INLIST(untrimmedline.registryId, "0000001541"))
                return true
        }
        if (dx_yr < 2000) {
            if (functions.GEN_INLIST(untrimmedline.registryId, "0000001544")) {
                return true
            }
        }
        if (dx_yr > 1991) {
        
            if (!functions.GEN_EMPTY(untrimmedline.histologyIcdO1)) {
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Histology (73-91) ICD-O-1 not valid')
                morphflg = true
            }
            if (!functions.GEN_EMPTY(untrimmedline.behaviorIcdO1)) {
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Behavior Code (73-91) ICD-O-1 not valid')
                morphflg = true
            }
            if (!functions.GEN_EMPTY(untrimmedline.gradeIcdO1)) {
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade (73-91) ICD-O-1 not valid')
                morphflg = true
            }
        }
        if (morphflg == true) {
            return true
        }
        if (dx_yr < 1992) {
            if (!functions.GEN_INLIST(untrimmedline.histologyIcdO1, "8000-9999", "(\\d\\d\\d\\d)")) {
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Histology (73-91) ICD-O-1 not valid')
                morphflg = true
            }
            else {
                if (dx_yr < 1986) {
                    histlimit = 9942
        
                    functions.GEN_STRCPY(histbeh, untrimmedline.histologyIcdO1) /* look for Behavior 3 (malignant), first */
                    functions.GEN_STRCAT(histbeh, "3")
        
                    test_is_malignant = functions.GEN_ILOOKUP(histbeh, context.NAACCR_OLDMORPH, context.NAACCR_OLDMORPH_HISTBEH, [:])
        
                    if (!test_is_malignant) {
                        functions.GEN_STRCPY(histbeh, untrimmedline.histologyIcdO1)
                        functions.GEN_STRCAT(histbeh, "2")
                        test_is_benign = functions.GEN_ILOOKUP(histbeh, context.NAACCR_OLDMORPH, context.NAACCR_OLDMORPH_HISTBEH, [:])
        
                        if (test_is_benign) {
                            if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                                functions.GEN_SAVE_ERROR_TEXT(binding, 'Benign Histology (73-91) ICD-O-1 - Review')
                        }
                    }
                }
                else {
                    histlimit = 9950
        
                    if (dx_yr >= 1988) {
                        functions.GEN_STRCPY(histbeh, untrimmedline.histologyIcdO1) /* look for Behavior 3 (malignant), first */
                        functions.GEN_STRCAT(histbeh, "3")
        
                        test_is_malignant = functions.GEN_ILOOKUP(histbeh, context.NAACCR_OMORPV88, context.NAACCR_OMORPV88_HISTBEH, [:])
                        if (!test_is_malignant) {
                            functions.GEN_STRCPY(histbeh, untrimmedline.histologyIcdO1)
                            functions.GEN_STRCAT(histbeh, "2")
                            test_is_benign = functions.GEN_ILOOKUP(histbeh, context.NAACCR_OMORPV88, context.NAACCR_OMORPV88_HISTBEH, [:])
        
                            if (test_is_benign) {
                                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Benign Histology (73-91) ICD-O-1 - Review')
                            }
                            else {
                                if ((dx_yr <= 1991) && functions.GEN_INLIST(untrimmedline.histologyIcdO1, "8035,8242,8961,8962,9111,9810,9865,9920"))
                                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Code Deleted from 1986 Field Trial')
                            }
                        }
                    }
                    else {
                        if (dx_yr >= 1986) {
                            functions.GEN_STRCPY(histbeh, untrimmedline.histologyIcdO1) /* look for Behavior 3 (malignant), first */
                            functions.GEN_STRCAT(histbeh, "3")
        
                            test_is_malignant = functions.GEN_ILOOKUP(histbeh, context.NAACCR_OMORPV86, context.NAACCR_OMORPV86_HISTBEH, [:])
                            if (!test_is_malignant) {
                                functions.GEN_STRCPY(histbeh, untrimmedline.histologyIcdO1)
                                functions.GEN_STRCAT(histbeh, "2")
                                test_is_benign = functions.GEN_ILOOKUP(histbeh, context.NAACCR_OMORPV86, context.NAACCR_OMORPV86_HISTBEH, [:])
        
                                if (test_is_benign) {
        
                                    if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                                        functions.GEN_SAVE_ERROR_TEXT(binding, 'Benign Histology (73-91) ICD-O-1 - Review')
                                }
                                else {
                                    if ((dx_yr <= 1987) && functions.GEN_INLIST(untrimmedline.histologyIcdO1, "8035,8242,8961,8962,9111,9810,9865,9920"))
                                        functions.GEN_SAVE_ERROR_TEXT(binding, 'Code Deleted from 1986 Field Trial')
                                }
                            }
                        }
                    }
                }
            }
        }
        if (dx_yr < 1992) {
            if (!functions.GEN_INLIST(untrimmedline.behaviorIcdO1, "2,3")) {
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Behavior Code (73-91) ICD-O-1 not valid')
                morphflg = true
            }
        }
        if (dx_yr < 1992) {
            if (functions.GEN_MATCH(untrimmedline.gradeIcdO1, "(\\d)")) {
                if (functions.GEN_INLIST(untrimmedline.gradeIcdO1, "0,8")) {
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade (73-91) ICD-O-1 not valid')
                    morphflg = true
                }
                else {
                    hist_num = functions.GEN_VAL(untrimmedline.histologyIcdO1)
                    if (functions.GEN_INLIST(untrimmedline.gradeIcdO1, "5,6,7") && (hist_num < 9590 || hist_num > histlimit)) {
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade (73-91) ICD-O-1 not valid')
                        morphflg = true
                    }
                }
            }
            else {
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade (73-91) ICD-O-1 not valid')
                morphflg = true
            }
        }
        morphflg = false
        
        if (functions.GEN_STRCMP(untrimmedline.behaviorIcdO1, "3") == 0) {
            if (functions.GEN_INLIST(untrimmedline.histologyIcdO1, "8331,8851,9511"))
                morphflg = (functions.GEN_VAL(untrimmedline.gradeIcdO1) != 1)
            else {
                if (functions.GEN_INLIST(untrimmedline.histologyIcdO1, "9693"))
                    morphflg = (functions.GEN_INLIST(untrimmedline.gradeIcdO1, "2,3,4,8,9"))
                else {
                    if (functions.GEN_INLIST(untrimmedline.histologyIcdO1, "9083"))
                        morphflg = (functions.GEN_VAL(untrimmedline.gradeIcdO1) != 2)
                    else {
                        if (functions.GEN_INLIST(untrimmedline.histologyIcdO1, "9621,9694"))
                            morphflg = (functions.GEN_INLIST(untrimmedline.gradeIcdO1, "1,3,4,8,9"))
                        else {
                            if (functions.GEN_INLIST(untrimmedline.histologyIcdO1, "9630,9696"))
                                morphflg = (functions.GEN_INLIST(untrimmedline.gradeIcdO1, "1,2,4,8,9"))
                            else {
                                if (functions.GEN_INLIST(untrimmedline.histologyIcdO1, "8020,8021,9062,9082,9401,9451,9512"))
                                    morphflg = (functions.GEN_VAL(untrimmedline.gradeIcdO1) != 4)
                                else {
                                    if (functions.GEN_INLIST(untrimmedline.histologyIcdO1, "9600"))
                                        morphflg = (functions.GEN_INLIST(untrimmedline.gradeIcdO1, "1,2,3,8,9"))
                                }
                            }
                        }
                    }
                }
            }
            if (morphflg == true)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Oldgrade & Oldhist conflict')
        }
        if (functions.GEN_STRCMP(untrimmedline.behaviorIcdO1, "2") == 0) {
            if (functions.GEN_INLIST(untrimmedline.histologyIcdO1, "8000-8004,8020,8021,8331,8332,8523,8524") || functions.GEN_INLIST(untrimmedline.histologyIcdO1, "8543,8800-9054,9062,9082,9083") || functions.GEN_INLIST(untrimmedline.histologyIcdO1, "9110-9491,9501-9960"))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Invalid Oldhist for In Situ')
        }
        return true

    }

    // ID: NAACCR-00811; TAG: N0854; NAME: Morph Coding Sys--Curr, Morph Coding Sys--Orig (NAACCR)
    public boolean naaccr00811(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.morphCodingSysCurrent) || functions.GEN_EMPTY(untrimmedline.morphCodingSysOriginl))
            return true
        if (functions.GEN_INLIST(untrimmedline.morphCodingSysCurrent, "9") || functions.GEN_INLIST(untrimmedline.morphCodingSysOriginl, "9"))
            return true
        if (functions.GEN_STRCMP(untrimmedline.morphCodingSysCurrent, untrimmedline.morphCodingSysOriginl) >= 0)
            return true
        else
            return false
        
        return true

    }

    // ID: NAACCR-00812; TAG: N0054; NAME: Morph Coding Sys--Current (NAACCR)
    public boolean naaccr00812(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.morphCodingSysCurrent, "2-9,A,B,C")

    }

    // ID: NAACCR-00813; TAG: N0855; NAME: Morph Coding Sys--Current, Date of DX (NAACCR)
    public boolean naaccr00813(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (!functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) && !functions.GEN_INLIST(untrimmedline.morphCodingSysCurrent, "7,8,A,B,C"))
            return functions.GEN_ERROR_MSG(binding, 'If Histologic Type ICD-O-3 is not blank, Morph Coding Sys--Current must = 7, 8, A, B, or C')
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (dx_year >= 2022) {
            if (functions.GEN_AT(untrimmedline.morphCodingSysCurrent, "C", 1) == 0)
                return false
            else
                return true
        }
        if (dx_year == 2021) {
            if (functions.GEN_AT(untrimmedline.morphCodingSysCurrent, "B") == 0)
                return false
            else
                return true
        }
        if (dx_year >= 2018 && dx_year < 2021) {
            if (!functions.GEN_INLIST(untrimmedline.morphCodingSysCurrent, "7,8,A"))
                return false
            else
                return true
        }
        if (dx_year > 2009 && dx_year < 2018) {
            if (!functions.GEN_INLIST(untrimmedline.morphCodingSysCurrent, "7,8"))
                return false
            else
                return true
        }
        if (dx_year > 2000) {
            if (!functions.GEN_INLIST(untrimmedline.morphCodingSysCurrent, "7"))
                return false
            else
                return true
        }
        if (dx_year > 1991) {
            if (!functions.GEN_INLIST(untrimmedline.morphCodingSysCurrent, "4,5,6,7"))
                return false
            else
                return true
        }
        if (dx_year > 1987) {
            if (!functions.GEN_INLIST(untrimmedline.morphCodingSysCurrent, "3,4,5,6,7"))
                return false
        }
        return true

    }

    // ID: NAACCR-00814; TAG: N0055; NAME: Morph Coding Sys--Originl (NAACCR)
    public boolean naaccr00814(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.morphCodingSysOriginl))
            return true
        return functions.GEN_INLIST(untrimmedline.morphCodingSysOriginl, "1-9,A,B,C")

    }

    // ID: NAACCR-00815; TAG: N0582; NAME: Morph Coding Sys--Originl, Date of Diagnosis (COC)
    public boolean naaccr00815(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2002) {
            if (functions.GEN_EMPTY(untrimmedline.morphCodingSysOriginl))
                return false
        }
        return true

    }

    // ID: NAACCR-00816; TAG: N0218; NAME: Morphology--Type/Behavior ICDO2 (SEER MORPH)
    public boolean naaccr00816(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int i, borderline_ok
        boolean morphflg
        int dx_year
        char[] histbeh = new char[6]
        
        morphflg = false
        
        if (functions.GEN_EMPTY(untrimmedline.histologyIcdO2))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2000) {
            return true
        }
        if (!functions.GEN_ILOOKUP(untrimmedline.histologyIcdO2, context.NAACCR_HISICDO2, context.NAACCR_HISICDO2_HISTOLOGY, [:])) {
            functions.GEN_SAVE_ERROR_TEXT(binding, 'Histologic Type not valid - ICDO2')
            morphflg = true
        }
        else {
            functions.GEN_STRCPY(histbeh, untrimmedline.histologyIcdO2) /* look for Behavior 3 (malignant, first */
            functions.GEN_STRCAT(histbeh, "3")
        
            if (!functions.GEN_ILOOKUP(histbeh, context.NAACCR_MORPH, context.NAACCR_MORPH_HISTBEH, [:])) {
                functions.GEN_STRCPY(histbeh, untrimmedline.histologyIcdO2)
                functions.GEN_STRCAT(histbeh, "2")
                if (functions.GEN_ILOOKUP(histbeh, context.NAACCR_MORPH, context.NAACCR_MORPH_HISTBEH, [:])) {
                    if (dx_year > 2000 && (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "8931,9393,9538,9950,9960-9962,9980-9984,9989")) && (functions.GEN_INLIST(untrimmedline.behaviorIcdO2, "1")))
                        borderline_ok = 1
                    else {
                        if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                            functions.GEN_SAVE_ERROR_TEXT(binding, 'Benign Histology - Please Review - ICDO2')
                    }
                }
                else {
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Histologic Type not valid - ICDO2')
                    morphflg = true
                }
            }
        }
        if (functions.GEN_MATCH(untrimmedline.grade, "(\\d)")) {
            if (functions.GEN_INLIST(untrimmedline.grade, "0")) {
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade not valid - ICDO2')
                morphflg = true
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.grade, "5,6,7,8") && !functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9590-9941")) {
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade not valid - ICDO2')
                    morphflg = true
                }
            }
        }
        else {
            functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade not valid - ICDO2')
            morphflg = true
        }
        if (morphflg == true) {
            return true /* error flags have been set */
        }
        morphflg = false
        
        if (functions.GEN_STRCMP(untrimmedline.behaviorIcdO2, "3") == 0) {
            if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "8331,8851,9511"))
                morphflg = (functions.GEN_VAL(untrimmedline.grade) != 1)
            else {
                if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9083"))
                    morphflg = (functions.GEN_VAL(untrimmedline.grade) != 2)
                else {
                    if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9696"))
                        morphflg = (functions.GEN_INLIST(untrimmedline.grade, "1,2,4,9"))
                    else {
                        if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "8020,8021,9062,9082,9401,9451,9512"))
                            morphflg = (functions.GEN_VAL(untrimmedline.grade) != 4)
                        else {
                            if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9693"))
                                morphflg = (functions.GEN_INLIST(untrimmedline.grade, "2,3,4,9"))
                        }
                    }
                }
            }
            if (morphflg == true)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade & Histology conflict - ICDO2')
        }
        if (functions.GEN_STRCMP(untrimmedline.behaviorIcdO2, "2") == 0 && !functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3")) {
            if (functions.GEN_INLIST(untrimmedline.histologyIcdO2, "8000-8004,8020-8021,8331-8332") || functions.GEN_INLIST(untrimmedline.histologyIcdO2, "8800-9054,9062-9062,9082-9083") || functions.GEN_INLIST(untrimmedline.histologyIcdO2, "9110-9491,9501-9989"))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Invalid Histology for In Situ - ICDO2')
        }
        return true

    }

    // ID: NAACCR-00818; TAG: N0472; NAME: Morphology--Type/Behavior ICDO3 (SEER MORPH)
    public boolean naaccr00818(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int morphflg, i, benign_ok
        int dx_year
        char[] histbeh = new char[6]
        
        morphflg = 0
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return true
        if (dx_year >= 2018 && functions.GEN_AT(untrimmedline.primarySite, "C723") != 0 && functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "9421") != 0 && functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "1") != 0) {
            return true
        }
        if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NAACCR_HISICDO3, (com.imsweb.validation.entities.ContextTableIndex)context.NAACCR_HISICDO3_HISTOLOGY, untrimmedline.histologicTypeIcdO3, [:]))
            return functions.GEN_ERROR_MSG(binding, 'Histologic Type not valid - ICDO3')
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9597,9688,9712,9724,9725,9726,9735,9737,9738,9759,9806") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9807,9808,9809,9811,9812,9813,9814,9815,9816,9817,9818") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9865,9869,9898,9911,9965,9966,9967,9971,9991,9992")) {
            if (dx_year < 2010)
                return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3 (${untrimmedline.histologicTypeIcdO3}) is not allowed if DX year < 2010')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8343") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
            if (dx_year < 2017) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} with Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} not allowed for diagnosis year < 2017')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8023,8054,8085,8086,8158,8163,8256,8257,8265,8339") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8474,8509,8519,8552,8594,8714,8975,9045,9086,9137,9385") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9395, 9396,9425, 9431, 9432, 9445, 9475, 9476, 9477") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9478, 9509, 9542")) {
            if (dx_year < 2018)
                return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} not allowed if diagnosis year < 2018')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8104,8273,8348,8349,8563,8643,8816,8817,8818,8828") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8992,9126,9138,9211,9212,9213,9222,9563,9715,9749") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9819,9877,9878 9879,9912,9968,9993")) {
            if (dx_year < 2021)
                return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} not allowed if diagnosis year < 2021')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8455,8483,8484,8859,8976,9111,9366,9367,9368")) {
            if (dx_year < 2022)
                return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} not allowed if diagnosis year < 2022')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9751,9831,9975") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
            if (dx_year < 2010) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'If DX year < 2010, Behavior Code ICD-O-3 (${untrimmedline.behaviorCodeIcdO3}) is not allowed for Histologic Type ICD-O-3 (${untrimmedline.histologicTypeIcdO3})')
            }
            if (dx_year >= 2010) {
                if (functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'Over-ride Histology is not required for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}/${untrimmedline.behaviorCodeIcdO3} for Date of Diagnosis: ${untrimmedline.dateOfDiagnosis.formatDate()} and should not be used')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8311,8825,8842,8983,9302,9341") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
            if (dx_year < 2018) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'if DX year < 2018 Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} not allowed for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            }
            if (dx_year >= 2018) {
                if (functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'Over-ride Histology is not required for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}/${untrimmedline.behaviorCodeIcdO3} for Date of Diagnosis: ${untrimmedline.dateOfDiagnosis.formatDate()} and should not be used')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8158,8681,8682,8690,9766") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
            if (dx_year < 2021) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'if DX year < 2021 Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} not allowed for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            }
            if (dx_year >= 2021) {
                if (functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'Over-ride Histology is not required for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}/${untrimmedline.behaviorCodeIcdO3} for Date of Diagnosis: ${untrimmedline.dateOfDiagnosis.formatDate()} and should not be used')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9222") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
            if (dx_year < 2022) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'if DX year < 2022 Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} not allowed for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            }
            if (dx_year >= 2022) {
                if (functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'Over-ride Histology is not required for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}/${untrimmedline.behaviorCodeIcdO3} for Date of Diagnosis: ${untrimmedline.dateOfDiagnosis.formatDate()} and should not be used')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9421")) {
            if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3"))
                return functions.GEN_ERROR_MSG(binding, 'Behavior must be 3 for this histology')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8077")) {
            if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2"))
                return functions.GEN_ERROR_MSG(binding, 'Behavior must be 2 for this histology')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8833, 9260, 9725, 9971") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
            if (dx_year > 2020) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} not allowed if diagnosis year > 2020')
            }
        }
        if (functions.GEN_STRCMP(untrimmedline.behaviorCodeIcdO3, "2") == 0 && !functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3")) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-8005,8020-8021,8331-8332") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8800-9055,9062-9062,9082-9083") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9110-9493,9501-9989"))
                return functions.GEN_ERROR_MSG(binding, 'Invalid Histology for In Situ - ICDO3')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8519") && !functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2"))
            return functions.GEN_ERROR_MSG(binding, 'Behavior must be 2 for this histology')
        if (dx_year >= 2018) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9540") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1"))
                return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} with Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} not allowed for 2018+ diagnosis')
        }
        return true

    }

    // ID: NAACCR-00819; TAG: N0754; NAME: Mult Tum Rpt As One Prim (SEER)
    public boolean naaccr00819(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.multTumRptAsOnePrim))
            return true
        return functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "00,10-12,20,30-32,40,80,88,99", "(\\d\\d)")

    }

    // ID: NAACCR-00820; TAG: N1388; NAME: Mult Tum Rpt As One Prim, Date of DX (CCCR)
    public boolean naaccr00820(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year > 2007) && (dx_year < 2013)) {
            if (functions.GEN_EMPTY(untrimmedline.multTumRptAsOnePrim))
                return false
        }
        if (dx_year < 2008) {
            if (!functions.GEN_EMPTY(untrimmedline.multTumRptAsOnePrim))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis < 2008, then Mult Tum Rpt as One Prim must be blank')
        }
        return true

    }

    // ID: NAACCR-00821; TAG: N0885; NAME: Mult Tum Rpt As One Prim, Date of DX (SEER IF155)
    public boolean naaccr00821(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year > 2006) && (dx_year < 2013)) {
            if (functions.GEN_EMPTY(untrimmedline.multTumRptAsOnePrim))
                return false
        }
        if (dx_year < 2007) {
            if (!functions.GEN_EMPTY(untrimmedline.multTumRptAsOnePrim))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis < 2007, then Mult Tum Rpt as One Prim must be blank')
        }
        return true

    }

    // ID: NAACCR-00822; TAG: N0903; NAME: Mult Tum Rpt As One Prim, Primary Site (NAACCR)
    public boolean naaccr00822(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.multTumRptAsOnePrim))
            return true
        if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "10-12")) {
            if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1"))
                return true
            else
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "31,32")) {
            if (!functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209", "(C\\d\\d\\d)", 2, 3))
                return false
        }
        return true

    }

    // ID: NAACCR-00823; TAG: N0900; NAME: Mult Tum Rpt as One Prim, Date of Mult Tum (NAACCR)
    public boolean naaccr00823(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.multTumRptAsOnePrim))
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateOfMultTumors) && functions.GEN_EMPTY(untrimmedline.dateOfMultTumorsFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "00")) {
            if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "15"))
                return true
            else
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "15")) {
            if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "00"))
                return true
            else
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "88")) {
            if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11"))
                return true
            else
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11")) {
            if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "88"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00824; TAG: N1619; NAME: Mult Tum Rpt, Lymphoma/Leukemia/Unk Site (NAACCR)
    public boolean naaccr00824(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if ((functions.GEN_EMPTY(untrimmedline.multTumRptAsOnePrim)) || (functions.GEN_VAL(untrimmedline.typeOfReportingSource) == 7))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year < 2010) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9992")) || (functions.GEN_INLIST(untrimmedline.primarySite, "809", "(C\\d\\d\\d)", 2, 3))) {
                if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "88"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Mult Tum Rpt as One Prim must = 88')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "88"))
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Mult Tum Rpt as One Prim must not = 88')
            }
            return true
        }
        if (dx_year > 2009) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9751-9758,9765-9769,9970"))
                return true
        }
        if (dx_year == 2010) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9729,9732-9733,9735-9738,9741-9742,9759-9764,9800-9920,9931-9967,9971-9992")) || (functions.GEN_INLIST(untrimmedline.primarySite, "809", "(C\\d\\d\\d)", 2, 3))) {
                if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "88"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Mult Tum Rpt as One Prim must = 88')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "88"))
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Mult Tum Rpt as One Prim must not = 88')
            }
        }
        if (dx_year == 2011) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9729,9735-9738")) && (!functions.GEN_INLIST(untrimmedline.primarySite, "421,770-779", "(C\\d\\d\\d)", 2, 3)))
                return true
        }
        if (dx_year > 2010) {
            if ((functions.GEN_INLIST(untrimmedline.primarySite, "C809")) || ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9729,9735-9738")) && (functions.GEN_INLIST(untrimmedline.primarySite, "421,770-779", "(C\\d\\d\\d)", 2, 3))) || (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9732-9733,9741-9742,9759-9764,9800-9920,9931-9967,9971-9992"))) {
                if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "88"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Mult Tum Rpt as One Prim must = 88')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "88"))
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Mult Tum Rpt as One Prim must not = 88')
            }
        }
        
        return true

    }

    // ID: NAACCR-00825; TAG: N0886; NAME: Multiplicity Cntr, Date of Mult Tum (SEER IF163)
    public boolean naaccr00825(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.multiplicityCounter))
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateOfMultTumors) && functions.GEN_EMPTY(untrimmedline.dateOfMultTumorsFlag))
            return true
        if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "01")) {
            if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "15"))
                return true
            else
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "15")) {
            if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "01"))
                return true
            else
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "88")) {
            if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11"))
                return true
            else
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.dateOfMultTumorsFlag, "11")) {
            if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "88"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00826; TAG: N0901; NAME: Multiplicity Cntr, Mult Tum Rpt as One Prim (NAACCR)
    public boolean naaccr00826(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.multTumRptAsOnePrim) || functions.GEN_EMPTY(untrimmedline.multiplicityCounter))
            return true
        if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "01")) {
            if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "00"))
                return true
            else
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.multTumRptAsOnePrim, "00")) {
            if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "01"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NAACCR-00827; TAG: N0755; NAME: Multiplicity Counter (SEER)
    public boolean naaccr00827(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.multiplicityCounter))
            return true
        return functions.GEN_INLIST(untrimmedline.multiplicityCounter, "00-89,99", "(\\d\\d)")

    }

    // ID: NAACCR-00828; TAG: N1382; NAME: Multiplicity Counter, Date of DX (CCCR)
    public boolean naaccr00828(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year > 2007) && (dx_year < 2013)) {
            if (functions.GEN_EMPTY(untrimmedline.multiplicityCounter))
                return false
        }
        if (dx_year < 2008) {
            if (!functions.GEN_EMPTY(untrimmedline.multiplicityCounter))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis < 2008, then Multiplicity Counter must be blank')
        }
        return true

    }

    // ID: NAACCR-00829; TAG: N0887; NAME: Multiplicity Counter, Date of DX (SEER IF156)
    public boolean naaccr00829(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year > 2006) && (dx_year < 2013)) {
            if (functions.GEN_EMPTY(untrimmedline.multiplicityCounter))
                return false
        }
        if (dx_year < 2007) {
            if (!functions.GEN_EMPTY(untrimmedline.multiplicityCounter))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis < 2007, then Multiplicity Counter must be blank')
        }
        return true

    }

    // ID: NAACCR-00830; TAG: N1615; NAME: Multiplicity Ctr, Lymphoma/Leukem/Unk Site (NAACCR)
    public boolean naaccr00830(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if ((functions.GEN_EMPTY(untrimmedline.multiplicityCounter)) || (functions.GEN_VAL(untrimmedline.typeOfReportingSource) == 7))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NAACCR_GEN_DT_EMPTY))
            return true
        if (dx_year < 2010) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9992")) || (functions.GEN_INLIST(untrimmedline.primarySite, "809", "(C\\d\\d\\d)", 2, 3))) {
                if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "88"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Multiplicity Counter must = 88')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "88"))
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Multiplicity Counter must not = 88')
            }
            return true
        }
        if (dx_year > 2009) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9751-9758,9765-9769,9970"))
                return true
        }
        if (dx_year == 2010) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9729,9732-9733,9735-9738,9741-9742,9759-9764,9800-9920,9931-9967,9971-9992")) || (functions.GEN_INLIST(untrimmedline.primarySite, "809", "(C\\d\\d\\d)", 2, 3))) {
                if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "88"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Multiplicity Counter must = 88')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "88"))
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Multiplicity Counter must not = 88')
            }
        }
        if (dx_year == 2011) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9729,9735-9738")) && (!functions.GEN_INLIST(untrimmedline.primarySite, "421,770-779", "(C\\d\\d\\d)", 2, 3)))
                return true
        }
        if (dx_year > 2010) {
            if ((functions.GEN_INLIST(untrimmedline.primarySite, "C809")) || ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9729,9735-9738")) && (functions.GEN_INLIST(untrimmedline.primarySite, "421,770-779", "(C\\d\\d\\d)", 2, 3))) || (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9732-9733,9741-9742,9759-9764,9800-9920,9931-9967,9971-9992"))) {
                if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "88"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Multiplicity Counter must = 88')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.multiplicityCounter, "88"))
                    return functions.GEN_ERROR_MSG(binding, 'For Date of Diagnosis of ${untrimmedline.dateOfDiagnosis.formatDate()}, Primary Site of ${untrimmedline.primarySite}, Histologic Type ICD-O-3 of ${untrimmedline.histologicTypeIcdO3}, Multiplicity Counter must not = 88')
            }
        }
        
        return true

    }

    // ID: NAACCR-00831; TAG: N0033; NAME: NAACCR Record Version (NAACCR)
    public boolean naaccr00831(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_STRCMP(untrimmedline.naaccrRecordVersion, "220") != 0)
            return false
        return true

    }

    // ID: NAACCR-00832; TAG: N0739; NAME: NHIA Derived Hisp Origin (NAACCR)
    public boolean naaccr00832(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.nhiaDerivedHispOrigin))
            return true
        return functions.GEN_INLIST(untrimmedline.nhiaDerivedHispOrigin, "0-8")

    }

    // ID: NAACCR-00847; TAG: N0876; NAME: NPI--Archive FIN (NAACCR)
    public boolean naaccr00847(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] npi_str = new char[11]
        int i, npi_dig, sum
        
        if (functions.GEN_EMPTY(untrimmedline.npiArchiveFin))
            return true
        if (functions.GEN_MATCH(untrimmedline.npiArchiveFin, "(0000000000)|(9999999999)"))
            return functions.GEN_ERROR_MSG(binding, 'NPI--Archive FIN cannot = 0000000000 or 9999999999')
        if (!functions.GEN_MATCH(untrimmedline.npiArchiveFin, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return functions.GEN_ERROR_MSG(binding, 'NPI--Archive FIN must be a ten-digit number')
        }
        functions.GEN_STRCPY(npi_str, untrimmedline.npiArchiveFin)
        
        sum = 0
        i = 10
        
        while (i != 0) {
            npi_dig = functions.GEN_VAL(functions.GEN_SUBSTR(npi_str, i, 1))
            if ((i % 2) != 0) {
                npi_dig = (npi_dig * 2)
                if (npi_dig > 9)
                    npi_dig = (npi_dig - 9)
            }
            sum = (sum + npi_dig)
            i = (i - 1)
        }
        sum = (sum + 24)
        if ((sum % 10) == 0)
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'NPI--Archive FIN failed the NPI check digit validation')
        
        return true

    }

    // ID: NAACCR-00848; TAG: N0875; NAME: NPI--Following Registry (NAACCR)
    public boolean naaccr00848(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] npi_str = new char[11]
        int i, npi_dig, sum
        
        if (functions.GEN_EMPTY(untrimmedline.npiFollowingRegistry))
            return true
        if (functions.GEN_MATCH(untrimmedline.npiFollowingRegistry, "(0000000000)|(9999999999)"))
            return functions.GEN_ERROR_MSG(binding, 'NPI--Following Registry cannot = 0000000000 or 9999999999')
        if (!functions.GEN_MATCH(untrimmedline.npiFollowingRegistry, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return functions.GEN_ERROR_MSG(binding, 'NPI--Following Registry must be a ten-digit number')
        }
        functions.GEN_STRCPY(npi_str, untrimmedline.npiFollowingRegistry)
        
        sum = 0
        i = 10
        
        while (i != 0) {
            npi_dig = functions.GEN_VAL(functions.GEN_SUBSTR(npi_str, i, 1))
            if ((i % 2) != 0) {
                npi_dig = (npi_dig * 2)
                if (npi_dig > 9)
                    npi_dig = (npi_dig - 9)
            }
            sum = (sum + npi_dig)
            i = (i - 1)
        }
        sum = (sum + 24)
        if ((sum % 10) == 0)
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'NPI--Following Registry failed the NPI check digit validation')
        
        return true

    }

    // ID: NAACCR-00849; TAG: N0873; NAME: NPI--Inst Referred From (NAACCR)
    public boolean naaccr00849(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] npi_str = new char[11]
        int i, npi_dig, sum
        
        if (functions.GEN_EMPTY(untrimmedline.npiInstReferredFrom))
            return true
        if (functions.GEN_MATCH(untrimmedline.npiInstReferredFrom, "(0000000000)|(9999999999)"))
            return functions.GEN_ERROR_MSG(binding, 'NPI--Inst Referred From cannot = 0000000000 or 9999999999')
        if (!functions.GEN_MATCH(untrimmedline.npiInstReferredFrom, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return functions.GEN_ERROR_MSG(binding, 'NPI--Inst Referred From must be a ten-digit number')
        }
        functions.GEN_STRCPY(npi_str, untrimmedline.npiInstReferredFrom)
        
        sum = 0
        i = 10
        
        while (i != 0) {
            npi_dig = functions.GEN_VAL(functions.GEN_SUBSTR(npi_str, i, 1))
            if ((i % 2) != 0) {
                npi_dig = (npi_dig * 2)
                if (npi_dig > 9)
                    npi_dig = (npi_dig - 9)
            }
            sum = (sum + npi_dig)
            i = (i - 1)
        }
        sum = (sum + 24)
        if ((sum % 10) == 0)
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'NPI--Inst Referred From failed the NPI check digit validation')
        
        return true

    }

    // ID: NAACCR-00850; TAG: N0874; NAME: NPI--Inst Referred To (NAACCR)
    public boolean naaccr00850(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] npi_str = new char[11]
        int i, npi_dig, sum
        
        if (functions.GEN_EMPTY(untrimmedline.npiInstReferredTo))
            return true
        if (functions.GEN_MATCH(untrimmedline.npiInstReferredTo, "(0000000000)|(9999999999)"))
            return functions.GEN_ERROR_MSG(binding, 'NPI--Inst Referred To cannot = 0000000000 or 9999999999')
        if (!functions.GEN_MATCH(untrimmedline.npiInstReferredTo, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return functions.GEN_ERROR_MSG(binding, 'NPI--Inst Referred To must be a ten-digit number')
        }
        functions.GEN_STRCPY(npi_str, untrimmedline.npiInstReferredTo)
        
        sum = 0
        i = 10
        
        while (i != 0) {
            npi_dig = functions.GEN_VAL(functions.GEN_SUBSTR(npi_str, i, 1))
            if ((i % 2) != 0) {
                npi_dig = (npi_dig * 2)
                if (npi_dig > 9)
                    npi_dig = (npi_dig - 9)
            }
            sum = (sum + npi_dig)
            i = (i - 1)
        }
        sum = (sum + 24)
        if ((sum % 10) == 0)
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'NPI--Inst Referred To failed the NPI check digit validation')
        
        return true

    }

    // ID: NAACCR-00851; TAG: N0880; NAME: NPI--Physician 3 (NAACCR)
    public boolean naaccr00851(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] npi_str = new char[11]
        int i, npi_dig, sum
        
        if (functions.GEN_EMPTY(untrimmedline.npiPhysician3))
            return true
        if (functions.GEN_MATCH(untrimmedline.npiPhysician3, "(0000000000)|(9999999999)"))
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician 3 cannot = 0000000000 or 9999999999')
        if (!functions.GEN_MATCH(untrimmedline.npiPhysician3, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician 3 must be a ten-digit number')
        }
        functions.GEN_STRCPY(npi_str, untrimmedline.npiPhysician3)
        
        sum = 0
        i = 10
        
        while (i != 0) {
            npi_dig = functions.GEN_VAL(functions.GEN_SUBSTR(npi_str, i, 1))
            if ((i % 2) != 0) {
                npi_dig = (npi_dig * 2)
                if (npi_dig > 9)
                    npi_dig = (npi_dig - 9)
            }
            sum = (sum + npi_dig)
            i = (i - 1)
        }
        sum = (sum + 24)
        if ((sum % 10) == 0)
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician 3 failed the NPI check digit validation')
        
        return true

    }

    // ID: NAACCR-00852; TAG: N0881; NAME: NPI--Physician 4 (NAACCR)
    public boolean naaccr00852(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] npi_str = new char[11]
        int i, npi_dig, sum
        
        if (functions.GEN_EMPTY(untrimmedline.npiPhysician4))
            return true
        if (functions.GEN_MATCH(untrimmedline.npiPhysician4, "(0000000000)|(9999999999)"))
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician 4 cannot = 0000000000 or 9999999999')
        if (!functions.GEN_MATCH(untrimmedline.npiPhysician4, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician 4 must be a ten-digit number')
        }
        functions.GEN_STRCPY(npi_str, untrimmedline.npiPhysician4)
        
        sum = 0
        i = 10
        
        while (i != 0) {
            npi_dig = functions.GEN_VAL(functions.GEN_SUBSTR(npi_str, i, 1))
            if ((i % 2) != 0) {
                npi_dig = (npi_dig * 2)
                if (npi_dig > 9)
                    npi_dig = (npi_dig - 9)
            }
            sum = (sum + npi_dig)
            i = (i - 1)
        }
        sum = (sum + 24)
        if ((sum % 10) == 0)
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician 4 failed the NPI check digit validation')
        
        return true

    }

    // ID: NAACCR-00853; TAG: N0878; NAME: NPI--Physician--Follow-Up (NAACCR)
    public boolean naaccr00853(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] npi_str = new char[11]
        int i, npi_dig, sum
        
        if (functions.GEN_EMPTY(untrimmedline.npiPhysicianFollowUp))
            return true
        if (functions.GEN_MATCH(untrimmedline.npiPhysicianFollowUp, "(0000000000)|(9999999999)"))
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician--Follow-Up cannot = 0000000000 or 9999999999')
        if (!functions.GEN_MATCH(untrimmedline.npiPhysicianFollowUp, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician--Follow-Up must be a ten-digit number')
        }
        functions.GEN_STRCPY(npi_str, untrimmedline.npiPhysicianFollowUp)
        
        sum = 0
        i = 10
        
        while (i != 0) {
            npi_dig = functions.GEN_VAL(functions.GEN_SUBSTR(npi_str, i, 1))
            if ((i % 2) != 0) {
                npi_dig = (npi_dig * 2)
                if (npi_dig > 9)
                    npi_dig = (npi_dig - 9)
            }
            sum = (sum + npi_dig)
            i = (i - 1)
        }
        sum = (sum + 24)
        if ((sum % 10) == 0)
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician--Follow-Up failed the NPI check digit validation')
        
        return true

    }

    // ID: NAACCR-00854; TAG: N0877; NAME: NPI--Physician--Managing (NAACCR)
    public boolean naaccr00854(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] npi_str = new char[11]
        int i, npi_dig, sum
        
        if (functions.GEN_EMPTY(untrimmedline.npiPhysicianManaging))
            return true
        if (functions.GEN_MATCH(untrimmedline.npiPhysicianManaging, "(0000000000)|(9999999999)"))
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician--Managing cannot = 0000000000 or 9999999999')
        if (!functions.GEN_MATCH(untrimmedline.npiPhysicianManaging, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician--Managing must be a ten-digit number')
        }
        functions.GEN_STRCPY(npi_str, untrimmedline.npiPhysicianManaging)
        
        sum = 0
        i = 10
        
        while (i != 0) {
            npi_dig = functions.GEN_VAL(functions.GEN_SUBSTR(npi_str, i, 1))
            if ((i % 2) != 0) {
                npi_dig = (npi_dig * 2)
                if (npi_dig > 9)
                    npi_dig = (npi_dig - 9)
            }
            sum = (sum + npi_dig)
            i = (i - 1)
        }
        sum = (sum + 24)
        if ((sum % 10) == 0)
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician--Managing failed the NPI check digit validation')
        
        return true

    }

    // ID: NAACCR-00855; TAG: N0879; NAME: NPI--Physician--Primary Surg (NAACCR)
    public boolean naaccr00855(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] npi_str = new char[11]
        int i, npi_dig, sum
        
        if (functions.GEN_EMPTY(untrimmedline.npiPhysicianPrimarySurg))
            return true
        if (functions.GEN_MATCH(untrimmedline.npiPhysicianPrimarySurg, "(0000000000)|(9999999999)"))
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician--Primary Surg cannot = 0000000000 or 9999999999')
        if (!functions.GEN_MATCH(untrimmedline.npiPhysicianPrimarySurg, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician--Primary Surg must be a ten-digit number')
        }
        functions.GEN_STRCPY(npi_str, untrimmedline.npiPhysicianPrimarySurg)
        
        sum = 0
        i = 10
        
        while (i != 0) {
            npi_dig = functions.GEN_VAL(functions.GEN_SUBSTR(npi_str, i, 1))
            if ((i % 2) != 0) {
                npi_dig = (npi_dig * 2)
                if (npi_dig > 9)
                    npi_dig = (npi_dig - 9)
            }
            sum = (sum + npi_dig)
            i = (i - 1)
        }
        sum = (sum + 24)
        if ((sum % 10) == 0)
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'NPI--Physician--Primary Surg failed the NPI check digit validation')
        
        return true

    }

    // ID: NAACCR-00856; TAG: N0871; NAME: NPI--Registry ID (NAACCR)
    public boolean naaccr00856(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] npi_str = new char[11]
        int i, npi_dig, sum
        
        if (functions.GEN_EMPTY(untrimmedline.npiRegistryId))
            return true
        if (functions.GEN_MATCH(untrimmedline.npiRegistryId, "(0000000000)|(9999999999)"))
            return functions.GEN_ERROR_MSG(binding, 'NPI--Registry ID cannot = 0000000000 or 9999999999')
        if (!functions.GEN_MATCH(untrimmedline.npiRegistryId, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return functions.GEN_ERROR_MSG(binding, 'NPI--Registry ID must be a ten-digit number')
        }
        functions.GEN_STRCPY(npi_str, untrimmedline.npiRegistryId)
        
        sum = 0
        i = 10
        
        while (i != 0) {
            npi_dig = functions.GEN_VAL(functions.GEN_SUBSTR(npi_str, i, 1))
            if ((i % 2) != 0) {
                npi_dig = (npi_dig * 2)
                if (npi_dig > 9)
                    npi_dig = (npi_dig - 9)
            }
            sum = (sum + npi_dig)
            i = (i - 1)
        }
        sum = (sum + 24)
        if ((sum % 10) == 0)
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'NPI--Registry ID failed the NPI check digit validation')
        
        return true

    }

    // ID: NAACCR-00857; TAG: N0872; NAME: NPI--Reporting Facility (NAACCR)
    public boolean naaccr00857(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] npi_str = new char[11]
        int i, npi_dig, sum
        
        if (functions.GEN_EMPTY(untrimmedline.npiReportingFacility))
            return true
        if (functions.GEN_MATCH(untrimmedline.npiReportingFacility, "(0000000000)|(9999999999)"))
            return functions.GEN_ERROR_MSG(binding, 'NPI--Reporting Facility cannot = 0000000000 or 9999999999')
        if (!functions.GEN_MATCH(untrimmedline.npiReportingFacility, "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return functions.GEN_ERROR_MSG(binding, 'NPI--Reporting Facility must be a ten-digit number')
        }
        functions.GEN_STRCPY(npi_str, untrimmedline.npiReportingFacility)
        
        sum = 0
        i = 10
        
        while (i != 0) {
            npi_dig = functions.GEN_VAL(functions.GEN_SUBSTR(npi_str, i, 1))
            if ((i % 2) != 0) {
                npi_dig = (npi_dig * 2)
                if (npi_dig > 9)
                    npi_dig = (npi_dig - 9)
            }
            sum = (sum + npi_dig)
            i = (i - 1)
        }
        sum = (sum + 24)
        if ((sum % 10) == 0)
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'NPI--Reporting Facility failed the NPI check digit validation')
        
        return true

    }

    // ID: NAACCR-00858; TAG: N0209; NAME: Name--Alias (SEER)
    public boolean naaccr00858(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.nameAlias))
            return true
        if (!functions.GEN_MATCH(untrimmedline.nameAlias, "([A-Za-z](([A-Za-z])|(\\s)|(\\-)|('))*)"))
            return false
        return true

    }

    // ID: NAACCR-00859; TAG: N0152; NAME: Name--First (SEER)
    public boolean naaccr00859(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.nameFirst))
            return true
        if (!functions.GEN_MATCH(untrimmedline.nameFirst, "([A-Za-z](([A-Za-z])|(\\s)|(\\-)|('))*)"))
            return false
        return true

    }

    // ID: NAACCR-00860; TAG: N1431; NAME: Name--First (NPCR)
    public boolean naaccr00860(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (!functions.GEN_MATCH(untrimmedline.nameFirst, "([A-Za-z](([A-Za-z])|(\\s)|(\\-)|('))*)"))
            return false
        return true

    }

    // ID: NAACCR-00861; TAG: N0155; NAME: Name--Last (NPCR)
    public boolean naaccr00861(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.nameLast))
            return false
        if (!functions.GEN_MATCH(untrimmedline.nameLast, "([A-Za-z](([A-Za-z])|(\\s)|(\\-)|('))*)"))
            return false
        return true

    }

    // ID: NAACCR-00862; TAG: N0265; NAME: Name--Maiden (SEER)
    public boolean naaccr00862(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.nameMaiden))
            return true
        if (!functions.GEN_MATCH(untrimmedline.nameMaiden, "([A-Za-z](([A-Za-z])|(\\s)|(\\-)|('))*)"))
            return false
        return true

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy