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
 

 

Sort to extract record based on a particular date

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

New User


Joined: 08 May 2009
Posts: 19
Location: India

PostPosted: Fri May 29, 2009 10:35 am    Post subject: Sort to extract record based on a particular date
Reply with quote

I have a input file which has a date feild with century field missing
i want all the records which has dates greater than 1-Jan-1980
I/P file:
---+----1----+----2----+
CODY BANKS 120289
JAMES BOND 042904
MILLER KING 011580
CHARLES WRIGHT 111600
Back to top
View user's profile Send private message

Arun Raj

Moderator


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

PostPosted: Fri May 29, 2009 10:50 am    Post subject:
Reply with quote

Sureet Mookherjee,

Which sort product do you have? And what version is it? You can find this info in the SYSOUT of any job run.

Does your date field start at a fixed position in the input file? It would be better if you post the sample data/code in "Code" tags.
Back to top
View user's profile Send private message
Sureet Mookherjee

New User


Joined: 08 May 2009
Posts: 19
Location: India

PostPosted: Fri May 29, 2009 10:57 am    Post subject: Reply to: Sort to extract record based on a particular date
Reply with quote

sort product is SYNCSORT FOR Z/OS 1.3.2.0R
yeah the name field starts from col 1 to 14 and date field start from 20 to 25 they are in fixed position[/code]
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Fri May 29, 2009 11:18 am    Post subject:
Reply with quote

you can use the following SORT card.

Code:

OPTION COPY
INCLUDE COND=(20,6,CH,GT,C'010180')
Back to top
View user's profile Send private message
Sureet Mookherjee

New User


Joined: 08 May 2009
Posts: 19
Location: India

PostPosted: Fri May 29, 2009 11:21 am    Post subject: Reply to: Sort to extract record based on a particular date
Reply with quote

I have tried this one but its not working
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Fri May 29, 2009 11:24 am    Post subject:
Reply with quote

I tried with the data provided by you and working fine for me.

ooh, I have not seen your last post, I am using DFSORT and yours is SYNCSORT. I am not sure about syntax of SYNCSORT. Please wait for other responses.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri May 29, 2009 11:31 am    Post subject:
Reply with quote

ksk,
Quote:
I tried with the data provided by you and working fine for me.

ooh, I have not seen your last post, I am using DFSORT and yours is SYNCSORT. I am not sure about syntax of SYNCSORT
I doubt that even if you have DFSORT. You are comparing dates and not numeric values. And how do you expect it to work with a format ddmmyy.
As per your card 010180(01-Jan-1980) will be less than 020150(02-Jan-1950).
Back to top
View user's profile Send private message
Sureet Mookherjee

New User


Joined: 08 May 2009
Posts: 19
Location: India

PostPosted: Fri May 29, 2009 11:37 am    Post subject: Reply to: Sort to extract record based on a particular date
Reply with quote

the input is in the format MMDDYY i need the output records which are greater than 01-Jan-1980(which is in the format DDMMCCYY)
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Fri May 29, 2009 11:46 am    Post subject:
Reply with quote

Arun,

Thanks for the feedback. I have not considered all the cases, just i checked with the data he has provided and also checked with the following data to descard the record which has less than 010180. I have considered date format MMDDYY and worked fine for me. I can post the output also if you want to see.

Code:

CODY BANKS     010175
JAMES BOND     042904
MILLER KING    011580
CHARLES WRIGHT 111600
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri May 29, 2009 12:24 pm    Post subject:
Reply with quote

ksk,

Quote:
I can post the output also if you want to see.
It might have worked for the sample you used. See how the code posted by you is "working" for this input. This WILL NOT work if you're really trying to compare dates.
Code:
CODY BANKS         010175
JAMES BOND         020175
MILLER KING        030175
CHARLES WRIGHT     040175
Quote:
I have not considered all the cases, just i checked with the data he has provided
IMHO the solution should be against the requirement rather than just a sample of 4-5 records. It should work for any possible input
Back to top
View user's profile Send private message
Sureet Mookherjee

New User


Joined: 08 May 2009
Posts: 19
Location: India

PostPosted: Fri May 29, 2009 12:31 pm    Post subject: Reply to: Sort to extract record based on a particular date
Reply with quote

Can anybody give me the solution using sort?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri May 29, 2009 12:55 pm    Post subject: Re: Reply to: Sort to extract record based on a particular d
Reply with quote

Sureet Mookherjee wrote:
Can anybody give me the solution using sort?
Sureet Mookherjee,

The below SyncSort job should work for your requirement.
Code:
//STEP1  EXEC  PGM=SORT,PARM='CENTWIN=1950'
//SYSOUT   DD  SYSOUT=*                   
//SORTIN   DD *                           
DEC 01 1975        120275                 
DEC 02 1976        120276                 
DEC 31 1979        123179                 
JAN 01 1980        010180                 
JAN 02 1980        010280                 
DEC 01 1989        120289                 
APR 29 2004        042904                 
JAN 15 1980        011580                 
NOV 16 2000        111600                 
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD  *                           
  OPTION COPY                             
  INCLUDE COND=(20,6,Y2W,GT,800101)       
/*                                         
SORTOUT
Code:
JAN 02 1980        010280
DEC 01 1989        120289
APR 29 2004        042904
JAN 15 1980        011580
NOV 16 2000        111600
Back to top
View user's profile Send private message
Sureet Mookherjee

New User


Joined: 08 May 2009
Posts: 19
Location: India

PostPosted: Fri May 29, 2009 2:04 pm    Post subject: Reply to: Sort to extract record based on a particular date
Reply with quote

Thanks for the solution
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri May 29, 2009 3:50 pm    Post subject:
Reply with quote

You're welcome. icon_smile.gif
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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm


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