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 

Update file in in easytrieve

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


Joined: 21 Apr 2004
Posts: 12
Topics: 9

PostPosted: Wed Aug 11, 2004 5:34 am    Post subject: Update file in in easytrieve Reply with quote

i have a big file with laks of records and i want to update only a few records which starts policy3. and the other records should not be touched.i do not want another output file. can this be done?

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


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

PostPosted: Wed Aug 11, 2004 5:56 am    Post subject: Reply with quote

Murali,

Updating a file in place will result in a loss of data, if your pgm abends. So you need to have a backup of your file before running this pgm.

I am assuming that your policy3 field starts at pos 1 and you want to update a field which is in the 30th byte for a length of 20 bytes. Notice that the same input file is used on both infile and fileout.

Code:

//STEP0100 EXEC PGM=EZTPA00
//STEPLIB  DD DSN=EASYTREV.LOADLIB,
//            DISP=SHR
//SYSPRINT DD SYSOUT=*
//INFILE   DD DSN=INPUT FILE,
//            DISP=SHR
//FILEOUT  DD DSN=INPUT FILE,
//            DISP=OLD
//SYSIN DD *

FILE INFILE
     REC-IND          01  07  A
     UPDATE-Flag      30  20  A

FILE FILEOUT FB(0 0)

JOB INPUT (INFILE)

    IF REC-IND    = 'POLICY3'
       UPDATE-REC = 'I AM UPDATING THIS RECORD'
       PUT FILEOUT FROM INFILE
    ELSE                     
       PUT FILEOUT FROM INFILE
    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
souvik_225
Beginner


Joined: 15 May 2004
Posts: 17
Topics: 2
Location: Mumbai , India

PostPosted: Wed Aug 11, 2004 6:01 am    Post subject: Reply with quote

Use the UPDATE in file definition, use SEARCH to locate the records and WRITE to rewrite the records.
_________________
Thanks and Regards,
Souvik Upadhyay
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Aug 11, 2004 6:35 am    Post subject: Reply with quote

souvik_225,

The UPDATE with WRITE option is valid only for VSAM files. But the code I have shown updates a reqular sequential 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
souvik_225
Beginner


Joined: 15 May 2004
Posts: 17
Topics: 2
Location: Mumbai , India

PostPosted: Wed Aug 11, 2004 6:51 am    Post subject: Reply with quote

Kolusu,
Sorry , I overlooked in my manual that WRITE is for VSAM. Embarassed
_________________
Thanks and Regards,
Souvik Upadhyay
Back to top
View user's profile Send private message Yahoo Messenger
murali
Beginner


Joined: 21 Apr 2004
Posts: 12
Topics: 9

PostPosted: Thu Aug 12, 2004 5:51 am    Post subject: Reply with quote

thanks kolusu it worked
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