View previous topic :: View next topic
|
Author |
Message |
sandhya rani
New User
Joined: 05 Dec 2006 Posts: 22 Location: hyderabad
|
|
|
|
Hi,
My requirement is to add the message entered by the user in the Vsam file by incrementing the key
I had written the code as follows
Say 'enter thr message'
Pull message
"alloc DA(temp.flatfile") dd(INDD) shr"
"alloc DA(temp.Vsam.KSDS) dd(OUTDD) mod"
"repro Ifile(INDD) ofile(OUTDD) TOKEY('00000008')"
when i execute the same it is expecting a FROMKEY
whateven message enter by the user iam copying the same into the flatfile.Now iam using repro utility to copy that message to the VSAM by incrementing the key or specified key.
Can anyone tell me how do we use repro to add the record for KSDS(key information is not present in flatfile..and the keylength is 8).
Thanks & Regards
Sandhya Rani |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
As far as I know, you can't use REPRO to simply update a VSAM dataset. I believe that you'll need to REPRO all of the VSAM dataset to the QSAM dataset, add the comment record along with an appropriate key, then REPRO all of the QSAM dataset back into the VSAM dataset.
Comment: wouldn't this be easier to much more efficient to do in COBOL? |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
You need the KEY to the RECORD you are trying to update in the VSAM file. You also need to use the FROM and To Option. I do this all the time. here is an EXAMPLE. The FROM and TO keys are both the same VSAM
record KEY which allows you to replace the one VSAM RECORD.
Code: |
//STEP020 EXEC PGM=IDCAMS
//IN DD DSN=input.file.name,DISP=SHR (SEQ FILE)
//OUT DD DSN=output.vsam.file,DISP=SHR (VSAM FILE)
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
REPRO INFILE(IN) OUTFILE(OUT) REPLACE -
FKEY ('record key')
TOKEY('record key')
//*
|
|
|
Back to top |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
Sandhya,
You cannot copy a flast PS file to VSAM file(i.e updation) as it is.
If the VSAM file is KSDS you cannot do that.
Simple way is ,
1.Get the records from the user( as you did in the flat file)
2.Sort the record in PS based on the key defined in VSAM.
3.Update the VSAM file. |
|
Back to top |
|
|
|