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 

Rewrite 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
rsivananda
Beginner


Joined: 11 Aug 2004
Posts: 30
Topics: 10

PostPosted: Mon Oct 24, 2005 2:50 am    Post subject: Rewrite in Easytrieve Reply with quote

Hi
Please help me out in the following req

I have infile(KSDS-key 11chars) and errfile(flat)

errfile has key of 11 chars and i need to find those records in infile using errfile and remove them from infile and update the infile.

The solution should be easytrieve.

The problem is i am unable to rewrite the KSDS and i am getting vsam error code 012 (0C)which is out of seq.

Do we have rewrite option in ezt like in cobol.

Thanks in advance
Siva Confused
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: Mon Oct 24, 2005 9:07 am    Post subject: Reply with quote

rsivananda,

Here is a sample code to delete a record from VSAM cluster.

Code:

//STEP0100 EXEC PGM=EZTPA000                 
//STEPLIB  DD DSN=EASYTREV.LOADLIB,
//            DISP=SHR                       
//SYSPRINT DD SYSOUT=*                       
//SYSOUT   DD SYSOUT=*                       
//SYSSNAP  DD SYSOUT=*                       
//SYSUDUMP DD SYSOUT=*                       
//INFILE   DD DSN=YOUR ERRFILE,
//            DISP=SHR
//INVSAM   DD DSN=YOUR VSAM CLUSTER,
//            DISP=SHR                     
//SYSIN    DD *                                     
  FILE INFILE                                       
       IN-KEY           01 011 A                   
                                                   
  FILE INVSAM VS (UPDATE)                           
       VSAM-KEY         01 011 A                   
                                                   
                                                   
****************************************************
* MAINLINE                                         
****************************************************
                                                   
 JOB INPUT (INFILE)                                 
                                                   
   READ INVSAM KEY IN-KEY STATUS                   

   IF FILE-STATUS NE 0                           
      DISPLAY 'READ FAILED...KEY= ' IN-KEY       
      STOP                                       
   ELSE
      WRITE INVSAM DELETE STATUS                   
      IF FILE-STATUS NE 0                           
         DISPLAY 'DELETE FAILED'                     
         STOP                                       
      END-IF                                       
   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
rsivananda
Beginner


Joined: 11 Aug 2004
Posts: 30
Topics: 10

PostPosted: Tue Oct 25, 2005 7:09 am    Post subject: Reply with quote

Hi Kolusu
Thanx for the inputs.

The delet part is working great.

This is working fine and one of the other req in the same issue is that for some of the keys in error files if we have low values in vsam file, they should be replaced with spaces and rewrite the record in the KSDS file.

Could you please help me in that as well.

Primarily i am looking for a rewrite option in easytrieve VSAM.
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 Oct 25, 2005 7:46 am    Post subject: Reply with quote

rsivananda,

The update logic is same as delete logic, nothing different. I am assuming that you have the low values in the field named VSAM-CHNG-FIELD at pos 75 for a length of 10.

ex:
Code:

//STEP0100 EXEC PGM=EZTPA000                 
//STEPLIB  DD DSN=EASYTREV.LOADLIB,
//            DISP=SHR                       
//SYSPRINT DD SYSOUT=*                       
//SYSOUT   DD SYSOUT=*                       
//SYSSNAP  DD SYSOUT=*                       
//SYSUDUMP DD SYSOUT=*                       
//INFILE   DD DSN=YOUR ERRFILE,
//            DISP=SHR
//INVSAM   DD DSN=YOUR VSAM CLUSTER,
//            DISP=SHR                     
//SYSIN    DD *                                     
  FILE INFILE                                       
       IN-KEY           01 011 A                   
                                                   
  FILE INVSAM VS (UPDATE)                           
       VSAM-KEY         01 011 A                   
       VSAM-CHNG-FIELD  75 010 A
                                                 
                                                   
****************************************************
* MAINLINE                                         
****************************************************
                                                   
 JOB INPUT (INFILE)                                 
                                                   
   READ INVSAM KEY IN-KEY STATUS                   

   IF FILE-STATUS NE 0                           
      DISPLAY 'READ FAILED...KEY= ' IN-KEY       
      STOP                                       
   ELSE
      VSAM-CHNG-FIELD = ' '
      WRITE INVSAM UPDATE STATUS                   
      IF FILE-STATUS NE 0                           
         DISPLAY 'UPDATE FAILED FOR KEY '  IN-KEY
         STOP                                       
      END-IF                                       
   END-IF
/*


Btw I suggest that you read chapter 11 in eastrieve reference guide. It has detailed explanation with examples.

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
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