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

Comparing date with current date in header record.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Mon Nov 21, 2011 6:22 pm
Reply with quote

Hi All,

Please guide me how to do the below requirement.

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.

Please let me know how to do this.

Thanks,
Ram.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Mon Nov 21, 2011 10:33 pm
Reply with quote

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?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Nov 22, 2011 4:48 am
Reply with quote

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.
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Tue Nov 22, 2011 10:04 am
Reply with quote

Hi Bill / Phill

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.

Hope i explained clearly.

Thanks,
Ram.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Nov 22, 2011 10:57 am
Reply with quote

Hi,

try playing around with this
Code:
//S1       EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
10 11102011SUB30023                                               
20 ***********                                                     
30 ***********                                                     
/*                                                                 
//OUT      DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'10'),                           
               OVERLAY=(81:8,4,4,2,6,2,89:DATE1-7))               
 OUTFIL FNAMES=OUT,NULLOFL=RC4,                                   
                   INCLUDE=(1,2,CH,EQ,C'10',&,                     
                    81,8,CH,LT,89,8,CH)                           
/*



Gerry
Back to top
View user's profile Send private message
Rambhupalchowdary

New User


Joined: 19 Aug 2010
Posts: 47
Location: Hyderabad

PostPosted: Tue Nov 22, 2011 12:55 pm
Reply with quote

Thanks Gcicchet,

I will make necessary changes as per my requirement and let you know
if works or not.

Thanks,
Ram.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Tue Nov 22, 2011 7:35 pm
Reply with quote

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.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Nov 22, 2011 8:15 pm
Reply with quote

Quote:
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 icon_evil.gif
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top