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

Using the current-date or todays-date in a sort compare


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Thu Oct 11, 2007 6:33 am
Reply with quote

I would like to compare a year in a file (columns 1-2) again the current-date, todays-date, the run-date, system-date or whatever it is called in dfsort. If the files date is less that 3 years from the system-date year, put it in one file, or else put it in another.

Sharon in LA
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Oct 11, 2007 8:47 pm
Reply with quote

Quote:
If the files date is less that 3 years from the system-date year


That requirement is a little confusing. Am example of input and output would have helped. However, here's a DFSORT job that should give you the idea of how to do this kind of thing.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD *
YR,S'&YR2'
/*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
* Create a DFSORT Symbol as:
* TARG_YR,Y'xx'
* where xx is current_yy-3
  INREC OVERLAY=(51:YR,
    1:C'TARG_YR,Y''',51,2,ZD,SUB,+3,EDIT=(TT),C'''')
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD *
98
99
00
01
02
03
04
05
06
07
/*
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY,Y2PAST=1980
* Use the TARG_YR symbol in INCLUDE.
  OUTFIL FNAMES=OUT1,INCLUDE=(1,2,Y2C,LT,TARG_YR)
  OUTFIL FNAMES=OUT2,SAVE
/*


OUT1 would have:

98
99
00
01
02
03

OUT2 would have:

04
05
06
07

If that's not what you want, then please explain more clearly what you want and show an example of input and expected output.
Back to top
View user's profile Send private message
Sysaron

New User


Joined: 28 Sep 2005
Posts: 55
Location: USA

PostPosted: Wed Oct 17, 2007 3:20 am
Reply with quote

HI Frank,

I have an unsorted input file with YYMMDDxxxxxxxxxxxx for the records.
Like:
941025xxxxxxxxxxxxxx
061003xxxxxxxxxxxxxx
970314xxxxxxxxxxxxxx
070809xxxxxxxxxxxxxx

The current-date or system-date is now "2007-10-16 14:50"
Records 2 and 4 have a 'difference year' that is not greater than 3
2007-2006=1
2007-2007=0
Records 2 and 4 go into output file 1.

Records 1 and 3 go into output file 2.
2007-1994=13
2007-1997=10

Of course I will compare the month and day as well, but I was keeping it simple.

Thank you so much for your help. I know it will be simple if ICEMAN can access the system-date/time. But I dont know what format it will look like, or how to store it for the compare.

Sysaron
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Oct 17, 2007 3:38 am
Reply with quote

Sysaron wrote:
I know it will be simple if ICEMAN can access the system-date/time. But I dont know what format it will look like, or how to store it for the compare.
Have you looked at the manual?
DFSORT Data Formats
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Oct 17, 2007 11:33 am
Reply with quote

This SORT JOB compares the Year and puts the records in to File1 and File2 as per your specifications
Code:
//*******************************************************               
//STEP1    EXEC PGM=ICEMAN                                             
//SYSOUT   DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
941025XXXXXXXXXXXXXX                                                   
061003XXXXXXXXXXXXXX                                                   
970314XXXXXXXXXXXXXX                                                   
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
070809XXXXXXXXXXXXXX                                                   
/*                                                                     
//FILE1    DD SYSOUT=*                                                 
//FILE2    DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
   OPTION COPY                                                         
   OUTREC OVERLAY=(25:DATE1,35:27,2,ZD,SUB,1,2,ZD,TO=ZD,LENGTH=2)       
   OUTFIL FNAMES=FILE2,INCLUDE=(35,2,ZD,LT,0),BUILD=(1,22)             
   OUTFIL FNAMES=FILE1,SAVE,BUILD=(1,22)                               
/*                                                                     

FILE1:
Code:
061003XXXXXXXXXXXXXX
070809XXXXXXXXXXXXXX

File2:
Code:
941025XXXXXXXXXXXXXX
970314XXXXXXXXXXXXXX
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Oct 17, 2007 9:06 pm
Reply with quote

Sysaron,

The job I provided gives the output you asked for. For your example, the output is:

OUT1:

941025XXXXXXXXXXXXXX
970314XXXXXXXXXXXXXX

OUT2:

061003XXXXXXXXXXXXXX
070809XXXXXXXXXXXXXX

If you want to switch the output, you could use:

Code:

  OUTFIL FNAMES=OUT2,INCLUDE=(1,2,Y2C,LT,TARG_YR)
  OUTFIL FNAMES=OUT1,SAVE


Quote:
Of course I will compare the month and day as well, but I was keeping it simple.

Thank you so much for your help. I know it will be simple if ICEMAN can access the system-date/time. But I dont know what format it will look like, or how to store it for the compare.


I set up the solution to just handle the 2-digit year date as you requested. Using the entire date would require a different solution. If you want help with that, you need to explain exactly what you want to do in terms of comparing the month and day as well.

Note: "Keeping it simple" by providing only a part of the requirement isn't a good strategy on this board. You give a piece of your requirement - I show you how to do it - then you come back and say that wasn't really my requirement so now I need this. That just wastes time.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top