View previous topic :: View next topic |
Author |
Message |
rsivananda Beginner
Joined: 11 Aug 2004 Posts: 30 Topics: 10
|
Posted: Mon Oct 24, 2005 2:50 am Post subject: Rewrite in Easytrieve |
|
|
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  |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Oct 24, 2005 9:07 am Post subject: |
|
|
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 |
|
 |
rsivananda Beginner
Joined: 11 Aug 2004 Posts: 30 Topics: 10
|
Posted: Tue Oct 25, 2005 7:09 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Oct 25, 2005 7:46 am Post subject: |
|
|
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 |
|
 |
|
|