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 to compare two date fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort to compare two date fields
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: 8117
Location: East Dubuque, Illinois, USA

PostPosted: Sun Jun 19, 2011 6:25 pm    Post subject:
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    Post subject: Reply to: Syncsort to compare two date fields
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: 1703
Location: Australia

PostPosted: Mon Jun 20, 2011 5:01 am    Post subject:
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: 1703
Location: Australia

PostPosted: Mon Jun 20, 2011 7:16 am    Post subject:
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    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 How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm


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