Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
Hi,
Input1 - FB, 11 Bytes, First 1 to 8 Key Field, last 3 bytes are ZD data.
Input2 - FB, 11 Bytes, First 1 to 8 Key Field, last 3 bytes are zeros(ZD format)
Both inputs wont have duplicates and sorted on Key Fileld (1 to 8 Bytes)
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
Hi Kolusu,
Thanks for your reply.
I guess I have not explained the requirement clear.
I want matched records and unmatched records from File 2, ie, Input2. No need to get unmatched records from File 1, ie, Input1.
For matched records, the last three bytes should be from File 1, ie, Input1. In fact, there is no need to SUM since all the records in File2, ie, Input2 will have zeros in the last 3 bytes.
anshul_gugnani,
I am sure Frank or Kolusu can give you better insight but here is what I thought.
Question on your sort card and probably that might help clear some clouds.
What will be the value of F1 fields in your REFORMAT FIELDS if the there is no matching records in File1? In the other words for what will be the value for File1 fields for the Unique F2 records?
If my understanding is correct, it will be BLANKS (X'40') and then your IFTHEN condition would fail.
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
Thank you, Kolusu.
It worked as expected for the above requirement.
I tried to implement the same for other set.
Input1 record will have key, amount along with some Headers.
I need to extract the records from Input1 based on below condition.
First byte should be numeric 1 to 9 and 9 to 12 bytes should be greater than zero. And SUM the field - 55 to 62 bytes, PD Field based on Key field(1 to 8 bytes)
Input2 will have only 8 bytes key field.
Compare the above formatted Input1 record with Input2, if it is matched, write the amount(SUMmed field above), if not matched, have amount field as zeros in output.
At last, I should have all the records from Input2. If a input2 record is matched with input1 record, get the amount(SUMmed field above), if not matched, have amount field as zeros in output.
Input1(RA), FB, Length=216 Bytes, Key --> 1 to 8 bytes
Code:
SNG945345......
0934 .....
4345 .....
J3434....
G3556....
SJ.......
123456780000........AAAAAAAA
123456780008........00000001(It is PD field - 55 to 62 bytes, Length - 8 bytes - I showed it as ZD here)
123456780009........00000002(It is PD field - 55 to 62 bytes, Length - 8 bytes - I showed it as ZD here)
555555550000........GGGGGGGG
555555550002........00000001(It is PD field - 55 to 62 bytes, Length - 8 bytes - I showed it as ZD here)
555555550009........00000002(It is PD field - 55 to 62 bytes, Length - 8 bytes - I showed it as ZD here)
555555550009........00000009(It is PD field - 55 to 62 bytes, Length - 8 bytes - I showed it as ZD here)
666666660000........SSSSSSSS
666666660001........00000007(It is PD field - 55 to 62 bytes, Length - 8 bytes - I showed it as ZD here)
666666660002........00000008(It is PD field - 55 to 62 bytes, Length - 8 bytes - I showed it as ZD here)
999999990000........JJJJJJJJ
999999990006........00000001(It is PD field - 55 to 62 bytes, Length - 8 bytes - I showed it as ZD here)
Input2(AC), FB, Length=8 Bytes, Key --> 1 to 8 bytes
1234567800000003(It is PD field - 9 to 16 bytes, Length - 8 bytes - I showed it as ZD here)
2222222200000000(It is PD field - 9 to 16 bytes, Length - 8 bytes - I showed it as ZD here)
4444444400000000(It is PD field - 9 to 16 bytes, Length - 8 bytes - I showed it as ZD here)
5555555500000012(It is PD field - 9 to 16 bytes, Length - 8 bytes - I showed it as ZD here)
8888888800000000(It is PD field - 9 to 16 bytes, Length - 8 bytes - I showed it as ZD here)
9999999900000001(It is PD field - 9 to 16 bytes, Length - 8 bytes - I showed it as ZD here)
I tried below steps, But is giving JCL error while running STEP15. In fact, STEP05 and STEP10 are successful.
Code:
IEF212I jobname STEP15 SORTIN +002 - DATA SET NOT FOUND
IEF272I jobname STEP15 - STEP WAS NOT EXECUTED.
The above input-output samples already contain a record where file2 key does not match with file1 key. And when I tried my sort card with above sample it gave output as needed.
And if the first IFTHEN fails then I think it goes for IFTHEN condition with WHEN=NONE.
anshul_gugnani,
Sorry I didn't check WHEN=NONE condition and yes to me I does satisfy the requirements. But hey, I am not a genious like Frank or Kolusu.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
Sorry I didn't check WHEN=NONE condition
You only need to use WHEN=NONE if you need to change the record when it doesn't meet the previous conditions. If you are just going to write the record as is in that case, you don't need WHEN=NONE.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
anshul_gugnani wrote:
Hello Frank,
Thanks, So the sort card which I posted for the above requirement is correct?
Anshul gugani,
There is a reason as to why a JOINKEYS solution isn't posted. If you have read OP's initial post , he mentioned that he does NOT have the latest PTF which supports Joinkeys. If you want a joinkeys solution open another topic and continue with your questions.
Gnana Sekaran Nallathambi wrote:
I need to get all the records from Input2 and if any record matches with input1, sum of last 3 bytes should be in output record.
ICETOOL is in my installation with ICE201I F RECORD TYPE ...
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Gnana Sekaran Nallathambi,
You just can't apply the same logic of concatenating the header for every other requirement. In your first requirement you have both input files of the same LRECL and hence the header solution would be an optimal solution.
The second requirement is totally different. It deals with 2 different LRECL datasets and the output LRECL is also different. In this case the concatenating of header record solution is plain useless. Also notice how I used the referback to use the header dataset once again. Try to understand the JCL and change it according to your requirements.