View previous topic :: View next topic |
Author |
Message |
juan00982 Beginner
Joined: 29 Jun 2004 Posts: 36 Topics: 13 Location: PR
|
Posted: Tue Nov 08, 2005 3:21 pm Post subject: Utility or JCL for OS/390 to change system date |
|
|
Hi:
I would like to be able to alter the system date through jCL or a utility. The purpose for this is that I have alot of batch programs and I want to be able to process data on a saturday, but I want the cobol programs to reflect fridays date or process data on sunday reflecting mondays date.
Any help will be greatly apreciated.
Thanks,
Juan |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Nov 08, 2005 4:59 pm Post subject: |
|
|
Quote: |
The purpose for this is that I have alot of batch programs and I want to be able to process data on a saturday, but I want the cobol programs to reflect fridays date or process data on sunday reflecting mondays date.
|
JUAN00982,
why not use the day-of-week function in the cobol program and then add days to it as you like
DAY-OF-WEEK represents the day of the week according to the following values:
Code: |
1 represents Monday 5 represents Friday
2 represents Tuesday 6 represents Saturday
3 represents Wednesday 7 represents Sunday
4 represents Thursday
|
Code: |
01 WS-DAY-OF-WEEK PIC 9(1).
01 WS-PROCESS-DATE PIC 9(8).
01 WS-CURR-DATE PIC 9(8).
PROCEDURE DIVISION.
MOVE FUNCTION CURRENT-DATE(1 : 8) TO WS-CURR-DATE
ACCEPT WS-DAY-OF-WEEK FROM DAY-OF-WEEK
EVALUATE WS-DAY-OF-WEEK
WHEN 6
COMPUTE WS-PROCESS-DATE = FUNCTION DATE-OF-INTEGER
(FUNCTION INTEGER-OF-DATE(WS-CURR-DATE) - 1)
WHEN 7
COMPUTE WS-PROCESS-DATE = FUNCTION DATE-OF-INTEGER
(FUNCTION INTEGER-OF-DATE(WS-CURR-DATE) + 1)
WHEN OTHER
MOVE WS-CURR-DATE TO WS-PROCESS-DATE
END-EVALUATE
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue Nov 08, 2005 5:06 pm Post subject: |
|
|
Back in Y2K days there were products that could do this. I think they frontended the TIME SVC and branch addresses. Changing the date isn't a standard way to do things in z/OS though. The system date functions reflect only the system date and there is no per-address-space date maintained. Frontending SVCs is generally considered bad practice because it can lead to data integrity errors, security exposures, and system stability exposures. I agree with Kolusu that this is a function your program should handle at the application level. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Nov 08, 2005 5:14 pm Post subject: |
|
|
Here is an alternative. This uses the dayofweek function of db2 which returns the day of week in the following format.
Code: |
WHEN 1 THEN 'SUNDAY'
WHEN 2 THEN 'MONDAY'
WHEN 3 THEN 'TUESDAY'
WHEN 4 THEN 'WEDNESDAY'
WHEN 5 THEN 'THURSDAY'
WHEN 6 THEN 'FRIDAY'
WHEN 7 THEN 'SATURDAY'
|
Code: |
SELECT (CASE DAYOFWEEK(CURRENT DATE)
WHEN 1 THEN DATE(CURRENT DATE + 1 DAY)
WHEN 7 THEN DATE(CURRENT DATE - 1 DAY)
ELSE CURRENT DATE
END)
,CHAR(' ',70)
FROM SYSIBM.SYSDUMMY1;
|
The above sql will create a 80 byte dataset with the required date.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
juan00982 Beginner
Joined: 29 Jun 2004 Posts: 36 Topics: 13 Location: PR
|
Posted: Wed Nov 09, 2005 7:30 am Post subject: |
|
|
Hi All
Thanks for your help, however, we have an application with over 500 cobol module and modifying them all it's impossible due to they are updated 3 times a year and tracking all the changes and modifying each time we receive a new version will make things difficult. That's why I didn't consider making changes to code to do this, I wanted to do this at system level so that when the program request system date it'll get the desired date. We used to do this back on OS/2, I was just trying to find the equivalent in OS/390 either with JCL, REXX, Utility or any other method exept making changes to the source code.
Thanks anyways for all your suggestions and if by anychance you find anything please let me know.
Juan |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Nov 09, 2005 8:26 am Post subject: |
|
|
Quote: |
Thanks anyways for all your suggestions and if by anychance you find anything please let me know.
|
juan00982,
hmm did you overlook my second post in this topic where I suggested an alternative ? You can put the sql as input to DSNTIAUL and unload the desired date. Once you have that you can pass that value as a parm to your cobol pgms
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
juan00982 Beginner
Joined: 29 Jun 2004 Posts: 36 Topics: 13 Location: PR
|
Posted: Wed Nov 09, 2005 8:36 am Post subject: |
|
|
Hi Kolusu,
No, I didn't over looked your post. What you propose will require modification to the software source code to read the date file parameter of using the system date, which is a great idea but in my case it'll require alot of maintenance everytime there's an updated version of the software which consist of over 500 modules and alot of these modules are callabe which means that one calls the other and the other calls 3 other modules and so on. The application I work with is a complicated one which is why I resigned to the idea of making this type of modification.
Thanks again for your help.
Juan |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Nov 09, 2005 8:44 am Post subject: |
|
|
juan00982,
How are the pgms getting the system date ? Do they have an ACCEPT statement in all of the programs?
You might be able to change the system date but what about other pgms which access the system date, wouldn't they be effected ?
Ideally I would code a small sub-routine to calculate the system date and call that module from the programs. So in future if you ever want to play around with dates, all you need is to change the subroutine.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Bithead Advanced

Joined: 03 Jan 2003 Posts: 550 Topics: 23 Location: Michigan, USA
|
|
Back to top |
|
 |
juan00982 Beginner
Joined: 29 Jun 2004 Posts: 36 Topics: 13 Location: PR
|
Posted: Wed Nov 09, 2005 9:32 am Post subject: |
|
|
Kolusu,
Yes, all the programs uses the ACCEPT statement. Your idea is perfect, I'm not saying that's wrong. I wanted to find a way to just affect the modules that are running in the JCL, like a parm in the JCL that affected the system date. I'm just trying to find a solution to my problem.
The other problem that I have is that I can't go on changing all the modues that use the accept because it's constantly changing, 3 times a year I receive updates to the software and it's going to be difficult to maintain during each release.
When I run batch programs, I bring down my CICS server, the only things that are running are system programs which I would need to verify if it affects it's processing, but, there's only one way to find out.
Juan |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Wed Nov 09, 2005 5:33 pm Post subject: |
|
|
Hi Juan,
I'm just curious about what you mean when you say you receive software updates. Are these code updates from a vendor? What I'm getting at is that if this is a common and recurring problem, shouldn't you (in a perfect world) be able to get the vendor or whomever is maintaining that code for those updates to modify the code so that all date processing goes through a single point? Then you need only alter that one module or better yet modify only its input. Ideally, the input to the program would include a date offset that would not require any code modification. But the gist of my question is can the system be changed to centeralize date aquisition? |
|
Back to top |
|
 |
|
|