View previous topic :: View next topic
|
Author |
Message |
ARUN.A.NAIR Warnings : 1 New User
Joined: 07 Mar 2007 Posts: 12 Location: MAHARASHTRA
|
|
|
|
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 |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
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 |
|
|
ARUN.A.NAIR Warnings : 1 New User
Joined: 07 Mar 2007 Posts: 12 Location: MAHARASHTRA
|
|
|
|
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 |
|
|
ARUN.A.NAIR Warnings : 1 New User
Joined: 07 Mar 2007 Posts: 12 Location: MAHARASHTRA
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
ARUN.A.NAIR Warnings : 1 New User
Joined: 07 Mar 2007 Posts: 12 Location: MAHARASHTRA
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
|