public Parser sortStatement() {
        if (sortStatementParser == null) {
           FutureParser future = scoped("sortStatement");
           sortStatementParser = future;
           future.setParser(
               choice(
                   sequence(
                       token("SORT"),
                       fileName(),
                       plus(
                           sequence(
                               token("ON"),
                               plus(
                                   sequence(
                                       choice(
                                           token("ASCENDING"),
                                           token("DESCENDING")
                                       ),
                                       optional(
                                           token("KEY")
                                       ),
                                       optional(
                                           token("IS")
                                       ),
                                       plus(
                                           qualifiedDataName()
                                       )
                                   )
                               )
                           )
                       ),
                       optional(
                           sequence(
                               optional(
                                   token("WITH")
                               ),
                               token("DUPLICATES"),
                               optional(
                                   sequence(
                                       token("IN"),
                                       token("ORDER")
                                   )
                               )
                           )
                       ),
                       optional(
                           sequence(
                               optional(
                                   token("COLLATING")
                               ),
                               token("SEQUENCE"),
                               optional(
                                   token("IS")
                               ),
                               alphabetName()
                           )
                       ),
                       choice(
                           sequence(
                               token("INPUT"),
                               token("PROCEDURE"),
                               optional(
                                   token("IS")
                               ),
                               procedureName(),
                               optional(
                                   sequence(
                                       choice(
                                           token("THROUGH"),
                                           token("THRU")
                                       ),
                                       procedureName()
                                   )
                               )
                           ),
                           sequence(
                               token("USING"),
                               plus(
                                   fileName()
                               )
                           )
                       ),
                       choice(
                           sequence(
                               token("OUTPUT"),
                               token("PROCEDURE"),
                               optional(
                                   token("IS")
                               ),
                               procedureName(),
                               optional(
                                   sequence(
                                       choice(
                                           token("THROUGH"),
                                           token("THRU")
                                       ),
                                       procedureName()
                                   )
                               )
                           ),
                           sequence(
                               token("GIVING"),
                               plus(
                                   fileName()
                               )
                           )
                       )
                   ),
                   sequence(
                       token("SORT"),
                       dataName(),
                       plus(
                           sequence(
                               token("ON"),
                               plus(
                                   sequence(
                                       choice(
                                           token("ASCENDING"),
                                           token("DESCENDING")
                                       ),
                                       optional(
                                           token("KEY")
                                       ),
                                       optional(
                                           token("IS")
                                       ),
                                       plus(
                                           qualifiedDataName()
                                       )
                                   )
                               )
                           )
                       ),
                       optional(
                           sequence(
                               optional(
                                   token("WITH")
                               ),
                               token("DUPLICATES"),
                               optional(
                                   sequence(
                                       token("IN"),
                                       token("ORDER")
                                   )
                               )
                           )
                       ),
                       optional(
                           sequence(
                               optional(
                                   token("COLLATING")
                               ),
                               token("SEQUENCE"),
                               optional(
                                   token("IS")
                               ),
                               alphabetName()
                           )
                       )
                   )
               )
           );
        }

        return sortStatementParser;
    }