Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
Hi Kiran,
Again there is discrepancy between what you are saying now and what you said earlier.
Now you say (2,9) of file1, but as per your sample input file 1, SSN starts at 11th byte.
Also you say (5,9) of file2, but as per your sample input file 1, SSN starts at 11th byte.
Please provide correct information in order forum members to help you.
Sorry for the discrepany.Actually the inputs were just an example.
Later when I looked into my actual inputs, I found SSNs positions differ.
Now I m putting in actual scenario below.Please accept this and provide me JCL for this.
Details are below:
Input file1
Code:
I SSN NAME DEPT
2 0001 NICK 20
4 0005 LOE 30
3 0002 POLO 87
6 0004 PHIL 76
7 9898 JACK 87
Input file2
Code:
YEAR SSN NAME MTOT M1 M2 D1 D2
2008 0002 POLO 200 78 76 43 65
2008 0004 PHIL 345 98 80 13 45
2008 9898 JACK 987 78 89 23 24
If (3,4) of file1 = (6,4) of file2 then I would like to append (20,11) of file2 to end of record file1
If (3,4) of file1 is not equal to (6,4) of file2 then I would like to write
only the record of file1 to output file
I want the records to be sorted on SSNs
The output file should look like below
Code:
I SSN NAME DEPT M1 M2 D1 D2
2 0001 NICK 20
3 0002 POLO 87 78 76 43 65
6 0004 PHIL 76 98 80 13 45
4 0005 LOE 30
7 9898 JACK 87 78 89 23 24
I feel sorry for the discrepancies before.
And please let me know if you need any other information.
ParagChouguley wrote:
Hi Kiran,
Again there is discrepancy between what you are saying now and what you said earlier.
Now you say (2,9) of file1, but as per your sample input file 1, SSN starts at 11th byte.
Also you say (5,9) of file2, but as per your sample input file 1, SSN starts at 11th byte.
Please provide correct information in order forum members to help you.
Can you please tell me how the below sort card SRT1CNTL works.
Code:
SRT1CNTL DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=(3,3,CH,EQ,C'SSN'), ----->If I m not wrong, it should be (WHEN=(3,4,CH,EQ,C'SSN')---and please tell me how it works
BUILD=(C'1AA',1,16,12X)),
IFTHEN=(WHEN=NONE,
BUILD=(C'2AA',1,16,12X))
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Parag,
You cannot use the OUTREC statement with SPLICE - you need to use the OUTFIL statement. You used the OUTREC statement in your first example and I corrected it. In hindsight, I suppose it would have better if I'd deleted your post and posted the correct solution myself since you've posted an incorrect DFSORT job again. Unless you're using an old version of DFSORT, you would have gotten an error message when you used the OUTREC statement. So I suspect you're using Syncsort, not DFSORT. Is that true? I don't know if Syncsort actually allows the OUTREC statement or just doesn't flag it as an error, but DFSORT does flag it as an error. If you're using Syncsort, I wish you wouldn't post in the DFSORT Forum as you're just confusing people and making more work for me.
Quote:
Now here comes the role of Frank, as I too am unaware about internal details of DFSORT/ICETOOL.
The use of OUTFIL statement rather than the OUTREC statement with SPLICE is not an internal detail. It's an external detail - it's documented in the DFSORT books and an error message is produced when you use it. If you don't know the external details of DFSORT and you're NOT using DFSORT, then why are you posting in the DFSORT Forum?
Quote:
I guess FIELDS doesn't work with OUTFIL. Instead use OUTFIL BUILD=
BUILD can be used with INREC, OUTREC or OUTFIL. FIELDS can be used with INREC and OUTREC, but not with OUTFIL. OUTREC can be used with OUTFIL, but not with INREC or OUTREC. I recommend the use of BUILD since it can be used with all three statements (that's why I added it to DFSORT).
Quote:
Could you please help me with this.
Kiran,
Well, I wanted to help you with your question from the beginning, but Parag and other people kept answering and you kept directing your questions to them, so I stayed out of it. I'll read through it all later today and see if I can figure out what you want and give you a solution and explanations.
Everyone,
I really would prefer that people let the two DFSORT developers (Kolusu and I) who participate on this board every day answer the DFSORT questions in the DFSORT Forum. I know that other people who respond are just trying to help, but their responses actually result in more work for us and often just confuse people.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Kiran,
Well, as it turns out the DFSORT/ICETOOL job you need is much simpler than Parag's job. Here are two jobs, one of which should do what you asked for. The first job assumes the headers are NOT actually in the input files and are NOT needed in the output file. The second job assumes the headers are in the input files and are needed in the output file.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I assumed both input files have RECFM=FB.
Both of my jobs work fine when I run them here. So something is different for you that's causing the error message.
You haven't given me anything to work with to figure out what you're doing different. I don't even know which job you used or which operator you received that message for.
You need to send me more information offline (yaeger@us.ibm.com) so I can figure out what you're doing. Send me your complete JCL and control statements, and the complete set of //TOOLMSG and //DFSMSG messages you receive when you run the job. Include the ICExxxs prefixes for the messages (e.g. ICE201I).
Please put "DFSORT" somewhere in the Subject line of your e-mail to catch my attention.
Sorry for the late response.
The JCL provided by you is working fine.
Thanks a lot.
But there is slight change in my requirement.
File 1:
Code:
2 0001 NICK 20
4 0005 LOE 30
3 0002 POLO 87
6 0004 PHIL 76
7 9898 JACK 87
File 2:
Code:
2008 0002 POLO 200 78 76 43 65
2008 0004 PHIL 345 98 80 13 45
2008 0003 MIKE 876 87 09 98 12
2008 0008 GEOR 879 90 20 12 89
2008 9898 JACK 987 78 89 23 24
If (3,4) of file1 = (6,4) of file2 then I would like to append (21,11) of file2 to the end of first file record and that record needs to be written to output file.
If (3,4) of first file is not equal to (6,4) of second file then I would like to write only the record of file1 to output file.
OUTPUT should look like below:
Code:
I SSN NAME DEPT M1 M2 D1 D2
2 0001 NICK 20
3 0002 POLO 87 78 76 43 65
6 0004 PHIL 76 98 80 13 45
4 0005 LOE 30
7 9898 JACK 87 78 89 23 24
Awaiting quick reply.
Frank Yaeger wrote:
Kiran,
Well, as it turns out the DFSORT/ICETOOL job you need is much simpler than Parag's job. Here are two jobs, one of which should do what you asked for. The first job assumes the headers are NOT actually in the input files and are NOT needed in the output file. The second job assumes the headers are in the input files and are needed in the output file.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Huh? What exactly is the slight change in your requirement? Is it just that you want to use 21,11 now vs 20,11 before? If so, you just need to change the 20 to a 21 in the CTL2CNTL INREC statement (you mean you couldn't figure that out?). Or is it something else?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Based on the private message you sent me offline, I believe this DFSORT job will do what you want. I didn't add the headers - you can do that yourself.