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 

Easytrieve - close a file

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


Joined: 15 Apr 2005
Posts: 26
Topics: 9

PostPosted: Wed Jun 01, 2005 6:13 pm    Post subject: Easytrieve - close a file Reply with quote

hi
please let me know how I can close a file that I opened in Easytrieve

i have a program ( input1, input2 are input files )

job input input1
get input2
do while not eof input2
*****
*****
get input2
end-do

once the input2 eof is reached I get an error as we try to open it for the next record of input1,
can somebody suggest how to close input2 once eof is reached

thanks in advance
_________________
champion is not one who never fails, but one who never quits
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 02, 2005 5:30 am    Post subject: Reply with quote

Bullfighter,

Easytrieve does not have exclusive open/closing of files. If your intention is to match 2 files why not use syncronised file processing ?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
HB0
Beginner


Joined: 20 Apr 2005
Posts: 25
Topics: 7

PostPosted: Thu Jun 02, 2005 6:53 am    Post subject: Reply with quote

Bullfighter,

If you want to stop processing , when INPUT2 ends ,You can say

IF EOF INPUT2
STOP
END-IF.

or if you are matching then as Kolusu said syncronised file processing is the best.

HB0.
Back to top
View user's profile Send private message
bullfighter
Beginner


Joined: 15 Apr 2005
Posts: 26
Topics: 9

PostPosted: Thu Jun 02, 2005 10:51 am    Post subject: Reply with quote

I dont want to stop processing at end of file Input2,
I want to read second record of input1 and start reading input2 from the start, any help on this

what is synchronised file processing ?? can you give me more info


thanks
_________________
champion is not one who never fails, but one who never quits
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 02, 2005 11:22 am    Post subject: Reply with quote

Quote:
I dont want to stop processing at end of file Input2,
I want to read second record of input1 and start reading input2 from the start, any help on this


Bullfighter,

What exactly are you trying to do ? Are you trying to compare every record from file 1 with all the records of file 2? Post detailed information on what you're trying to accomplish. May be we can suggest a better way.
Quote:

what is synchronised file processing ?? can you give me more info


Easytrieve's Synchronized File Processing (SFP) facility can be used with one file or multiple files. It can be used to perform match/merge operations on multiple files.

Check this link for an example

http://www.mvsforums.com/helpboards/viewtopic.php?t=11&highlight=match

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bullfighter
Beginner


Joined: 15 Apr 2005
Posts: 26
Topics: 9

PostPosted: Thu Jun 02, 2005 11:41 am    Post subject: Reply with quote

yes I am trying to compare every record of file 1 with all records of file2

File1 and file2 are entirely different formats

File1:
12345678912345678911
12345678812345678911

File2
TRAN....*.<TADP 0...
TRAN....*.<TADP 1...

My requirement :
1. Pick first 9 characters of file1
2. check every record in file2, to see if the value from position 5 until 5 places is same as the one from file1 ( value from file1 is char9, value from file2 is packed5 )
3. once we check all the records in file2 , start with next record of file1

Is this clear,
please let me know if this is not,
please help me in this
thanks a lot
_________________
champion is not one who never fails, but one who never quits
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 02, 2005 11:57 am    Post subject: Reply with quote

Quote:

2. check every record in file2, to see if the value from position 5 until 5 places is same as the one from file1 ( value from file1 is char9, value from file2 is packed5 )


Bullfighter,

What do you want to do if the value matches ? write it to an output file?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bullfighter
Beginner


Joined: 15 Apr 2005
Posts: 26
Topics: 9

PostPosted: Thu Jun 02, 2005 12:02 pm    Post subject: Reply with quote

if this value matches, I have to write to output file ( if the value from 14 to 16 is ADP )

thanks,
_________________
champion is not one who never fails, but one who never quits
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 02, 2005 12:10 pm    Post subject: Reply with quote

Bullfighter,

Step1 : Sort the file1 on the first 9 bytes. If you have duplicates eliminate them.
Code:

//SYSIN   DD *
  SORT FIELDS=(1,9,CH,A)
  SUM FIELDS=NONE
