|
|
| Author |
Message |
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 82 Location: Chennai - India
|
|
|
|
Hi Frank,
Thanks a lotttttttttttttt.. really i got shocked when i saw ur reply.... ur explainaton was superb....
For me today is holiday, so i will try it 16th August and let u know my status....
Meanwhile i will just go thru ur code and if i have any doubts, i will post it... i just worked in IMS DB, and COBOL.... but not in SORT utilities... thats the reason i couldnot able to catch what u have posted.... Thanks again Frank.....
Regards,
Sasikumar 'Franks is greattttttttttt' |
|
| Back to top |
|
 |
References
|
|
 |
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 82 Location: Chennai - India
|
|
|
|
Hi Frank,
Just gone thru ur code....
I have few doubts, and here are they...
BUILD=(1,4,5:C'1',6:SEQNUM,8,ZD,14:5))
OVERLAY=(5:C'9',6:SEQNUM,8,ZD))
OPTION EQUALS,VLSHRT
I dont understand all the above lines..
One more doubt... With this code my output file contains records of both input files and at end only two trailer records having sum of the records in count field. Why i am asking was i dont understand anything just seeing the code to come up an assumption that i get my required output...
Dont mistake me that i am asking many questions... i am not much good in SORT and other JCL utilities... But now started learning... |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4687 Location: San Jose, CA
|
|
|
|
| Quote: |
| One more doubt... With this code my output file contains records of both input files and at end only two trailer records having sum of the records in count field. Why i am asking was i dont understand anything just seeing the code to come up an assumption that i get my required output... |
Yes, that's what the output will contain ... it's what you asked for. When I tested the job with P'3' for the count in the two input file1 trailer records and P'4' for the count in the two input file2 trailer records, the result had the data records from file1, followed by the data records from file2, followed by two output file trailer records with P'7' for the count.
Here's an explanation of how the job works. Note that I'm showing the count as readable as you did for illustration, but according to what you said, it's really an unreadable PD value.
| Code: |
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:C'1',6:SEQNUM,8,ZD,14:5)),
IFTHEN=(WHEN=(43,8,CH,EQ,C'ssssssss'),
OVERLAY=(5:C'9',6:SEQNUM,8,ZD))
|
This builds a merge key by reformatting the input file1 records to look like this in the T1 data set:
| Code: |
merge--key
|RDW|1|00000001|kjfhsdkjyfpwfdfnkdfklsdhfsldjhf
|RDW|1|00000002|kjfsyfduysdfoiysjfsdhfksdhfsdhffsjdhf
|RDW|1|00000003|uqynwnddskjdhasjdhapduasduapo
|RDW|1|00000004|dashdjshadljsdhladhdasdaew
|RDW|9|00000001|triler records ssssssss 4 trailer recrod
|RDW|9|00000002|triler records ssssssss 4 trailer recrod
|
| Code: |
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:C'2',6:SEQNUM,8,ZD,14:5)),
IFTHEN=(WHEN=(43,8,CH,EQ,C'ssssssss'),
OVERLAY=(5:C'9',6:SEQNUM,8,ZD))
|
This reformats the input file2 records to look like this in the T2 data set:
| Code: |
merge--key
|RDW|2|00000001|ehjqwhejkhwkjqnmansasadasdmn
|RDW|2|00000002|dmsandkjsadkjsdjkdsadasdasdasdsadsd
|RDW|2|00000003|dsjhadksjhdkjsahdkjsadhkjashdkjs
|RDW|9|00000001|triler records ssssssss 3 trailer recrod
|RDW|9|00000002|triler records ssssssss 3 trailer recrod
|
Now we can use the merge key in the reformatted records to MERGE the T1 and T2 files with these control statements:
| Code: |
MERGE FIELDS=(5,9,ZD,A)
OPTION EQUALS,VLSHRT
SUM FIELDS=(53,6,PD)
OUTFIL BUILD=(1,4,5:14)
|
5.9,ZD,A merges on the merge key. EQUALS ensures that the trailer records are merged in their original order. So the merged records look like this:
| Code: |
merge--key
|RDW|1|00000001|kjfhsdkjyfpwfdfnkdfklsdhfsldjhf
|RDW|1|00000002|kjfsyfduysdfoiysjfsdhfksdhfsdhffsjdhf
|RDW|1|00000003|uqynwnddskjdhasjdhapduasduapo
|RDW|1|00000004|dashdjshadljsdhladhdasdaew
|RDW|2|00000001|ehjqwhejkhwkjqnmansasadasdmn
|RDW|2|00000002|dmsandkjsadkjsdjkdsadasdasdasdsadsd
|RDW|2|00000003|dsjhadksjhdkjsahdkjsadhkjashdkjs
|RDW|9|00000001|triler records ssssssss 4 trailer recrod
|RDW|9|00000001|triler records ssssssss 3 trailer recrod
|RDW|9|00000002|triler records ssssssss 4 trailer recrod
|RDW|9|00000002|triler records ssssssss 3 trailer recrod
|
Notice the pairs of trailer records have duplicate merge keys of 900000001 for the first pair and 900000002 for the second pair. So these are the only pairs of records that are summed by the SUM statement. The counts for each pair are added and only one record of the pair is kept, resulting in two trailer records with the total count in each:
| Code: |
|RDW|9|00000001|triler records ssssssss 7 trailer recrod
|RDW|9|00000002|triler records ssssssss 7 trailer recrod
|
VLSHRT is needed to ensure that we do not terminate due to "short" records for the SUM statement (that is, records shorter than 58 bytes).
Finally, the OUTFIL statement removes the merge key from each record, so SORTOUT has:
| Code: |
|RDW|kjfhsdkjyfpwfdfnkdfklsdhfsldjhf
|RDW|kjfsyfduysdfoiysjfsdhfksdhfsdhffsjdhf
|RDW|uqynwnddskjdhasjdhapduasduapo
|RDW|dashdjshadljsdhladhdasdaew
|RDW|ehjqwhejkhwkjqnmansasadasdmn
|RDW|dmsandkjsadkjsdjkdsadasdasdasdsadsd
|RDW|dsjhadksjhdkjsahdkjsadhkjashdkjs
|RDW|triler records ssssssss 7 trailer recrod
|RDW|triler records ssssssss 7 trailer recrod
|
I hope this helps. |
|
| Back to top |
|
 |
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 82 Location: Chennai - India
|
|
|
|
Thanks a lot for ur explaination Frank..... i will be using this tomorrow.....
Once again thanks a lotttttttttt....
Ur great... |
|
| Back to top |
|
 |
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 82 Location: Chennai - India
|
|
|
|
Hi Frank,
please check my input file record in the attachment i did in previous message, with the code you have provided i got output like merged both the files just like it...
After the first file records just second file records are merged... So first first file trailer record has come just before second file records and second file trailer record has come at end of the file.. and the sum of the records also not done... please see my input...
attachment removed and needs to be re-posted with copy/paste rather than "screenshot". |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 9214 Location: 221 B Baker St
|
|
|
|
Hello,
Your "screenshot" has been deleted.
Please re-post using copy/paste and the "Code" tag (near the top of the Reply editor). You can use Preview to see how your post will appear to the forum , then click Submit whan you are satisfied with the way your post appears. |
|
| Back to top |
|
 |
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 82 Location: Chennai - India
|
|
|
|
Hi Dick,
Thanks for ur reply...
Oh god, i couldnot get the screen shot until monday...
Before deleting u could have sent it atleast to Frank.... I thought of showing that to him and clear my doubts....
Its ok... on monday i will repost it... |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 9214 Location: 221 B Baker St
|
|
|
|
Hello Sasikumar,
| Quote: |
| Oh god, i couldnot get the screen shot until monday... |
Sorry about that
Saw you had posted recently and thought you would simply re-post.
If i knew how to turn the posted image into text, i would have. . .
d |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4687 Location: San Jose, CA
|
|
|
|
Sasikumar,
The DFSORT job I posted gets the output you asked for with the input you showed and the "rules" you gave me. If you're not getting the correct output, then either your input is not what you showed, or you changed my job in some way. So you need to post the complete source for your job, all of the DFSORT messages you received in //TOOLMSG. //DFSMSG and //SYSOUT, and the input and output records. If you prefer, you can send these to me offline (yaeger@us.ibm.com) as plain text files. If you send it offline, put "DFSORT" somewhere in your Subject line to catch my attention. |
|
| Back to top |
|
 |
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 82 Location: Chennai - India
|
|
|
|
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
----+----F----+----F----+----F----+----F----+----F----+----F----+----F----+----F
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
------------------------------------------------------------------------------
6677...FB555 .. D.G.....ð........bq...ØØ.XXX.V64VZAP .ØØ.rrræ..
FFFF203CCFFF4444004444C0C0000180000000089232881DDD0EFFEECD42881999900
548804C6212500000C000040700105C0000000C284C000C963035459170000C999C00
------------------------------------------------------------------------------
........................FINAN TRANS RECORD FILE 00HVA5PB01DN.ØØ.........ÄhÌÎ.
000000000000000000000000CCDCD4EDCDE4DCCDDC4CCDC4FFCECFDCFFCD2881000020006877344
000000000000000000000000695150391520953694069350008515720145000C00041C003886C00
------------------------------------------------------------------------------
........................FINAN TRANS RECORD FILE 00HVA5PB01DN.ØØ.........ÄhÌÎ.
FFFFFFFFFFFFFFFFFFFFFFFFCCDCD4EDCDE4DCCDDC4CCDC4FFCECFDCFFCD2881000020006877344
FFFFFFFFFFFFFFFFFFFFFFFF695150391520953694069350008515720145000C00041C003886C00
------------------------------------------------------------------------------ |
Frank,
That is the file... I will post the Qn bit later... I just want show u the file... |
|
| Back to top |
|
 |
arcvns
Senior Member
Joined: 17 Oct 2006 Posts: 997 Location: Chennai, India
|
|
|
|
| Quote: |
| I will post the Qn bit later |
Does this have anything to do with the actual requirement you posted?
Thanks,
Arun |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4687 Location: San Jose, CA
|
|
|
|
| Quote: |
Frank,
That is the file... I will post the Qn bit later... I just want show u the file...
|
I don't know which file that is (actually, it's only partial records from a file) or how it relates to your original request, my solution or your "problem". I don't know what Qn is.
At this point, if you want my help on this, I need you to send me all of the information I requested earlier as attached plain text files in an e-mail (yaeger@us.ibm.com). Please do not post that information here. Put "DFSORT" in your Subject line to catch my attention.
. |
|
| Back to top |
|
 |
|
|
|