Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Thu Jan 22, 2004 6:11 am Post subject:
Vijay,
Sort products cannot handle date arthimetic.Sometimes you can do simple arthimetic as in your case of just subtracting one day with 99% accuracy. I was able to get everything except for a leap year. I couldn't find a way to determine if the year was a leap year. For the time being I hard coded a value of 29 for feb since the current year is a leap year.
A brief explanation of the job.
The first copy operator will use the date1 and time parameters to get the current date and time from the system and we also use arthimetic functions to subtract 1 from year ,1 from month , 1 from day.
We also split the file into 2 records , C00 & T1
C00 will have a record if the time is greater than 18:00:00. For this we don't have to any subtraction , so we just create a control card with the current date.
Now T1 will contain a record if the time is less than 18:00:00. For this file we need to suntract 1 day. This gets tricky when the current is first of the month. we also need to account for 1st of january where we need to subtract an year. The leap year year comes into picture when the current date is 1st of march.
The second copy operator takes the temp file T1 and splits this into 13 files based on the date. But the best part is that it will create only one file at any given time.
we have subtracted 1 from the month and 1 from the day. so let us say the current date is
2004-01-01 , then subtracting 1 from month and 1 from day makes the month and day 0. so we use this logic to split the files.
The first 12 files (C01 - c12) will account for the current date being the first of every month in the calendar
The last file all will account for all dates of all months.
The final copy step concatenates all these datasets and creates the desired output.
I would suggest an alternate solution to cover the leap year also. Use DB2 and unload a single with current date and current - 1 day from sysibm.sysdummy1. use the dates in sort step to get the desired results.
Joined: 07 Aug 2003 Posts: 46 Topics: 18 Location: Danbury
Posted: Wed Jan 28, 2004 1:22 pm Post subject:
Hi Kolusu,
I am sorry I did not respond to your solution. The first solution is overwhelming. It may be difficult to understand for the people here whoever is going to maintain this. I tried the second one. STEP100 gave some problem which I will try to sort out later. As I know the output of this step I simulated that for the second step. The record length of input file changed from 215 to 221 and so I changed the parameter accordingly. It worked well. I do not want to bother you much. We use SYNCSORT in lot of applications but I did not find any JOBS in which SYNCTOOL is executed. Is there a reference manual available somewhere for SYNCTOOL. Please let me know.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Jan 28, 2004 7:16 pm Post subject:
Vijay,
SYNCTOOL is an unsupported feature of syncsort and there is no documentation at all. Syncsort inc claims that they provide synctool as a mere compatibility tool to DFSORT'S ICETOOL. Icetool is very powerful and it has many features. A vast majority of the features of ICETOOL aren't supported by synctool.
You can split the synctool job into a regular sort job but it would involve more steps.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum