Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Comparing date with current date in header record.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Comparing date with current date in header record.
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

Active Member


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

PostPosted: Mon Nov 21, 2011 10:33 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Tue Nov 22, 2011 4:48 am    Post subject: Reply to: Comparing date with current date in header record.
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    Post subject:
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: 1703
Location: Australia

PostPosted: Tue Nov 22, 2011 10:57 am    Post subject:
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    Post subject:
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

Active Member


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

PostPosted: Tue Nov 22, 2011 7:35 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Tue Nov 22, 2011 8:15 pm    Post subject: Reply to: Comparing date with current date in header record.
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    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
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us