View previous topic :: View next topic
|
Author |
Message |
Rituraj Singh Rawat
New User
Joined: 29 Feb 2012 Posts: 13 Location: India
|
|
|
|
Hey Guys,
I need to create a file with given requirements.
Code: |
START TIMESTAMP : 01/15/2013
END TIMESTAMP : 01/21/2013 |
I am limited to use DFSORT or ICETOOL for it.
MY PROBLEM:
The END TIMESTAMP should be current date and Start Timestamp should be the date 7 days before current date.
Adding more to the problem, I have to write count of records at the top of the file. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It's a funny "TIME" stamp :-)
Have you looked at the DATE functions? |
|
Back to top |
|
|
Rituraj Singh Rawat
New User
Joined: 29 Feb 2012 Posts: 13 Location: India
|
|
|
|
Thanks for reply,
Yeah...laugh all you want on the "TIMESTAMP"
I have been using
Code: |
'END TIMESTAMP',25:': ',DATE=(MD4/),/, |
for writing current date. But I have no idea how to write a 7 days back date for START TIMESTAMP. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Look at the manual. Find the date functions which are available for BUILD etc (if you search for &DATE it might be a quick way to get to the correct place). |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
use the following DFSORT JCL
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,STOPAFT=1
INREC BUILD=(DATE1,2X,DATE1-7)
OUTFIL BUILD=(C'START TIMESTAMP : ',
5,2,C'/',7,2,C'/',1,4,/,
C'END TIMESTAMP : ',
15,2,C'/',17,2,C'/',11,4)
//* |
|
|
Back to top |
|
|
Rituraj Singh Rawat
New User
Joined: 29 Feb 2012 Posts: 13 Location: India
|
|
|
|
Thanks for the help guys....I figured out that DATE=(MD4/)-6 will do the exact thing which I wanted.
My next problem is to write record count(which will require Trailer) in a line and then a date with format YYYYMMWW where WW is the week number of the year in the next line. I know that there is no format like that.. but I can divide the day number with 7 to get WW. but there is no separate format for YYYYMM.
Please guys help... |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Rituraj Singh Rawat wrote: |
Thanks for the help guys....I figured out that DATE=(MD4/)-6 will do the exact thing which I wanted.
My next problem is to write record count(which will require Trailer) in a line and then a date with format YYYYMMWW where WW is the week number of the year in the next line. I know that there is no format like that.. but I can divide the day number with 7 to get WW. but there is no separate format for YYYYMM.
Please guys help... |
Rituraj Singh Rawat,
I believe you are using Syncsort. please post your questions in the JCL forum. As for the week number, merely dividing the day of the year by 7 will not give you the right week number. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
in a line and then a date with format YYYYMMWW where WW is the week number of the year in the next line. |
did anybody consider the rules on how to determine the week number
according to the ISO 8601 standard
for example Sunday 3 January 2010 is in the week 53 of 2009
worth meditating about it a bit |
|
Back to top |
|
|
Rituraj Singh Rawat
New User
Joined: 29 Feb 2012 Posts: 13 Location: India
|
|
|
|
Thanks Kolusu and Enrico,
I figured out that week number can be counted by counting the Thursday of the year. Now I also know that we use SYNCSORT.
So is there any other way I can write YYYYMMWW format ? |
|
Back to top |
|
|
Rituraj Singh Rawat
New User
Joined: 29 Feb 2012 Posts: 13 Location: India
|
|
|
|
Thanks for all the help. By the time I have figured out, how to write week number. I will write it in detail for the help seekers later.
Right now, I need a genuine suggestions from senior members....
What is the best method to hard-code multiple lines in a dataset through SORT, ICEMAN etc. ?? |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Are these lines:
1) To be at the begining of the dataset?
2) To be at the end of the dataset?
3) Have a lrecl of 80?
4) Have a different lrecl with data past 80?
What is the lrecl of the existing dataset?
It would be polite to provide this information ahead of time rather than having to be prompted for it.
Why should I expect otherwise though? |
|
Back to top |
|
|
Rituraj Singh Rawat
New User
Joined: 29 Feb 2012 Posts: 13 Location: India
|
|
|
|
Hi Dave,
This JCL will write some multiple lines on the dataset (lrecl 80).
I do not require any header or trailer. I have used trailer before, but I do not think it a better option to write multiple lines.
If there is any other option to do the same thing, then please give any manual or material to look into details. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Did I mention Header or Trailer in my questions?
I asked begining, end or somewhere else.
I am think along the lines of concatenating the SORTIN DD. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Quote: |
This JCL will write some multiple lines on the dataset (lrecl 80). |
NO, JCL willNOT do that - JCL does not write ANYTHING. It tells the OS which programs you want to execute and what resources they need. |
|
Back to top |
|
|
Rituraj Singh Rawat
New User
Joined: 29 Feb 2012 Posts: 13 Location: India
|
|
|
|
Quote: |
NO, JCL willNOT do that. |
This was the one thing that kept me running, to code what I required....and then I did that. I felt proud.
Though I know JCL is not meant for that, that's why I had to code that in COBOL anyway. |
|
Back to top |
|
|
|