IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need to perform Date manipulation in Trailer


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 07, 2013 4:37 pm
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 07, 2013 8:13 pm
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
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
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Feb 20, 2013 1:13 am
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
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
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: 792
Location: Pennsylvania

PostPosted: Fri Feb 22, 2013 7:17 pm
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
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: 792
Location: Pennsylvania

PostPosted: Fri Feb 22, 2013 7:45 pm
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: 2455
Location: Hampshire, UK

PostPosted: Sat Feb 23, 2013 5:09 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
No new posts Fetch data from programs execute (dat... DB2 3
Search our Forums:

Back to Top