IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Update VSAM file using SYNCTOOL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
karisurya

New User


Joined: 02 Aug 2007
Posts: 64
Location: Bangalore

PostPosted: Tue Apr 14, 2009 3:23 pm
Reply with quote

Hi,
I have a VSAM File, and it basically contains 3 types records

CURRCYCLE 20090414
PREVCYCLE 20090413
FUTURCYCLE 20090415

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.

Thanks,
Surya
Back to top
View user's profile Send private message
karisurya

New User


Joined: 02 Aug 2007
Posts: 64
Location: Bangalore

PostPosted: Tue Apr 14, 2009 6:13 pm
Reply with quote

Hi,
I created the following JCL to handle only issue related to CURRCYCLE in the above scenerio

Code:
                               
//STEP1    EXEC PGM=SYNCTOOL                                       
//IN1      DD  DSN=TSA9Z.SURYA.TEST,DISP=SHR                       
//T1       DD  DSN=&&TEMP,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1     DD  DSN=TSA9Z.SURYA.TEST,DISP=SHR                       
//DFSMSG   DD  SYSOUT=*                                           
//TOOLMSG  DD  SYSOUT=*                                           
//TOOLIN   DD  *                                                   
  COPY FROM(IN1) TO(T1) VSAMTYPE(F) USING(CTL1)                   
  COPY FROM(T1) TO(OUT1)                                           
/*                                                                 
//CTL1CNTL DD *                                                   
   INREC IFTHEN=(WHEN=(28,9,CH,EQ,C'CURRCYCLE'),                   
                  OVERLAY=(93:C'DATE1-1'))                         


But i am getting following error in this case


Code:

12K BYTES OF EMERGENCY SPACE ALLOCATED                           
T1       : RECFM=FB   ; LRECL=   123; BLKSIZE= 27921             
OUT1     : RECFM=F    ; LRECL=   123; CISIZE =  4096             
11,788K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
   0 BYTES RESERVE REQUESTED, 56K BYTES USED                     
VSAM LOGICAL ERROR 08 ON OUTPUT                                 
SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                             


Can any one suggest what can be the problem with this one.

Thanks,
Surya
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Apr 14, 2009 6:22 pm
Reply with quote

1. you are updating a vsam file in place? why not output to a new vsam file.

2. are you changing part of the key?

3. not sure, don't remember, but does not an 08 indicate duplicate key insert attempt?
Back to top
View user's profile Send private message
karisurya

New User


Joined: 02 Aug 2007
Posts: 64
Location: Bangalore

PostPosted: Tue Apr 14, 2009 6:36 pm
Reply with quote

Hi,
Thank you for the quick response
Code:

1. you are updating a vsam file in place? why not output to a new vsam file.

This is a auditing file and presently i am doing manual update of these dates. This file is going to be used by various down stream applications so i wont be able to create a new vsam file

Code:

2. are you changing part of the key?

No i am not changing part of key

Code:

3. not sure, don't remember, but does not an 08 indicate duplicate key insert attempt?

I am not really sure either, but in one of the discussion it is mentioned that we will get this error when VSAM file was defined without REUSE. I am not sure how to check this one on my VSAM file?

Thanks,
Surya
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Apr 14, 2009 6:43 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Apr 14, 2009 6:46 pm
Reply with quote

Quote:
I am not really sure either, but in one of the discussion it is mentioned that we will get this error when VSAM file was defined without REUSE. I am not sure how to check this one on my VSAM file?
Does n't a LISTCAT show this? Still it's not clear what you're trying to do here. Can you post some sample input records showing the relevant fields and the expected output out of it?
Back to top
View user's profile Send private message
abin

Active User


Joined: 14 Aug 2006
Posts: 198

PostPosted: Wed Apr 15, 2009 2:01 am
Reply with quote

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
Code:
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.
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(5,9,CH,EQ,C'CURRCYCLE'),
OVERLAY=(15:DATE1-1))
Back to top
View user's profile Send private message
karisurya

New User


Joined: 02 Aug 2007
Posts: 64
Location: Bangalore

PostPosted: Wed Apr 15, 2009 5:15 pm
Reply with quote

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.

Thanks& regards,
Surya
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top