sort write statement