Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 
Append to file, but also remove old records when full?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
tander3

New User


Joined: 21 Jan 2016
Posts: 2
Location: USA

PostPosted: Mon Jan 25, 2016 8:05 pm    Post subject: Append to file, but also remove old records when full?
Reply with quote

I have a JCL that triggers SAS code to compare files and record certain records.

New records append to the same file when the job runs. When the file is full the job abends.

Is there a way for the oldest records to drop from the file when new records append?

The file would have a fixed size, but never grow larger. I could change the SAS Code to help out with this, but I wonder if there a JCL only solution? That might be simpler.

Here is the JCL DD statement:

Code:

//RECORDS   DD DSN=FILE.NAME.RECORDS,               
//                  DISP=(MOD,CATLG),                         
//                  DCB=(RECFM=FB,LRECL=500,BLKSIZE=0),       
//                  AVGREC=M,SPACE=(500,(1,1),RLSE),UNIT=DISK


Thank you for reading my post !!
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8135
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jan 25, 2016 8:53 pm    Post subject: Reply to: Append to file, but also remove old records when full?
Reply with quote

Quote:
I could change the SAS Code to help out with this, but I wonder if there a JCL only solution?
First, JCL does nothing but allocate resources and execute programs. Hence you will NOT be able to find a JCL-only solution; you will have to use a program of some sort to do this.

Second, the system doesn't know how old a given record is -- the system tracks a data set as far as create date and last referenced date, but that's as far as it goes. So you'll need to write a program in the language of your choice to identify the oldest records and remove them from the data set. Note that removing them is easy if the data set is a VSAM KSDS but may be time-consuming if the data set is sequential since you'll probably need to copy it to an output data set omitting the old records from the write to the output data set.
Back to top
View user's profile Send private message
tander3

New User


Joined: 21 Jan 2016
Posts: 2
Location: USA

PostPosted: Mon Jan 25, 2016 10:03 pm    Post subject: Reply to: Append to file, but also remove old records when full?
Reply with quote

Ok - guess it's back into the SAS code then. - Thanks.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 995
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Jan 26, 2016 1:51 pm    Post subject:
Reply with quote

Quote:
Is there a way for the oldest records to drop from the file when new records append?


..and what determines what's "oldest"? If you have a datestamp in the records, you could perhaps use a DFSORT/SYNCSORT step to drop the 'oldest' records before you current step appends more records?

Garry.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us