IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Syncsort Remove data older than 18 months from KSDS


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bhargav_1058

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Thu Mar 10, 2011 1:02 pm
Reply with quote

My requirement is to remove the records older than 18 months from a KSDS file with LRECL=1220 using JCL.

Date in the input file is in +CYYMMDD (S9(007) COMP-3) format at 23 position with 7 bytes length.
(Ex: 2009/10/25 - +1091025).

Now I have to get the system date and compare that against the date of the record which is at 23rd position.

I tried getting the system date which is older than 18 months using &DATE1-546 in outrec (Got the system date as 20090910).
However this format is different from file date format.

Could some one please help me on this?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Mar 10, 2011 3:45 pm
Reply with quote

Sorry, what you want to do cannot be done. JCL executes programs -- it cannot add data to a KSDS file, it cannot update data in a KSDS file, it cannot remove data from a KSDS file. JCL executes programs -- nothing more.

Now if you were using COBOL, or REXX, or SAS, or one of many other languages and utilities to do this -- then it could be done. But just using JCL, I'm sorry it is not possible.
Back to top
View user's profile Send private message
Bhargav_1058

New User


Joined: 13 Dec 2008
Posts: 53
Location: New York

PostPosted: Thu Mar 10, 2011 4:36 pm
Reply with quote

Hi Robert, Thanks for your reply!!

This can be done using a JCL by preparing 2 PS files with the records from KSDS using sort (INCLUDE or OUTREC or OMIT etc..).

PS file1. with the condition as data older than 18 months (compare system date with the date present in 23rd position of the KSDS file).

PS File2. with the other records (Latest 18 months records).

Then I will DEL/DEF the KSDS with the latest 18 month records.

Now I just want to know how to change the format of the SYSTEM date YYYYMMDD to +CYYMMDD (packed decimal).

Please let me know if I confused you...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Mar 10, 2011 5:36 pm
Reply with quote

You are not "using a JCL" -- you are using SORT (a utility) to perform the action. All the JCL does is execute the SORT. Terminology is critical in IT, where similar things may mean very different things. If you cannot even get straight a simple concept like JCL executes programs (such as SORT), then you're going to have a very hard IT career.

Furthermore, your original post mentioned COMP-3. This is a term specific to COBOL -- the term when using SORT is "packed decimal". And you are extremely confused about the length -- PIC S9(07) COMP-3 is a 4-byte packed decimal field, not a 7-byte field as your post indicates. A 7-byte packed decimal field would be PIC S9(13) COMP-3 in COBOL. With all of your confusion and your lack of understanding of JCL, perhaps you would be better off in Beginners and Students Forum?

Have you searched the SORT forum? There's at least 2 or 3 questions per week about using dates and date conversions posted in the SORT forum; probably one of them would help you. Plus there are pointers to the SORT manuals and helpful guides on how to use SORT in various ways. If you haven't checked them out yet, you should start there.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top