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
 

 

Extract the creation date of the dataset using SAS

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

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Fri Feb 16, 2007 5:07 pm    Post subject: Extract the creation date of the dataset using SAS
Reply with quote

Hi ,

I am using the following piece of code to extract the creation date of the dataset :

DATA ONE;
INFILE TESTGDG JFCB=JFCB;

BYTE81 = SUBSTR(JFCB,81,1) ;
CREATL = PUT(INPUT(BYTE81,PD1.),$2.) ;
BYTE82 = SUBSTR(JFCB,82,2) ;
CREAT2 = PUT(INPUT(BYTE82,IB2.),$3.) ;
CREATED = PUT(DATEJUL(INPUT(CREATL || CREAT2,5.)),MMDDYY10.);
PROC PRINT;
RUN;


The problem is
this code works fine if the dataset is created in 2006
but when I run this job on datasets created in 2007 this doesnot works

What I analysed is that its not able to extract year part correctly.
CREATL = ' -6 '

Actually I am a novice in SAS so I am not able to get why this output is coming.

Can any one help ?
Thanks,
-Kapil.
Back to top
View user's profile Send private message

Alan Voss

New User


Joined: 29 Nov 2006
Posts: 32
Location: Jacksonville, FL

PostPosted: Fri Feb 16, 2007 10:37 pm    Post subject:
Reply with quote

The following works for me.
DATA XX;
INFILE COMH JFCB=JFCB;
CRJULIANYR = INPUT(SUBSTR(JFCB, 81,1),PIB1.)+1900;
CRJULIANDAY = INPUT(SUBSTR(JFCB, 82,2),PIB2.);
CRDATE = DATEJUL(CRJULIANYR*1000+CRJULIANDAY);
DROP CRJULIANYR CRJULIANDAY;
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Mon Feb 19, 2007 11:58 am    Post subject: Re: Extract the creation date of the dataset using SAS
Reply with quote

Hi Alan,

I did run ur SAS and got the following output :

Obs CRJULIANYR CRJULIANDAY CRDATE

1 2007 48 17214

The final date is not getting calculated properly, where as the individual day and year part are doing well.

Thanks,
-Kapil.
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Mon Feb 19, 2007 12:30 pm    Post subject: Re: Extract the creation date of the dataset using SAS
Reply with quote

I think I got it.
I converted the output to MMDDYY10.

and its working now .

Thanks,
-kapil.
Back to top
View user's profile Send private message
Alan Voss

New User


Joined: 29 Nov 2006
Posts: 32
Location: Jacksonville, FL

PostPosted: Mon Feb 19, 2007 7:35 pm    Post subject:
Reply with quote

One final piece of advice, since, by your own admission, you are a SAS novice.

Get really familiar with SAS dates, times, and datetimes. These are all numeric values and therefore, without formatting, may look unusual. However, once you learn how to display them and understand how to use the SAS functions for working with them, you will come to appreciate their simplicity and utility.

Al
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 FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
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 To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm


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