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
 

 

Send email if date variable of a file matches current date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Send email if date variable of a file matches current date
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    Post subject: Re: DATE FUNCTION IN JCL
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    Post subject:
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    Post subject:
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

Moderator Team Head


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

PostPosted: Fri Mar 09, 2007 6:48 pm    Post subject: Re: Send email if date variable of a file matches current da
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    Post subject:
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

Moderator Team Head


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

PostPosted: Fri Mar 09, 2007 7:17 pm    Post subject: Re: Send email if date variable of a file matches current da
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: 3158
Location: Tucson AZ

PostPosted: Tue Mar 13, 2007 5:51 pm    Post subject:
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    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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
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 generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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