Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to perform Date manipulation in Trailer

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Rituraj Singh Rawat

New User


Joined: 29 Feb 2012
Posts: 13
Location: India

PostPosted: Thu Feb 07, 2013 4:32 pm    Post subject: Need to perform Date manipulation in Trailer
Reply with quote

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. icon_rolleyes.gif

Adding more to the problem, I have to write count of records at the top of the file.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Feb 07, 2013 4:37 pm    Post subject: Reply to: Need to perform Date manipulation in Trailer
Reply with quote

It's a funny "TIME" stamp :-)

Have you looked at the DATE functions?
Back to top
View user's profile Send private message
Rituraj Singh Rawat

New User


Joined: 29 Feb 2012
Posts: 13
Location: India

PostPosted: Thu Feb 07, 2013 5:01 pm    Post subject:
Reply with quote

Thanks for reply,

Yeah...laugh all you want on the "TIMESTAMP" icon_lol.gif icon_lol.gif

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Feb 07, 2013 8:13 pm    Post subject: Reply to: Need to perform Date manipulation in Trailer
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Feb 09, 2013 2:38 am    Post subject:
Reply with quote

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
View user's profile Send private message
Rituraj Singh Rawat

New User


Joined: 29 Feb 2012
Posts: 13
Location: India

PostPosted: Tue Feb 19, 2013 7:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Feb 20, 2013 12:53 am    Post subject:
Reply with quote

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Feb 20, 2013 1:13 am    Post subject: Reply to: Need to perform Date manipulation in Trailer
Reply with quote

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
View user's profile Send private message
Rituraj Singh Rawat

New User


Joined: 29 Feb 2012
Posts: 13
Location: India

PostPosted: Wed Feb 20, 2013 12:41 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Rituraj Singh Rawat

New User


Joined: 29 Feb 2012
Posts: 13
Location: India

PostPosted: Fri Feb 22, 2013 7:09 pm    Post subject:
Reply with quote

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
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Fri Feb 22, 2013 7:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Rituraj Singh Rawat

New User


Joined: 29 Feb 2012
Posts: 13
Location: India

PostPosted: Fri Feb 22, 2013 7:39 pm    Post subject:
Reply with quote

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
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Fri Feb 22, 2013 7:45 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Sat Feb 23, 2013 5:09 am    Post subject:
Reply with quote

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
View user's profile Send private message
Rituraj Singh Rawat

New User


Joined: 29 Feb 2012
Posts: 13
Location: India

PostPosted: Sun Feb 24, 2013 3:39 am    Post subject:
Reply with quote

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. icon_cool.gif

Though I know JCL is not meant for that, that's why I had to code that in COBOL anyway. icon_sad.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 TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us