View previous topic :: View next topic
|
Author |
Message |
faizm
New User
Joined: 13 Apr 2012 Posts: 59 Location: India
|
|
|
|
Hi All,
I have two input files (file1 and file2) of same LRECL but number of records could be different in both files i.e file2 may have more records than file1 . First field in both files is an that reflects whether it is changed record (C) or new added record (A) indicator field.
My requirement is basically
1. If any of the field is mismatched in both files then write the record in new output file and insert an indicator C(change) in first field.
2. If it is totally a new record (additional records in file 2) then write these new records from file 2 and insert an indicator A(add) in first field.
3. If record matches then don't write in output file.
Ex: I in below records is indicator field.
input file1 has 3 records
IABCD
IEFGH
IIJKL
input file 2 has 4 records
IABCD
IEFGK
IIJKL
IMNOP
Result should be:
CEFGK
AMNOP
Please reply how we can implement it using SORT. Thanks. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Could you please confirm the product you use? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Do none of the other JOINKEY examples in the forum help you on this? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
are You telling that the key is from column 2 for three bytes ? |
|
Back to top |
|
|
faizm
New User
Joined: 13 Apr 2012 Posts: 59 Location: India
|
|
|
|
Just to give some more information. LRECL of both the files are 200 and the key in both the files start at 11 and end at 20 that is key length is 10 char. Now if there is a way I can compare the two files and write the records in a new file. I am trying JOINKEYS.
Can anybody provide me the psuedo code and help me with the tutorial location as well so that I can go and read the syntax etc.
Also, how much it will be feasible (taking CPU time in consideration) to compare the files using JCL when the number of records are 10 lakhs around. Or should I go and write a program to read both the files and compare each values present in them.
Thanks for reply. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Quote: |
compare the files using JCL |
JCL cannot do this - it only tells the system what programs you want to run and what resources are required by those programs.
Syncsort documentation is only available to licensed sites so you should ask around your shop for copies. a good place for examples is within this section of the forum - do a search on JOINKEYS.
To compare files why not use the facilities available to you - sepcifically SUPERC which can be run in both background (batch) or foreground. Your site may have another compare tool e.g. Comparex but you will have to ask around your colloeagues. |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 158 Location: Kuala Lumpur
|
|
|
|
Faizm,
As per the example given,I assumed your LRECL=5 and RECFM=FB.
Key field = 1,4 . Data=5th column.
Code: |
//SORT EXEC PGM=SORT
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(1,4,A)
JOINKEYS F2=IN2,FIELDS=(1,4,A)
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F1:1,5,F2:1,5)
OPTION COPY
OUTREC IFTHEN=(WHEN=(1,4,CH,EQ,6,4,CH,AND,5,1,CH,NE,10,1,CH),
BUILD=(1:C'C',7,4)),
IFTHEN=(WHEN=(1,4,CH,NE,6,4,CH),
BUILD=(1:C'A',7,4))
OUTFIL OMIT=(1,5,CH,EQ,6,5,CH)
//SYSOUT DD SYSOUT=*
//IN1 DD *
IABCD
IEFGH
IIJKL
//IN2 DD *
IABCD
IEFGK
IIJKL
IMNOP |
Output is:
There might be simplest way to achieve this. But I just tried to get the desire output. May be Bill/Kolusu will clear your clarification if you have any.
Note: I feel this Topic should be moved to DFSORT. |
|
Back to top |
|
|
faizm
New User
Joined: 13 Apr 2012 Posts: 59 Location: India
|
|
|
|
Thanks Suresh and everyone to help me out |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Quote: |
Note: I feel this Topic should be moved to DFSORT.
|
Why? Nowhere has OP stated, or inferred, that they are using DFSort and, in fact, refused to say which product was being used despite multiple requests. Syncsort lives in JCL (for some strange reason) so it has to be assumed, unless otherwise stated, that the product in question is Syncsort |
|
Back to top |
|
|
faizm
New User
Joined: 13 Apr 2012 Posts: 59 Location: India
|
|
|
|
Nic,
We are using SYNCSORT. I just mention that if we can solve the problem through JCL (and need not to write any cobol pgm) that was just to check if we can use any utility programs like SORT. Thanks.
Regards |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Please note that you are not solving the problem "through jcl". When running in batch JCL will be used whether you you use a utility program or a program written in the language of your choice. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I just mention that if we can solve the problem through JCL |
Just curious, just why does someone believe you can do this "with JCL"?
Most of your contrymen understand they are running a utility with JCL (i.e. batch) and use the correct terminology when talking about it.
Somewhere there, clueless trainers and/or managers have taught this. . .
People who use this terminology just demonstrate that they do not have the slightest grasp of their working environment. |
|
Back to top |
|
|
|