I want to check the date & time field in header record, if the date & time is with in past 7 days keep as it is,
else change it to current date & time.
Header type - 10
detail - 20
trailer - 30
date format MMDDYYYY , time format(HHMMSSS) :- 2230023
eg:-
10 11102011 2230023
20 ***********
30 ***********
Only i want to change header date and time if it is not with in past 1 week from current date.
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
Well, this is certainly a wide open question.
Are you asking:
1. Can I just do it in JCL (even though a million posts have pounded into our heads that JCL merely runs programs and connects them to data)?
2. Even thought I list COBOL in my profile, how do I compare/manipulate a simple date field, and how do I determine the current date in COBOL?
3. How do I read and then rewrite a record (in, say, COBOL)?
4. Is there some other program to use; e.g., sort? But you poisted this in the JCL forum.
Other possibilities I'm sure.
Please be very specific - what is holding you up here on a beginner programming task?
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
What is the source of your date/time on your file header, and the source of the date/time you want to compare it to.
I always strongly suggest using a business date, unless you have a really specific reason not to (for instance, processing system data rather than business data). Reason being, if you ever want to do a re-run, or any testing up the cycle, you are creating a problem for yourself if you use a system date.
As Ph... Phill has said, we need more information. Try to describe your requirement as exactly as you can.
My requirement was, i have an input file. In that there is a date field in header ( MMDDYYYY format).
I want to compare that date with the currrent date, if it is <7 days i want to set the return code of the job as 8 , else 0.
To acheive this, i am planning to do a sort card, where it compares the date in input file with current date. If difference is <7 then set the return code to 8, else 0.
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
Note Bill's warning: If you use current date, rather than business date (or what I call data date), then you cannot rerun this on a later date (meaning even 12:01am the next day).
It's nice to use a utility (e.g., sort) for everything, but a robust system may require a slightly more sophisticated design.
if the date & time is with in past 7 days keep as it is,
else change it to current date & time.
Quote:
My requirement was, i have an input file. In that there is a date field in header ( MMDDYYYY format).
I want to compare that date with the currrent date, if it is <7 days i want to set the return code of the job as 8 , else 0.
just take a decision..
nobody likes to waste time on a wishy washy description of the requirement