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

Send email if date variable of a file matches current date


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ARUN.A.NAIR
Warnings : 1

New User


Joined: 07 Mar 2007
Posts: 12
Location: MAHARASHTRA

PostPosted: Thu Mar 08, 2007 5:26 pm
Reply with quote

Hi,

I WANT TO WRITE A JCL (CANNOT AFFORD TO WRITE A COBOL PROGRAM FOR THIS) THROUGH WHICH I HAVE TO COMPARE A FILE (WHICH HAS AN INDICATOR( 1 BYTE LENGTH) AND DATE AS IT'S FIELDS) WITH THE CURRENT DATE. IF THE DATE IN THE FILE MATCHES WITH THE CURRENT DATE THEN I HAVE TO SEND AN EMAIL. CAN ANYONE HELP ME REGARDING THIS PLEASE :-)

THANKS AND REGARDS,
ARUN.A.NAIR

Warning: Caps ON
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu Mar 08, 2007 5:46 pm
Reply with quote

Hi,

You can easily compare dates using sort.

If you want to select records in which a 10-character date in the form C?yyyy/mm/dd? starting in position 42 equals today?s date, write: INCLUDE COND=(42,10,CH,EQ,DATE1(/)).

You can use the above condition to make a temporary sort out,
and then using that file for ur Email step.

Thanks,
-Kapil.
Back to top
View user's profile Send private message
ARUN.A.NAIR
Warnings : 1

New User


Joined: 07 Mar 2007
Posts: 12
Location: MAHARASHTRA

PostPosted: Fri Mar 09, 2007 6:04 pm
Reply with quote

Hi,

Thanks for the speedy reply Kapil.

Can you please advice me how I can reformat the date field to check a field which is in 'yyyy-mm-dd' format ???

Thanks and regards,
Arun.A.Nair
Back to top
View user's profile Send private message
ARUN.A.NAIR
Warnings : 1

New User


Joined: 07 Mar 2007
Posts: 12
Location: MAHARASHTRA

PostPosted: Fri Mar 09, 2007 6:11 pm
Reply with quote

Hi,

I just tried to run the program with the condition which was adviced in the above reply. But it seems like "INCLUDE COND=(42,10,CH,EQ,DATE1(/)). " is accepting any date in that format and not the current date. Can anyone advice me regarding getting the current date????
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Mar 09, 2007 6:48 pm
Reply with quote

The code that was given earlier works fine.

What is the RECFM and LRECL of your input file? What do you want for the RECFM and LRECL of the output file?

What position in the file does the date start in? What format is it in (you mentioned it should be yyyy-mm-dd)?
Back to top
View user's profile Send private message
ARUN.A.NAIR
Warnings : 1

New User


Joined: 07 Mar 2007
Posts: 12
Location: MAHARASHTRA

PostPosted: Fri Mar 09, 2007 7:00 pm
Reply with quote

Hi,

Thanks for the reply. I am sorry as I didn't clearly mention all the parm's .
The input and output RECFM is FBA and the LRECL is 80 for both. The date starts in 2nd position.

Hence I used the following code :-
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(2,8,CH,EQ,DATE1(/))
//*

But the output file gets populated even when I mention any other dates other than today's date of the month i.e, when I enter date as 2007/03/31 then also the output file gets populated. But when I give date with different month or year the output file is not populated. I also would like to know how to format the date field so that i can compare a date in 'yyyy-mm-dd' format.

Thanks and regards,
Arun.A.Nair
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Mar 09, 2007 7:17 pm
Reply with quote

This code:

Code:

//STEPXXXX EXEC PGM=ICEMAN
//SORTIN   DD   DSN=input fba,lrecl=80
//SORTOUT  DD   DSN=output fba,lrecl=80
//SYSOUT   DD   SYSOUT=*                                               
//SYSIN    DD   *                                                     
  OPTION COPY                                                         
  INCLUDE COND=(2,10,CH,EQ,DATE1(-))                                   
/*                                                                     


Took this input:

Code:

12007-03-06
12007-03-07
02007-03-08
02007-03-09
02007-03-06
02007-03-09
12007-03-07
02007-03-06


and gave this output:

Code:

02007-03-09   
02007-03-09   
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Mar 13, 2007 5:51 pm
Reply with quote

ARUN.A.NAIR wrote:
Hence I used the following code :-
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(2,8,CH,EQ,DATE1(/))
//*

But the output file gets populated even when I mention any other dates other than today's date of the month i.e, when I enter date as 2007/03/31 then also the output file gets populated. But when I give date with different month or year the output file is not populated. I also would like to know how to format the date field so that i can compare a date in 'yyyy-mm-dd' format.
That is because you are including on the "yyyy-mm-" and not the "dd"......"=(2,8,CH"........
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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
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
Search our Forums:

Back to Top