View previous topic :: View next topic |
Author |
Message |
Anand_R Intermediate
Joined: 24 Dec 2002 Posts: 189 Topics: 60
|
Posted: Thu Nov 13, 2003 2:12 pm Post subject: Changed data in output file |
|
|
Hi everyone,
I have 2 files of LREC = 3000. I want to compare the first record in first file with first record in 2nd file. Then write the changed(modified) data in the output file(If any). Is it possible by any sort utility.
Example
Input File 1:
12345ABCDEFGfalse.
Input File 2:
12345ABCEDFGtrue.
Output file :
ABCEDFGtrue.
(first 5 bytes should be spaces.. as there was no data change).. I want out put also in the same format as input(But only modified data in the output)
Please let me know if I am not clear enough...
Actually my input file is very big enough(3000 bytes).
Thanks
Anand |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Thu Nov 13, 2003 2:27 pm Post subject: |
|
|
I think, ISRSUPC (=3.13) is a better option here.
Nevertheless, what would you do if the number of records in the datasets are unequal? _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Nov 13, 2003 2:59 pm Post subject: |
|
|
Anand,
A couple of questions. Do you want to compare each and every byte of lrecl 3000? Do you have a key to compare?
The hardest part would getting only the differences(modified data) in the output record.
Do you have easytrieve at your shop?
cogito: Superc is not ideal tool for comparing files with lrecl greater than 250.
Hope this helps...
cheers
kolusu |
|
Back to top |
|
|
Anand_R Intermediate
Joined: 24 Dec 2002 Posts: 189 Topics: 60
|
Posted: Thu Nov 13, 2003 3:03 pm Post subject: |
|
|
Kolusu,
Thanks for your reply... I have to compare each and every byte. And I have easy treive in my shop..
Thanks
Anand |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Thu Nov 13, 2003 3:24 pm Post subject: |
|
|
Why is it so, Kolusu?
I quickly skimmed the manual. But, I do not see this written explicitly anywhere. _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Nov 13, 2003 4:27 pm Post subject: |
|
|
Anand,
The following JCl will give you the desired results.A brief explanation of the Job. The jobs reads in both the files and then takes each record from both the files and compares it against each and every byte in both records. If they differ then we write it out to the output record.
Code: |
//STEP0100 EXEC PGM=EZTPA00
//STEPLIB DD DSN=EASYTREV.LOADLIB,
// DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSSNAP DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//INFILE1 DD DSN=YOUR INPUT FILE1,
// DISP=SHR
//INFILE2 DD DSN=YOUR INPUT FILE2,
// DISP=SHR
//OUTPUT DD DSN=YOUR OUTPUT FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE),
// DCB=(LRECL=3000,RECFM=FB,BLKSIZE=0)
//SYSIN DD *
FILE INFILE1
IN-REC1 01 01 A OCCURS 3000
FILE INFILE2
IN-REC2 01 01 A OCCURS 3000
FILE OUTPUT FB(0 0)
OUT-REC 01 01 A OCCURS 3000
W-SUB W 04 N
S-WRITE-OUTPUT W 01 A
***********************************************************************
* MAINLINE *
***********************************************************************
JOB INPUT NULL
GET INFILE1
GET INFILE2
DO WHILE INFILE1
S-WRITE-OUTPUT = 'N'
W-SUB = 1
DO UNTIL W-SUB GT 3000
IF IN-REC1 (W-SUB) = IN-REC2 (W-SUB)
OUT-REC (W-SUB) = ' '
ELSE
S-WRITE-OUTPUT = 'Y'
OUT-REC(W-SUB) = IN-REC2 (W-SUB)
END-IF
W-SUB = W-SUB + 1
END-DO
IF S-WRITE-OUTPUT = 'Y'
PUT OUTPUT
END-IF
GET INFILE1
GET INFILE2
END-DO
STOP
//*
|
Hope this helps...
cheers
kolusu
Cogito: Superc is not a good tool for comparing datasets with lrecl greater than 250 is due to the truncation in the outputlisting. The max output listing you can have is only 205 or something , don't remember the exact length. |
|
Back to top |
|
|
Anand_R Intermediate
Joined: 24 Dec 2002 Posts: 189 Topics: 60
|
Posted: Fri Nov 14, 2003 2:58 pm Post subject: |
|
|
Kolusu,
Actually my input file have all types of data(char, integer, & comp).. Does ur solution work in that case?
Thanks
Anand |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Fri Nov 14, 2003 3:34 pm Post subject: |
|
|
Anand,
Why don't your test it for yourself and let me know if it works for the scenario you mentioned?
Thanks
Kolusu |
|
Back to top |
|
|
raveendra_ibm Beginner
Joined: 02 Apr 2006 Posts: 32 Topics: 10
|
Posted: Thu Apr 06, 2006 11:52 am Post subject: |
|
|
Hi Kolusu !
Refering the code above, Is the comparision based on a key ?
How different is it from File - Aid ? Could you please explain.
Thanks and Regards,
Raveendra. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Apr 06, 2006 12:01 pm Post subject: |
|
|
Quote: |
Refering the code above, Is the comparision based on a key ?
How different is it from File - Aid ? Could you please explain
|
raveendra_ibm,
If you have read the posts clearly you would have found this
Quote: |
The jobs reads in both the files and then takes each record from both the files and compares it against each and every byte in both records. If they differ then we write it out to the output record.
|
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
raveendra_ibm Beginner
Joined: 02 Apr 2006 Posts: 32 Topics: 10
|
Posted: Thu Apr 06, 2006 12:55 pm Post subject: |
|
|
Hi Kolusu,
Sorry...... missed that.
Thanks,
Raveendra. |
|
Back to top |
|
|
|
|