Paul,
Qshell has the cmp command for just this purpose.
Here's a CLP example where the file names are hard coded and I just send an *INFO msg to demonstrate but you could execute whatever you like.
PGM
DCL &FILE1 *CHAR 50 VALUE('/tmp/tstfile1.txt')
DCL &FILE2 *CHAR 50 VALUE('/tmp/tstfile2.txt')
DCL &CMD *CHAR 128
DCL &MSGID *CHAR 7
DCL &MSGDTA *CHAR 4
CHGVAR &CMD ('cmp -s' *BCAT &FILE1 *BCAT &FILE2)
QSH CMD(&CMD)
RCVMSG MSGTYPE(*COMP) MSGDTA(&MSGDTA) MSGID(&MSGID)
IF (&MSGID=QSH0005 *AND %BIN(&MSGDTA)=1 ) DO
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Files are different')
ENDDO
ENDPGM
Peter
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of A Paul
Sent: Sunday, 21 July 2013 1:08 a.m.
To: Midrange Systems Technical Discussion
Subject: Flat file comparision
Below is my code
IF COND(Z10_A = 'ADMFILE' & Z10_B = &LIB) THEN(DO)
ALCOBJ OBJ((Z10_B/Z10_A *FILE *EXCL)) WAIT(500)
MONMSG MSGID(CPF1002 CPF1085) EXEC(GOTO CMDLBL(RETRY))
CALL PGM(ADMPGMC)
CLRPFM FILE(&LIB/ADM.FILE)
MONMSG MSGID(CPF3142) EXEC(CRTPF FILE(&LIB/ADM.FILE)
CPYF FROMFILE(&LIB/ADMFILE) TOFILE(&LIB/ADM.FILE) MBROPT(*REPLACE)
COMMANDC P1(ADM.FILE) P2(&LIB)
DLTF FILE(&LIB/ADMFILE)
ENDDO
I receive a flat file by name ADMFILE into AS/400, This flat file does not contain any date in it. I apply the contents of the file(to my in house files) by calling an internal program. I copy the contents of the file into another file (flat file in our system contain dot)and delete it.
What I am trying to do is compare the file as soon as it received with previous day file and if both are same send an email alert ( if both are different dont do anything and go to next step) and if the file is not received by certain time send an email alert.
I am looking for AS/400 utility(or if any code) that does the job and also open for suggestions to change my existing code. I need to keep check for the file for an hour time and send an alert as well.
Thanks
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
#####################################################################################
This correspondence is for the named person's use only. It may contain confidential
or legally privileged information, or both. No confidentiality or privilege is waived
or lost by any mistransmission. If you receive this correspondence in error, please
immediately delete it from your system and notify the sender. You must not disclose,
copy or rely on any part of this correspondence if you are not the intended recipient.
Any views expressed in this message are those of the individual sender, except where
the sender expressly, and with authority, states them to be the views of Veda.
If you need assistance, please contact Veda on either :-
Australia 1300-762-207 or New Zealand +64 9 367 6200
As an Amazon Associate we earn from qualifying purchases.