/*

STEP2 : sort the file2 on the packed decimal field expanding it as character.If you have duplicates eliminate them. Also use a Include condition to include only records with 'ADP' at pos 14.

Code:

//SYSIN   DD *
  INCLUDE COND=(14,3,CH,EQ,C'ADP')
  INREC FIELDS=(5,5,PD,EDIT=(TTTTTTTTT)
  SORT FIELDS=(1,9,CH,A)
  SUM FIELDS=NONE
/*


step 3: easytrieve syncronised file processing

Code:

//STEP0300 EXEC PGM=EZTPA00                       
//*                                               
//STEPLIB   DD DSN=EASYTREV.LOADLIB,     
//             DISP=SHR                           
//SYSPRINT  DD SYSOUT=*                           
//SYSOUT    DD SYSOUT=*                           
//IN1       DD DSN=YOUR SORTED FILE1 FROM STEP1,
//             DISP=SHR
//IN2       DD DSN=YOUR SORTED FILE2 FROM STEP2,
//             DISP=SHR
//MATCH     DD DSN=MATCH.FILE,                 
//             DISP=(NEW,CATLG,DELETE),           
//             UNIT=SYSDA,                         
//             SPACE=(CYL,(X,Y),RLSE),             
//             DCB=(RECFM=FB,LRECL=ZZZ,BLKSIZE=0)   
//*
//SYSIN     DD *
                                   
 FILE IN1                           
  IN1-KEY             001 009 A     
                                   
 FILE IN2                           
  IN2-KEY             001 009 A     
                                   
 FILE MATCH FB(0 0)                 
                                   
 JOB INPUT (IN1 KEY (IN1-KEY)  +   
            IN2 KEY (IN2-KEY))     
                                   
     IF MATCHED                     
        PUT MATCH FROM IN1         
     END-IF                         
/*                     


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bullfighter
Beginner


Joined: 15 Apr 2005
Posts: 26
Topics: 9

PostPosted: Thu Jun 02, 2005 1:01 pm    Post subject: Reply with quote

thanks kolusu,

step2 I am getting error an error, can you help me
my OUTREC should have the Packed numbers + another 11 characters starting at 106, so I changed it accordingly and I am getting the below error

SYSIN :
INCLUDE COND=(53,3,CH,EQ,C'ADP')
INREC FIELDS=(5,5,PD,EDIT=(TTTTTTTTT),106,11)
SORT FIELDS=(1,20,CH,A)
SUM FIELDS=NONE
OUTREC FIELDS=(1,20)
WER164B 12,672K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 1,008K BYTES USED
WER146B 16K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=VB ; LRECL= 1008; BLKSIZE= 27998
WER235A INREC RDW NOT INCLUDED
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
_________________
champion is not one who never fails, but one who never quits
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 02, 2005 1:36 pm    Post subject: Reply with quote

Bullfighter,

Your input file is a variable block file , so you need to include the RDW also. so change your control cards to the following.

Code:

//SYSIN    DD *
  INREC FIELDS=(001,04,                       $ RDW
                005,05,PD,EDIT=(TTTTTTTTT),   $ KEY-FIELD
                106,11)                       $ ANOTHER FIELD
  SORT FIELDS=(5,9,CH,A)                      $ SORT ON KEY
  SUM FIELDS=NONE                             $ REMOVE DUPS
  OUTFIL CONVERT,                             $ CONVERT VB TO FB
  OUTREC=(5,20)                               $ 20 BYTES OF DATA
/*


Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bullfighter
Beginner


Joined: 15 Apr 2005
Posts: 26
Topics: 9

PostPosted: Thu Jun 02, 2005 1:45 pm    Post subject: Reply with quote

I made my control card as
Code:

//SYSIN    DD *                                   
 INCLUDE COND=(57,3,CH,EQ,C'ISP')                 
 INREC FIELDS=(1,4,9,5,PD,EDIT=(TTTTTTTTT),110,11)
 SORT    FIELDS=(1,20,CH,A)                       
 SUM     FIELDS=NONE                             
/*                                               

and its working as expected,,

Thanks a lot Kolusu, thanks a lottttt
_________________
champion is not one who never fails, but one who never quits
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 -> Utilities 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