IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Compare two files using EASYTrieve


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vallabhaneni

New User


Joined: 30 Sep 2006
Posts: 5

PostPosted: Fri Jan 12, 2007 1:14 am
Reply with quote

Hi,

I want to compare two files

FileA
101
202
202
302
401

FileB
101
201
401

I need output like

101
201
201
302
401

That means when I got match between Flle A, Fileb I have to move # 3 positon from B to # 3 position A, I have to retrieve all duplicates from file A.

Please see my coding below

PARM DEBUG (CLIST, DMAP, XREF, SHORT)
FILE SSAOUT
IN-DATA 1 3 A
IN-REC-TYPE 1 1 A
IN-KEY 2 1 A
IN-DATE 3 1 A
FILE SSADUMP
SSA-DATA 1 2 A
SSA-KEY 1 1 A
SSA-DATE 2 1 A
FILE SSADUMP1
SSA-DATA1 1 2 A
FILE OUTFILE
OUT-DATA 1 3 A
FILE OUTFILE1
OUT-DATA 1 4 A
OUT-REC-TYPE 1 1 A
OUT-REC 2 3 A


JOB INPUT (SSAOUT KEY IN-KEY +
SSADUMP KEY SSA-KEY)

IF DUPLICATE SSADUMP
GO TO JOB
END-IF

IF MATCHED
IF IN-REC-TYPE EQ '2'
IF IN-DATE EQ SSA-DATE
PUT OUTFILE FROM SSAOUT
ELSE
OUT-REC = IN-DATA
OUT-REC-TYPE = 'B'
PUT OUTFILE1
IN-DATE = SSA-DATE
OUT-REC = IN-DATA
OUT-REC-TYPE = 'A'
PUT OUTFILE1

PUT OUTFILE FROM SSAOUT
PUT SSADUMP1 FROM SSADUMP
END-IF
ELSE
PUT OUTFILE FROM SSAOUT
END-IF
GO TO JOB
END-IF

IF SSAOUT
PUT OUTFILE FROM SSAOUT
GO TO JOB
END-IF

IF SSADUMP
GO TO JOB
END-IF

Thank you
Val
Back to top
View user's profile Send private message
Nighthawk750

New User


Joined: 04 Nov 2006
Posts: 20
Location: Amsterdam

PostPosted: Mon Jan 15, 2007 7:22 pm
Reply with quote

You do not need to to use the IF duplicate option. That is only needed when you want to do something special with the duplicates. The IF MATCHED is sufficient.

Also, try avoiding GOTOs. If you code your Easytrieve well, there is no need for GOTOs, especially not when using Synchronized File Processing.
And another general piece of advice when typing in code: between IF statements (or DO-While loops of some sort), jump in 3 spaces. when reading the code it is more clear to what is happening.
E.g.: IF condition
do something
IF other condition
do something
ELSE
whatever
END-IF
END-IF
Back to top
View user's profile Send private message
Nighthawk750

New User


Joined: 04 Nov 2006
Posts: 20
Location: Amsterdam

PostPosted: Mon Jan 15, 2007 7:26 pm
Reply with quote

Nighthawk750 wrote:


And another general piece of advice when typing in code: between IF statements (or DO-While loops of some sort), jump in 3 spaces. when reading the code it is more clear to what is happening.
E.g.: IF condition
do something
IF other condition
do something
ELSE
whatever
END-IF
END-IF


hmmmm....it seems this form does not support SPACES very well......
my example is not outlined correctly; I looked ok when I typed it.....
forget my remark about jumping in 3 spaces icon_biggrin.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 7:49 pm
Reply with quote

Nighthawk750 wrote:

Code:
E.g.:  IF condition
             do something
             IF other condition
                 do something
             ELSE
                 whatever
             END-IF
          END-IF

You managed to "quote" it, what you should have done waas to "code" it......
Back to top
View user's profile Send private message
Nighthawk750

New User


Joined: 04 Nov 2006
Posts: 20
Location: Amsterdam

PostPosted: Mon Jan 15, 2007 8:37 pm
Reply with quote

oops..... icon_redface.gif sorry...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top