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

SYNCSORT to have only last 7 days data


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

New User


Joined: 06 Jul 2006
Posts: 9

PostPosted: Fri Sep 12, 2008 12:12 pm
Reply with quote

Hi all,

here is my requirement.

i have one input file which have past month's data.
now i want to sort this file to have only last 7 days data from the current date of run.
i have used the syntax like this.

SORT FIELDS=COPY
INCLUDE COND=(1,4,PD,GE,DATE1P-7).
position 1 and length 4 is a date field in input file of format D.

but sort is not working and it is displaying the same data as in the input file.
kindly help me with some solution.

thank you
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Fri Sep 12, 2008 12:20 pm
Reply with quote

Hi,
Use PD0 instead of PD.
Back to top
View user's profile Send private message
kalyan_lc5

New User


Joined: 06 Jul 2006
Posts: 9

PostPosted: Fri Sep 12, 2008 12:59 pm
Reply with quote

i have used PD0,but getting an error in DATE1P.
is there any system variable to get the current date in JCL?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Sep 12, 2008 1:02 pm
Reply with quote

You really do need to post the output from the run for any useful suggestions.

And I would also suggest using a meaningful title to your proble.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Sep 12, 2008 2:54 pm
Reply with quote

As expat said you need to post sample input and required output.

As of now i feel that you should use DATE3P date format if you have four byte date in pd format.
Back to top
View user's profile Send private message
kalyan_lc5

New User


Joined: 06 Jul 2006
Posts: 9

PostPosted: Fri Sep 12, 2008 6:46 pm
Reply with quote

below is the input file

input file

20080911
20080901
20080912

i want the output file as follows

20080911
20080912
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Sep 15, 2008 12:59 pm
Reply with quote

kalyan_lc5,

Your input date field has 8 digits and if it is a PD field, it occupies 5 bytes instead of 4 bytes.

Modifying the card as below should solve your problem.

Code:
//SYSIN    DD *                   
  INCLUDE COND=(1,5,PD,GE,DATE1P-7)
  SORT FIELDS=COPY                 
//*   
Thanks,
Arun
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Mon Sep 15, 2008 2:32 pm
Reply with quote

HI,

Kindly refer this,

Code:

Format of Operand             Format of Constant            Example of Constant

DATE1P                        +yyyymmdd                     +20050621 
DATE2P                        +yyyymm                       +200506
DATE3P                        +yyyyddd                      +2005172


Regards
R KARTHIK
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 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