whenever there is 'A' in 10th pos, output rec's 20th position shud be '1'.
whenever there is 'B' in 15th pos, output rec's 20th position shud be '2'.
whenever there is 'A' in 10th pos & 'B' in 15th pos., 2 recs shud be written to output, with 1 rec's 20th position shud be '1' and other record's 20th pos. shud be '2'.
SEQNR's has to be added at the end and shud be restarted whenever there is a change in pos 1-4
RECFM for I/P & O/P files is FB.
Assume LRECL for both files to be 80.
SORT Product : SYNCSORT FOR Z/OS 1.3.0.2R
Code:
INPUT:-
----+----1----+----2----+
1234 A
5678 A B
9012 B
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
I'm not exactly sure what you mean.
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.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Rajesh,
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 Nums. The thing which I have given is an example of the issue I was facing...
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Quote:
I never know whether my input will have 1 or 100 similiar keys. So, I can't hard code the Seq Num
Rajesh,
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