View previous topic :: View next topic |
Author |
Message |
haritha_e Beginner
Joined: 30 Jan 2007 Posts: 14 Topics: 8
|
Posted: Tue May 08, 2007 4:56 am Post subject: 2 File Matching and write 2 output files using easytrieve |
|
|
Hi,
I have a different requirement.
I have two input files.
First file
---------
Code: |
PolNum Currow
-------- --------
1111 1
2222 1
|
Second file
---------
Code: |
PolNum Currow
-------- --------
1111 1
1111 0
2222 1
2222 0
3333 1
|
I want the ouptput in three different files:
Output file 1:
Code: |
PolNum Currow
-------- --------
1111 1 - First file
1111 0 - Second file(currow shud be set to zero for all recds)
1111 0
2222 1 - First file
2222 0- Second file(currow shud be set to zero for all recds)
2222 0
|
Output file 2: shud contain data from o/p file 2 + unmatched records from the second i/p file:
Code: |
PolNum Currow
-------- --------
1111 1
1111 0
1111 0
2222 1
2222 0
2222 0
3333 1
|
Can this be achieved in one easy trieve program. I tried but, i am able to do it with one easytrieve program and couple of steps.
Any help in this regards would be appreciated.
Thanks
Haritha. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue May 08, 2007 7:08 am Post subject: |
|
|
haritha_e,
What is your match fields? is it both polnum and currow? or just polnum? btw your specifications mention that you want 3 output files and you just show 2 output files. Please specify requirements and may be we can suggest a solution.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
haritha_e Beginner
Joined: 30 Jan 2007 Posts: 14 Topics: 8
|
Posted: Tue May 08, 2007 7:15 am Post subject: |
|
|
My Match field is Polnum only. I have incorrectly mentioned 3 files. The output files are 2 only.
Thanks
Haritha |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue May 08, 2007 7:39 am Post subject: |
|
|
Haritha,
Try this untested code.
[code:1:35b4f16eae]
//STEP0100 EXEC PGM=EZTPA00
//STEPLIB DD DSN=EASYTREV.LOADLIB,
// DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSSNAP DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//FILEONE DD *
1111 1
2222 1
//FILETWO DD *
1111 1
1111 0
2222 1
2222 0
3333 1
//OUTPUT1 DD SYSOUT=*,
// DCB=(LRECL=10,RECFM=FB,BLKSIZE=0)
//OUTPUT2 DD SYSOUT=*,
// DCB=(LRECL=10,RECFM=FB,BLKSIZE=0)
//*
//SYSIN DD *
FILE FILEONE
POL-NUM1 01 04 A
CUR-ROW1 06 01 A
FILE FILETWO
POL-NUM2 01 04 A
CUR-ROW2 06 01 A
FILE OUTPUT1 FB(0 0)
O1-POL-NUM 01 04 A
O1-CUR-ROW 06 01 A
FILE OUTPUT2 FB(0 0)
O2-POL-NUM 01 04 A
O2-CUR-ROW 06 01 A
S-PREV-KEY W 04 A
******************************************
* MAINLINE *
******************************************
JOB INPUT (FILEONE KEY (POL-NUM1) +
FILETWO KEY (POL-NUM2))
IF MATCHED
PERFORM WRITE-OUT1
ELSE-IF FILETWO
PERFORM WRITE-OUT2
END-IF
WRITE-OUT1. PROC
IF S-PREV-KEY _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
haritha_e Beginner
Joined: 30 Jan 2007 Posts: 14 Topics: 8
|
Posted: Tue May 08, 2007 8:11 am Post subject: |
|
|
Thanks kolusu, its working.. |
|
Back to top |
|
 |
|
|