I've a requireent, I have done some research with help of google but couldn't get any proper solution, could some one help me on!
Requirement: There are 3 datasets,dataset1 : is having one key row(Value1/Value2/value3). Datasets2/3/4: have data i.e many records which need to be write into the output/another dataset based on value present in first dataset key.
Suppose - case 1: if dataset1.value = Value1 then write dataset2 records into another/output dataset. Case 2: if dataset1.value = Value2 then write dstaset3 records into another/output dataset. Case 3: if dataset1.value = Value3 then write dataset4 records into another/output dataset.
Seems like using RC code, we can achive above requiremnt but not sure until i test. hence if anyone knows any other way of doing it, please help me
Editd - changed 'file' to 'dataset' many times. corrected spelling
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
Your requirement is not particularly clear. I can guess but we do not deal in guesses. Show us example data of what you mean - using the code tags to preserve spacing.
Don't know how to use the code tags? Search the forum or, more easily, use the full editor for your post.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Gunapala CN,
Welcome to the forums! How many output files ('another/output dataset') do you have? As suggested by Nic, use "Code" tags in the editor to post sample data and/or JCL. You can use the preview button to make sure it looks the way you expect, before submitting.
sorry for putting plain problem statement in front of you!
My requirement would be like below -
File1 will be having data/record :OFF/ON/TRIAL
File 2 will be having records eg :AAAAAAAA and many more
File3 will be having records eg: BBBBBBBB and many more
File 4 will be having records eg:CCCCCCCC and many more
File 5 will be the Output file :
what i need to here is that :
if File1 record = OFF
File 2 data is need to populate into Output file i.e. File5
else If File1 record =ON
File 3 data is need to be populate into the same File5 file
else
if File1 Record = TRAIL
File4 data is need to be populate into the same File5 file.
end if
Note : i know this scenarios we can handle it in Cobol but we would like try wthr its possible do it with complete JCL/SORT CARDS help. Also with help of RC(return codes , explicit SET in previous step based on condition) we can achieve. we are trying out this.
...
Note : i know this scenarios we can handle it in Cobol but we would like try wthr its possible do it with complete JCL/SORT CARDS help. Also with help of RC(return codes , explicit SET in previous step based on condition) we can achieve. we are trying out this.
Not sure if this is an assignment or an actual PRODuction scenario, if it is, then whoever thought of an all *SORT solution is off their pills.
Fwiw, because you haven't defined any specific rules for this task- well, here goes nothing:
a. Have a simple SORT FIELDS=COPY for FILE1 (and it is dataset, not file), have 3 OUTFIL statements for your OUTPUT dataset.
b. In each OUTFIL statement test using INCLUDE for the flags you have in FILE1.
c. If the respective flag matches, write a simple JCL in that OUTFIL, using BUILD, within this JCL, override the dataset names- you can either hard-code the name, or go a step ahead and use SYMNAMES here and pass symbolic values for DSNs you want.
d. Route the 3 OUTFIL DS to INTRDR in SORTOUT DD names.
Now, what is going to happen is, depending on WHAT your flag value is, a fresh JCL will be created and submitted, within which DS2 to DS5 and so on will get processed - individually.
Like I'd said earlier - you didn't define the rules clearly here, so this solution does get the job done - fairly easily.
Note: I have used FILE2, FILE3, FILE4 as instream data, because I don't know whether you have a unique identifier for each file.
If you have the unique identifier for each file, then you may use that in IFTHEN=(WHEN=GROUP,BEGIN/KEYBEGIN=.. and remove FILE1,FILE2,FILE3 instream data
Welcome!!
1.You could have finished coding + testing in 1 hour, if you have done through COBOL or any other known language to you and whoever forcing you to do through DFSORT should be asked for justifications else should quit the job.
2.Now coming to your original post, (Value1/Value2/value3) are they mutually exclusive? if so then you can set the RC accordingly (which you already know/told) in previous step and in next step you can pick dataset based on RC.
3.Abid Hasan has a nice suggestion too but why make things complex when you know COBOL is easiest and simple to code and maintain.
I agree with you, this is not forced do it from some one! Just I am curious to know any other way of doing it.
As you told we can do it by having RC code set in previous step since those three values are constant always. Actually those I'm fetching from table in previous step by passing key and these are expect to be same all time.
Comming to have cobol module for this problem statement is not suggestable, if we can achieve using sort utilities which are in hand. And as you know, maintaining or implementing cobol changes to live is not easy as compare to jcls changes.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Gunapala CN wrote:
Comming to have cobol module for this problem statement is not suggestable, if we can achieve using sort utilities which are in hand. And as you know, maintaining or implementing cobol changes to live is not easy as compare to jcls changes.
I don't know how you arrived at such a 'conclusion'. Reading a one record data set and issuing a return-code/copying other files is so difficult to maintain and implement in COBOL? May be the definition of 'easy' for you might be different from the vast majority. Did you realize that the DFSORT 'solution' is processing through all the 3 input data sets, where your original requirement was to copy only one of these? And you '#ignore' waste of resources. Good luck.
"When all you have is a hammer, everything looks like a nail"
Comming to have cobol module for this problem statement is not suggestable, if we can achieve using sort utilities which are in hand. And as you know, maintaining or implementing cobol changes to live is not easy as compare to jcls changes.
I don't know how you arrived at such a 'conclusion'. Reading a one record data set and issuing a return-code/copying other files is so difficult to maintain and implement in COBOL? May be the definition of 'easy' for you might be different from the vast majority. Did you realize that the DFSORT 'solution' is processing through all the 3 input data sets, where your original requirement was to copy only one of these? And you '#ignore' waste of resources. Good luck.
Yup Agreed!! Regarding 'conclusion' process which follow to new amendments to existing modules and jcls are likely to be different and it's different across project to project... Anyway the topic is not that here...
But few ppl responses to the request is seems to be not fine because you can't decide someone capability just like that and none of our job here.. Ppl can ignore such request which incomplete or may ask for repost it rather than talking in bad manner. Also I understand other ppl time so I alway gfeatful for that!
Don't take it personally Gunapala but people here have tremendous knowledge and hands on and based on that they comment and advise so if we are at the receiving end of the HELP then one should be submissive and obliged by accepting the way they advise us and most importantly take that in positive way. Btw, COBOL is easy for maintenance than anything. I see this topic is getting locked soon.
Don't take it personally Gunapala but people here have tremendous knowledge and hands on and based on that they comment and advise so if we are at the receiving end of the HELP then one should be submissive and obliged by accepting the way they advise us and most importantly take that in positive way. Btw, COBOL is easy for maintenance than anything. I see this topic is getting locked soon.
Hi Sir
You are right, Yes i've got many approaches to do my tasks now. I'm sure at least one of those will work out esle I will go with cobol which is completely easy to me as well.
Thanks a lot.. Soon will be comming with new doubts with complete information