MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

2 File Matching and write 2 output files using easytrieve

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
haritha_e
Beginner


Joined: 30 Jan 2007
Posts: 14
Topics: 8

PostPosted: Tue May 08, 2007 4:56 am    Post subject: 2 File Matching and write 2 output files using easytrieve Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue May 08, 2007 7:08 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
haritha_e
Beginner


Joined: 30 Jan 2007
Posts: 14
Topics: 8

PostPosted: Tue May 08, 2007 7:15 am    Post subject: Reply with quote

My Match field is Polnum only. I have incorrectly mentioned 3 files. The output files are 2 only.

Thanks
Haritha
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue May 08, 2007 7:39 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
haritha_e
Beginner


Joined: 30 Jan 2007
Posts: 14
Topics: 8

PostPosted: Tue May 08, 2007 8:11 am    Post subject: Reply with quote

Thanks kolusu, its working..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group