If you are talking about SORT statements generally, then yes, the SORT product you use is not directly driven by the order in which you write statements.
Try SUM FIELDS=NONE followed by SORT FIELDS=(1,10,CH,A). Etc. The order things will be processed in is documented for DFSORT. Have a look at your documentation for Syncsort.
If it is the IFTHENs you are wondering about, the order of the different types of IFTHEN is important (and documented for DFSORT). Where you have IFTHEN like your exampled, the order processed will not make a difference as they are mutually exclusive.
If not mutually exclusive, only the first test can be true, unless HIT=NEXT is specified (for DFSORT anyway).
If none of the above provides you with an answer or is unclear, ask the question in a better way.
I was talking about SORT control statments only (INREC,OUTREC, OUTFIL, SORT, INCLUDE). Thanks for the answer. So, even the SORT control statements are not as per the standard order (except END), SORT will re-arrange them.
AFAIK Within a single BUILD, the value of SEQNUM would be the same. Since you are writing only two records, for sure the numbers are known to you - '001' and '002', why don't you hard-code the numbers?
I never know whether my input will have 1 or 100 similiar keys. So, I can't hard code the Seq Num
If that is the case, even if 100 similar keys are there, your OUTFIL will generate only 2 records since you have only one '/' in it. I wonder how you are gonna attach those 100 sequence numbers to just 2 records.!!
It would be better if you explain your requirement clearly before we proceed any further