def validate(value, row):
    var = row['cseqnumx']
    if not var:
        return 999

    if len(var) > 3:
        log.write('cseqnum', [row['id'], var, 'SEQNUM length gt 3. Truncating'])
    
    try:
        return int(var[:3])
    
    except ValueError:
        log.write('cseqnum', [row['id'], var, 'Invalid seqnum (string)'])
        return 999