Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Appending records to a sequential file 2

Status
Not open for further replies.

suruppak

Programmer
Mar 12, 2003
17
US
I have a program that is writing records to a sequential file. This program gets ran 5 separate times in succession. I am wondering how to add records to the same file every time the program runs without overwriting the data already in the file. Can this be done in the JCL?
 
Dear Sur,

you can accomplih this by specifying disp=mod inthe DD for the file and open it I-O. Then just write the recs. After the 5th run, just make sure you rename the d/s. Then the 6th run will create a new d/s without changing the JCL.

One other caveat: if your job abends or the new data is not good you now are the proud owner of a mal-functioning d/s and you're faced w/rerunning the previous data. So, you might want to back it up before each run.

HTH, Jack.
 
Here's a link which may be helpful and a snippet from the page.


EXTEND
Permits opening the file for output operations.

The EXTEND phrase is allowed for sequential access files only if the new data is written in ascending sequence. The EXTEND phrase is allowed for files that specify the LINAGE clause.

For QSAM files, do not specify the EXTEND phrase for a multiple file reel.

If you want to append to a file, but are unsure if the file exists, use the SELECT OPTIONAL clause before OPENing the file in EXTEND mode. The file will be created or appended to, depending on whether the file exists.

file-name-1, file-name-2, file-name-3, file-name-4
Designates a file upon which the OPEN statement is to operate. If more than one file is specified, the files need not have the same organization or access. Each file-name must be defined in an FD entry in the Data Division, and must not name a sort or merge file. The FD entry must be equivalent to the information supplied when the file was defined.
 
Thank you both very much, I learned a great deal from both posts.
Jeremy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top