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
 

 

Syncsort Remove data older than 18 months from KSDS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort Remove data older than 18 months from KSDS
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: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Thu Mar 10, 2011 3:45 pm    Post subject:
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    Post subject:
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: 8118
Location: East Dubuque, Illinois, USA

PostPosted: Thu Mar 10, 2011 5:36 pm    Post subject:
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    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 copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts NDM syntax checking without actually ... GAPX1 All Other Mainframe Topics 0 Wed Jun 07, 2017 2:36 am


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