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

Syncsort to compare two date fields


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

New User


Joined: 07 Jun 2010
Posts: 59
Location: coimbatore

PostPosted: Sat Jun 18, 2011 8:13 pm
Reply with quote

Hi
I have to compare a date field and have to eliminate if it is greater than 90 days.

How could i achieve this?

i have to use syncsort.

Input:
I have my date field like 'yymmdd' in 65th position

example:

Code:
 ----+----1----+----2----+----3----+----4----+----5----+----6----+----7 
 001192400 000000070 99216928                                    110618 
 001192400 000000070 99216928                                    110216 



i used to eliminate by using the below code:
Step1:
I first used the below code and created a Temp file with the 90 days older date at the last.

Code:
 OUTREC BUILD=(1,70,71:DATENS(YMD)-90)   
 INCLUDE COND=(65,6,CH,LE,71,6,CH)       
 SORT FIELDS=COPY                       


Step2:
then i used outrec build option to obtain my desired output with LRecl=70.

but I'm not getting the correct output in the first step:(


Help me.. IF there is any other option to achieve this simpler..?


Thanks,
Sab.
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: Sun Jun 19, 2011 6:25 pm
Reply with quote

Quote:
but I'm not getting the correct output in the first step:(


Help me.. IF there is any other option to achieve this simpler..?
Okay, you are telling us NOTHING and expect us to help you -- getting impatient if it is not fast enough, too? You need to learn how to ask a question and what patience is. This is a voluntary forum -- people answer when and if they have time to do so; if you need a fast answer you should pay a consultant who can give you fast answers.

When you say you are not getting the correct output, do you mean:
1. you are getting no output at all?
2. the job is abending with some system abend code?
3. the job is abending with some user abend code?
4. you are getting output but it does not include all the records you expected?
5. you are getting output but it includes records you did not expect?
6. you are getting message from Syncsort that indicate a problem?
7. something else enitrely -- which you didn't bother to explain?

The usual request is to use the Code tag to paste some sample data records and the expected output from those sample records -- which allows us to verify you have correctly stated what you want done.
Back to top
View user's profile Send private message
sabarikanth

New User


Joined: 07 Jun 2010
Posts: 59
Location: coimbatore

PostPosted: Sun Jun 19, 2011 6:42 pm
Reply with quote

Robert:
Quote:
Okay, you are telling us NOTHING and expect us to help you -- getting impatient if it is not fast enough, too? You need to learn how to ask a question and what patience is


I didnt mean you are Nothing. Just a help would be valuable. Stay cool.

Input:

Code:
 ----+----1----+----2----+----3----+----4----+----5----+----6----+----7 
 001192400 000000070 99216928                                    110618 
 001192400 000000070 99216928                                    110518
 001192400 000000070 99216928                                    110216
 001192400 000000070 99216928                                    110128
 001192400 000000070 99216928                                    100922


Output


Code:
 ----+----1----+----2----+----3----+----4----+----5----+----6----+----7 
 001192400 000000070 99216928                                    110618 
 001192400 000000070 99216928                                    110518

 



the last 3 records should be eliminated but i get those records also in my output.

Actually they should be eliminated since those are 90 days older.

The code which i used has been already given.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Jun 20, 2011 5:01 am
Reply with quote

Hi,

what is the date in position 71-76 after the calculation ?


Gerry
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Jun 20, 2011 7:16 am
Reply with quote

Hi,

something to note, INCLUDE is performed before OUTREC in your example.

This maybe a better approach and no need for Step2
Code:
 SORT FIELDS=COPY                                     
 INREC BUILD=(1,70,71:DATENS(YMD)-90)                 
 OUTFIL INCLUDE=(65,6,CH,LE,71,6,CH),BUILD=(1,70)     


Gerry
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top