Hi,
I am trying to compare data from two different physical files. Both the files are in the same format but from two different systems. I need a report or a file which compares the data in both the files and report the differences in a report or a physical file. Any toughts on this. I already tried the CMPPFM and TAATOOL CMPDBF but both didnt worked out.
Software/Hardware used:
ASKED:
February 10, 2009 6:42 PM
UPDATED:
February 12, 2009 8:38 PM
Hi, with the wrkQry you can do that. Just define those two files in that and common fields, if there is any difference it picks up all those records in the Query. Let me know if you need more info on this.
Hi,
You say CMPPFM didn’t work out. In what way ? Is it because the files are physically on 2 different systems ?
I have a tool for using CMPPFM between systems – unfortunately it needs to copy the file to the local system using DDM so it’s not quick if you have big files.
CMD Source
CMD PROMPT('Compare remote member') PARM KWD(LCLFILE) TYPE(QUAL1) MIN(1) + PROMPT('Local file') PARM KWD(LCLMBR) TYPE(*CHAR) LEN(10) MIN(1) + PROMPT('Local member name') PARM KWD(RMTFILE) TYPE(QUAL2) MIN(1) + PROMPT('Remote file') PARM KWD(RMTMBR) TYPE(*CHAR) LEN(10) MIN(1) + PROMPT('Remote member name') PARM KWD(SYSTEM) TYPE(*CHAR) LEN(15) MIN(1) + PROMPT('System name or IP address') PARM KWD(CMPTYPE) TYPE(*CHAR) LEN(5) RSTD(*YES) + DFT(*LINE) VALUES(*LINE *FILE *WORD) + PROMPT('Compare type') PARM KWD(RPTTYPE) TYPE(*CHAR) LEN(8) RSTD(*YES) + DFT(*DIFF) VALUES(*DIFF *SUMMARY *CHANGE + *DETAIL) PROMPT('Report type') PARM KWD(OUTPUT) TYPE(*CHAR) LEN(8) RSTD(*YES) + DFT(*) VALUES(* *PRINT *OUTFILE) + PROMPT('Output') PARM KWD(OUTFILE) TYPE(QUAL3) PROMPT('Output file') QUAL1: QUAL TYPE(*NAME) LEN(10) MIN(1) QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) + SPCVAL((*CURLIB) (*LIBL)) PROMPT('Library') QUAL2: QUAL TYPE(*NAME) LEN(10) MIN(1) QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) + SPCVAL((*CURLIB) (*LIBL)) PROMPT('Remote Library') QUAL3: QUAL TYPE(*NAME) LEN(10) QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) + SPCVAL((*CURLIB) (*LIBL)) PROMPT('Library')CL Source
PGM PARM(&QUAL1 &LCLMBR &QUAL2 &RMTMBR &SYSTEM + &CMPTYPE &RPTTYPE &OUTPUT &QUAL3) DCL VAR(&QUAL1) TYPE(*CHAR) LEN(20) DCL VAR(&LCLLIB) TYPE(*CHAR) LEN(10) DCL VAR(&LCLFIL) TYPE(*CHAR) LEN(10) DCL VAR(&LCLMBR) TYPE(*CHAR) LEN(10) DCL VAR(&QUAL2) TYPE(*CHAR) LEN(20) DCL VAR(&RMTLIB) TYPE(*CHAR) LEN(10) DCL VAR(&RMTFIL) TYPE(*CHAR) LEN(10) DCL VAR(&RMTMBR) TYPE(*CHAR) LEN(10) DCL VAR(&SYSTEM) TYPE(*CHAR) LEN(15) DCL VAR(&CMPTYPE) TYPE(*CHAR) LEN(5) DCL VAR(&RPTTYPE) TYPE(*CHAR) LEN(8) DCL VAR(&OUTPUT) TYPE(*CHAR) LEN(8) DCL VAR(&QUAL3) TYPE(*CHAR) LEN(20) DCL VAR(&OUTFIL) TYPE(*CHAR) LEN(10) DCL VAR(&OUTLIB) TYPE(*CHAR) LEN(10) DCL VAR(&QUALRMTFIL) TYPE(*CHAR) LEN(40) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(512) DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR)) CHGVAR VAR(&LCLFIL) VALUE(%SST(&QUAL1 1 10)) CHGVAR VAR(&LCLLIB) VALUE(%SST(&QUAL1 11 10)) CHGVAR VAR(&RMTFIL) VALUE(%SST(&QUAL2 1 10)) CHGVAR VAR(&RMTLIB) VALUE(%SST(&QUAL2 11 10)) CHGVAR VAR(&OUTFIL) VALUE(%SST(&QUAL3 1 10)) CHGVAR VAR(&OUTLIB) VALUE(%SST(&QUAL3 11 10)) CHGVAR VAR(&QUALRMTFIL) VALUE(&RMTLIB *TCAT '/' + *TCAT &RMTFIL *TCAT '(' *TCAT &RMTMBR + *TCAT ')') DLTF FILE(QTEMP/CMPRMTMBR) MONMSG MSGID(CPF0000) DLTF FILE(QTEMP/CMPRMTMBRX) MONMSG MSGID(CPF0000) CRTDDMF FILE(QTEMP/CMPRMTMBR) RMTFILE(*NONSTD + &QUALRMTFIL) RMTLOCNAME(&SYSTEM) + TEXT('Compare Remote Members DDMFile') CPYF FROMFILE(QTEMP/CMPRMTMBR) + TOFILE(QTEMP/CMPRMTMBRX) FROMMBR(&RMTMBR) + TOMBR(&RMTMBR) CRTFILE(*YES) IF COND(&OUTPUT ¬= '*OUTFILE') THEN(DO) CMPPFM NEWFILE(&LCLLIB/&LCLFIL) NEWMBR(&LCLMBR) + OLDFILE(QTEMP/CMPRMTMBRX) OLDMBR(*FIRST) + CMPTYPE(&CMPTYPE) RPTTYPE(&RPTTYPE) + OUTPUT(&OUTPUT) ENDDO IF COND(&OUTPUT = '*OUTFILE') THEN(DO) CMPPFM NEWFILE(&LCLLIB/&LCLFIL) NEWMBR(&LCLMBR) + OLDFILE(QTEMP/CMPRMTMBRX) OLDMBR(*FIRST) + CMPTYPE(&CMPTYPE) RPTTYPE(&RPTTYPE) + OUTPUT(&OUTPUT) OUTFILE(&OUTLIB/&OUTFIL) ENDDO DLTF FILE(QTEMP/CMPRMTMBR) MONMSG MSGID(CPF0000) DLTF FILE(QTEMP/CMPRMTMBRX) MONMSG MSGID(CPF0000) GOTO CMDLBL(ENDPGM) ERROR: RCVMSG MSGTYPE(*LAST) MSGDTA(&MSGDTA) MSGID(&MSGID) + MSGF(&MSGF) MSGFLIB(&MSGFLIB) SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) + MSGDTA(&MSGDTA) ENDPGM: ENDPGMHope this helps…
Regards,
Martin Gilbert.
Badically I was trying to compare the object and source change dates on two different systems. I did a DSPOBJD on both the systems and got the two files on the same system using NetFile transfer. Now I need to compare the two files. I tried CMPPFM but it is returning me lots of junk values like some special characters.
That’s entirely different. Something like Query should do it.
Only one problem if your looking for object in either list that don’t exist in the other then you will need two queries.
Hi,
If you have 2 files output from DSPOBJD and need to compare the object and source change dates, then Query is going to be the way to go. CMPPFM is for comparing the raw data in the file, it doesn’t take into account field names in the way that you want.
Create a query, use WRKQRY – option 1. In file selections specify both your DSPOBJD files (use F9 to add the second file). Specify matched records (this will join the records from one file to the other). For the fields used to join, specify T01.ODLBNM EQ T02.ODLBNM and T01.ODOBNM EQ T02.ODOBNM. In select and sequence fields, choose the fields that you want to see from both DSPOBJD files. I would suggest the following :-
T01.ODLBNM
T01.ODOBNM
T01.ODOBTP
T01.ODOBAT
T01.ODOBTX
T01.ODSRCD
T01.ODSRCT
T01.ODLDAT
T01.ODLTIM
T02.ODSRCD
T02.ODSRCT
T02.ODLDAT
T02.ODLTIM
Then specify your record selections, something like this should give every non matching object/source date/time :-
T01.ODSRCD NE T01.ODSRCD OR T01.ODSRCT NE T01.ODSRCT OR T01.ODLDAT NE T01.ODLDAT OR T01.ODLTIM NE T01.ODLTIMSet your output type to be display or printer or file (whichever you want). and run the query…
Regards,
Martin Gilbert.
I suspect your are doing this to verify your production objects match the source change date. You will need member information from the source files so do DSPFD *MBRLIST to an outfile and dspobd of your pgm objects to an outfile and query using member name to match pgm name then compare last change date for the member vs. creation date for the objects…….if that’s what you’re trying to accomplish.