|
View previous topic :: View next topic
|
| Author |
Message |
Vallabhaneni
New User
Joined: 30 Sep 2006 Posts: 5
|
|
|
|
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 |
|
 |
Nighthawk750
New User

Joined: 04 Nov 2006 Posts: 20 Location: Amsterdam
|
|
|
|
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 |
|
 |
Nighthawk750
New User

Joined: 04 Nov 2006 Posts: 20 Location: Amsterdam
|
|
|
|
| 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  |
|
| Back to top |
|
 |
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
| 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 |
|
 |
Nighthawk750
New User

Joined: 04 Nov 2006 Posts: 20 Location: Amsterdam
|
|
|
|
oops..... sorry... |
|
| Back to top |
|
 |
|
|