SORT to update a VSAM File



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

SORT to update a VSAM File

Postby Teja » Tue Feb 14, 2012 2:37 pm

Hi,

I have a VSAM, KSDS file with the following attributes:
Record Type - FB
Record Length - 300
Key Length - 24
Key Position - 1,24
SHROPTNS(2,3)

I want to update the status of records from 'RS' or 'RB' to 'RC'. Status field position is 60,2.
I am trying to use the below sort with the same file in SORTIN and SORTOUT to do this
//STEP020    EXEC PGM=SORT,PARM=(VSAMIO,RESET)                   
//SYSPRINT   DD SYSOUT=*                                         
//SYSOUT     DD SYSOUT=*                                         
//SORTLIST   DD SYSOUT=*                                         
//SORTIN     DD  DSN=VSAM.FILE,DISP=SHR             
//SORTOUT    DD  DSN=VSAM.FILE,DISP=SHR             
//SYSIN      DD  *                                                 
  RECORD TYPE=F,LENGTH=(300)   
  SORT FIELDS=(1,24,CH,A),EQUALS                                                 
  OUTREC FIELDS=(1,59,                                             
          60,2,CHANGE=(2,C'RS',C'RC',C'RB',C'RC'),NOMATCH=(60,2),   
          62,239)                                                   


But, I am getting the below error while executing.
SYSIN :                                                                       
  RECORD TYPE=F,LENGTH=(300)                                                   
  SORT FIELDS=(1,24,CH,A),EQUALS                                               
  OUTREC FIELDS=(1,59,                                                         
          60,2,CHANGE=(2,C'RS',C'RC',C'RB',C'RC'),NOMATCH=(60,2),             
          62,239)                                                             
WER276B  SYSDIAG= 1238242, 4306914, 4306914, 3685275                           
WER164B  65,540K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,           
WER164B     156K BYTES RESERVE REQUESTED, 27,972K BYTES USED                   
WER146B  24K BYTES OF EMERGENCY SPACE ALLOCATED                               
WER108I  SORTIN   : RECFM=F    ; LRECL=   300; CISIZE =  4096                 
WER073I  SORTIN   : DSNAME=VSAM.FILE                             
WER237I  OUTREC RECORD LENGTH =   300                                         
WER110I  SORTOUT  : RECFM=F    ; LRECL=   300; CISIZE =  4096                 
WER074I  SORTOUT  : DSNAME=VSAM.FILE                             
WER410B  63M BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,         
WER410B     0 BYTES RESERVE REQUESTED, 26,972K BYTES USED                     
WER036B  G=327                                                                 
WER177I  TURNAROUND SORT PERFORMED                                             
 WER255A  VSAM LOGICAL ERROR 08 ON OUTPUT   


Can anyone suggest me what changes i have to make in my sort card.
Teja
 
Posts: 6
Joined: Wed Oct 19, 2011 12:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SORT to update a VSAM File

 

Re: SORT to update a VSAM File

Postby bodatrinadh » Tue Feb 14, 2012 2:47 pm

Hi Teja,

If you want to update the dataset, then you should give DISP=MOD not SHR.


Thanks
-3nadh
Thanks
-3nadh
User avatar
bodatrinadh
 
Posts: 67
Joined: Thu Jan 12, 2012 9:05 pm
Has thanked: 0 time
Been thanked: 4 times

Re: SORT to update a VSAM File

Postby BillyBoyo » Tue Feb 14, 2012 2:53 pm

It is not a good idea to use the same input and output datasets from anything, including Sort.

If you want to use the Sort route, I'd suggest VSAM input to PS doing the update of the fields then PS to VSAM. I'd make a backup of the VSAM file before the sort step.

With a program, you could open for "update", read the file in sequence and only "update" those records which need it. Again, backing up the VSAM file before the step.

Crossing in the post, -3nadh, can you suggest what DISP=MOD might mean for a VSAM KSDS? And, from your suggestion, what you think it would mean for a PS?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: SORT to update a VSAM File

Postby bodatrinadh » Tue Feb 14, 2012 4:19 pm

Apologies for wrong information, I didn’t notice SORTIN and SORTOUT are of same file. By seeing error msg “WER255A” I Concluded that error is updating the output DSN which is in share mode.

We can update the dataset by giving DISP=MOD for existing PS file. Coming to VSAM, Very few occasions i handled them.

I want to recall my post and It won’t be happen next time.


Thanks
-3nadh
Thanks
-3nadh
User avatar
bodatrinadh
 
Posts: 67
Joined: Thu Jan 12, 2012 9:05 pm
Has thanked: 0 time
Been thanked: 4 times

Re: SORT to update a VSAM File

Postby BillyBoyo » Tue Feb 14, 2012 4:31 pm

OK. Also note that the DISP=MOD will "update" in a very specific way, in that it will write all the new records after all the existing records on that dataset.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: SORT to update a VSAM File

Postby Teja » Wed Feb 15, 2012 12:43 pm

I am currently using a program which opens the VSAM in I-O mode, read the file in sequence and update the records which have status of 'RS' or 'RB' to 'RC'.

But, I have many files with different record lengths and layouts, but all need similar processing.
So, instead of writing one program for each file, I was trying to update the records with SORT.
Teja
 
Posts: 6
Joined: Wed Oct 19, 2011 12:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SORT to update a VSAM File

Postby BillyBoyo » Wed Feb 15, 2012 1:16 pm

Well, sort reads an entire input file and writes an entire output file.

Read VSAM, output to sequential from Sort, read seqential and copy to VSAM (can be with Sort). Repeat daily, and for the number of files needed.

Vs

What you have, which is read input file, update three records. Repeat daily and for the number of tiles needed.

End of story.

If you are at all concerned about resources/costs I know which you'll end up doing.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post