What i need to do is create a JCL which will update the CURRCYCLE date to todays date - 1, PREVCYCLE date to todays date - 2 and it need to check if there is any entry under FUTURCYCLE with date greater than todays if not it should crete a new record similar to old record and update the correponding date to todays date + 1
Can any one please help me with this, please let me know in case if you need any further information.
Joined: 20 Oct 2006 Posts: 6970 Location: porcelain throne
updating a file in place is 'not good practice'.
1. rename the original.
2. create a new one.
3. run your sort.
i am not an expert, but I don't think you can insert a duplicate record.....
which you are doing with the output of sort. (since you read the record and changed a part of the data portion.)
by the way, the design sucks.
you have a field that indicates what type of record it is.
you should have a control record to keep the dates in different fields (one for each record type).
then you only have to change one record.
For the first thing you trying to read and write into the same VSAM file which as Dick said "sucks".
Try writing into a new vsam file and the error
VSAM LOGICAL ERROR 08 ON OUTPUT
can be removed.
This error says you are trying to write a duplicate record into VSAM file. Is your vsam file a KSDS. The error from your log says yes.
I tried the following sort card for an ESDS VSAm data set and it woked. With KSDS it will work if the o/p KSDS is empty.
Thank you all for the replies and suggestions, presently i am planning to acheive this in 2 steps.
1) In first step i will use sort, copy data from vsam to a temp. file with req. modifications
2) In second step I am using IDCAMS to update the VSAM file using this temp file.
Regarding design its done some 20 years back and i cant do much with respect to it.