```python

def code_valid(code: str, length: int) -> bool:
    if length <= 0:
        raise ValueError("Length must be greater than zero.")
    
    return len(set(code)) == len(code) and code.isupper()
```