Page 1 of 1
What is WHEN=INIT and WHEN= GROUP in JCL sort
Posted: Tue Apr 25, 2023 8:42 pm
by Sunil Hyderbad
Hi,
What is WHEN=INIT and WHEN= GROUP in JCL sort.
Could someone please guide.
Re: What is WHEN=INIT and WHEN= GROUP in JCL sort
Posted: Tue Apr 25, 2023 9:03 pm
by Robert Sample
From the
z/OS DFSORT: Getting Started manual:
WHEN=INIT: Use one or more WHEN=INIT clauses to apply BUILD, FINDREP or OVERLAY items to all of your input records. WHEN=INIT clauses and WHEN=GROUP clauses are processed before any of the other IFTHEN clauses.
WHEN=GROUP: Use one or more WHEN=GROUP clauses to propagate fields, identifiers and sequence numbers within groups of records. You define the records that belong to a group using an appropriate combination of BEGIN=(logexp), END=(logexp), KEYBEGIN=(field) and RECORDS=n parameters.
Re: What is WHEN=INIT and WHEN= GROUP in JCL sort
Posted: Tue May 02, 2023 8:18 pm
by Sunil Hyderbad
Thank you Robert.
I looked at that definition myself too, but I fail to understand it. I was not able to understand what makes a group, INIT is possibly when the first expression met.
Re: What is WHEN=INIT and WHEN= GROUP in JCL sort
Posted: Tue May 02, 2023 8:49 pm
by Robert Sample
You define the records that belong to a group using an appropriate combination of BEGIN=(logexp), END=(logexp), KEYBEGIN=(field) and RECORDS=n parameters.
A group is whatever you need it to be -- it could be based upon the values in a particular column or columns, for example.
WHEN=INIT applies to all the records, while WHEN=GROUP only applies to those records which meet the criteria you've established.
Re: What is WHEN=INIT and WHEN= GROUP in JCL sort
Posted: Mon Jun 05, 2023 6:42 pm
by Sunil Hyderbad
Thanks Robert.