by Aki88 » Mon Jul 04, 2016 9:08 pm
Hello,
In-line with what Mr. myers and Mr. Sample have said, you will need a 'utility' which 'can be executed' through a JCL to achieve what you want done; termminology is very important here.
<long post on>
Aside, there are multiple solutions to the problem, each depending upon your programming proficiency, be it a REXX solution or others.
A very simple way (with few more steps than required) would be, use *SORT to generate 3 output datasets using OUTFIL-FILES-INCLUDE options, in INCLUDE add your test conditions of 'A', 'M' or 'W'. If 'A' is present write this one record to datasets with names DSA, else DSM else DSW (or whatever you fancy). This is your first JCL step.
Next, have three IDCAMS/*SORT steps, which test if the earlier created datasets - DSA/DSM/DSW are empty or have atleast one record; depending upon this criteria, set a return code for these three steps; ideally only one of three datasets will have data at any time; hence an RC=0 (or your choice again till the time it adheres to RC rules for the utility) for this step, rest steps will have an RC=4/8/12 etc, your choice.
Next step- have an IF-THEN-ELSE JCL construct, which tests the RC set in the earlier steps, and executes PROC1/2/3 conditionally.
Simple, straight-forward solution, but requires more number of steps to achieve (though, can be done with fewer steps).
Note: Please understand that you haven't specified how many records there can be in your input dataset, you have also not specified if there can be multiple records having - 'A', 'M' or 'W' in the same dataset, or will there be only one, nor have you specified the RECFM/LRECL of your input datasets; there are more points which are also missed out in the request post, but these are the bare minimum required to cook up a working solution. I have assumed that your input DS has only 1 record, which has the control information on column- 71; if it is otherwise, the solution will/can change; though I'll leave it to you to to figure that one out.
</long post off>
Hope this helps.
- These users thanked the author Aki88 for the post:
- Namrata_Singri (Tue Jul 05, 2016 4:46 pm)