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

Sort to extract record based on a particular date


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 2481
Location: @my desk

PostPosted: Fri May 29, 2009 10:50 am
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
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: 355
Location: New York

PostPosted: Fri May 29, 2009 11:18 am
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
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: 355
Location: New York

PostPosted: Fri May 29, 2009 11:24 am
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: 2481
Location: @my desk

PostPosted: Fri May 29, 2009 11:31 am
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
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: 355
Location: New York

PostPosted: Fri May 29, 2009 11:46 am
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: 2481
Location: @my desk

PostPosted: Fri May 29, 2009 12:24 pm
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
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: 2481
Location: @my desk

PostPosted: Fri May 29, 2009 12:55 pm
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
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: 2481
Location: @my desk

PostPosted: Fri May 29, 2009 3:50 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top