View previous topic :: View next topic
|
Author |
Message |
sakthisiga Warnings : 1 New User
Joined: 11 Jun 2009 Posts: 60 Location: Chennai
|
|
|
|
Hi all,
I try to write a record in a PS file...
first time its working properly,
When i try to write it again, it is overwritten with previous record,
I'll post my file description below:
Code: |
FILE-CONTROL.
SELECT REP-FILE ASSIGN TO REPFILE
ORGANIZATION IS SEQUENTIAL
ACCESS IS SEQUENTIAL
FILE STATUS IS W04-RP-STATUS.
|
Can anyone tell me what i have to change to write records one by one? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Are you closing the file then reopening it? What does the DD statement look like for REPFILE? And what do you mean "write records one by one" -- the system only writes one record at a time anyway (logically at least -- physically one block at a time)? |
|
Back to top |
|
|
sakthisiga Warnings : 1 New User
Joined: 11 Jun 2009 Posts: 60 Location: Chennai
|
|
|
|
1. For first time opened file in OUPUT mode, then close it properly. Again i open it in I-O mode then REWRITE it and Close it properly.
2. In DD statment i used disp=old. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
For first time opened file in OUPUT mode, then close it properly. Again i open it in I-O mode then REWRITE it and Close it properly. |
Do you not READ the record, then REWRITE it? If so, then there's only one record in the file -- the one you wrote before the close, then rewrote after the close and reopen. When you open the file I-O, the file position is set back to the first record, so if you want to write another record to it you'll have to read past the first record, then do a WRITE. |
|
Back to top |
|
|
sakthisiga Warnings : 1 New User
Joined: 11 Jun 2009 Posts: 60 Location: Chennai
|
|
|
|
Please find code in the first post in this topic.
Is the same select clause is used for ESDS or not?
But it shows error, while running job.
Error :
Code: |
********************************* TOP OF DATA **********************************
IGZ0200W A file attribute mismatch was detected. File REP-FILE in program SAMPL
file and the file specified in the ASSIGN clause was a VSAM data set.
CEE3204S The system detected a protection exception (System Completion Code=0C4
From compile unit SAMPLE at entry point SAMPLE at compile unit offset
address 09300E26.
|
Here some error description is missing.. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
nothing is missing...
You are trying to process a VSAM file with the FD of plain PS
what else are You looking for ??? |
|
Back to top |
|
|
sakthisiga Warnings : 1 New User
Joined: 11 Jun 2009 Posts: 60 Location: Chennai
|
|
|
|
In FD for ESDS file, what should we code to process?
Here i used
Code: |
FD REP-FILE
LABEL RECORDS ARE STANDARD
BLOCK CONTAINS 0 CHARACTERS
RECORD CONTAINS 80 CHARACTERS
RECORDING MODE IS F
DATA RECORD IS REP-REC.
|
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
From the original post ...
Quote: |
I try to write a record in a PS file... |
Please go away long enough to learn the terminology before posting again. PS is a physical sequential file. This type of file cannot, by the very definition of the term, be VSAM -- ever. VSAM files are VSAM files and sequential files are not.
And if the file is a VSAM ESDS, your COBOL SELECT statement must -- not should be, not could be, but must -- be in the form
Code: |
ASSIGN TO <comment>-AS-<ddname> |
So if your ASSIGN clause -- which you did not post I note -- does not have AS- on the front of the DD name, you need to add that and try again. |
|
Back to top |
|
|
|