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

convert number of days to date format.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Jul 12, 2012 12:48 pm
Reply with quote

hi,
is there any way i can convert number of days to date through jcl?
i need the date in ISO FORMAT.i searched the forum but did not help

Regds,
useit
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Jul 12, 2012 12:53 pm
Reply with quote

Hello,
Sounds like a Julian date to X date format conversion.
Show us the input and output records. Someone will be able to help.
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Jul 12, 2012 2:10 pm
Reply with quote

from HF to ISO format.

for example input is +11881

after converting it should be 2012-07-12

Regds,
useit
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jul 12, 2012 3:01 pm
Reply with quote

What release of DFSort are you at? Not sure? Look here: How to determine your DFSORT function level.
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Jul 12, 2012 3:14 pm
Reply with quote

hi we have ICE201I H record type

Regds,
useit
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Jul 12, 2012 3:38 pm
Reply with quote

useit wrote:
from HF to ISO format.

for example input is +11881

after converting it should be 2012-07-12

Regds,
useit

This suggests that you're getting data from a toy computer with an epoch of 1 January 1980?
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Jul 12, 2012 3:43 pm
Reply with quote

Hello try this,
Code:
//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
11881                                                   
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  INREC IFOUTLEN=80,                                   
  IFTHEN=(WHEN=INIT,OVERLAY=(81:C'01011980')),         
  IFTHEN=(WHEN=INIT,OVERLAY=(01:81,8,Y4W,ADDDAYS,1,5,ZD,
  TOGREG=Y4T(-)))                                       
//*                                                     


Output:
Code:
2012-07-12


I dont know what HF format is. -11881 pointed to Jan 1 1980. So assumed that dates begin from Jan 1 1980
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Thu Jul 12, 2012 4:20 pm
Reply with quote

vasanth,
correct the date begins from 1 January 1980.how did you say that 11881 is pointing at jan 1 1980?

thanx for your solution.i got confused with the input date format.

Regds,
useit
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Jul 12, 2012 4:31 pm
Reply with quote

Hello,
This SAS program told that -11881 was 01 Jan 1980.
Code:
data _null_;         
now = today() - 11881;
put now ddmmyy10.;   
run;                 


output: 01/01/1980
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: Fri Jul 13, 2012 5:34 am
Reply with quote

I can't test it at the moment, but you could perhaps try defining a SYMNAME for the literal, rather than adding the literal to the end of the record.

Might not make much nevermind with one record, but as a bonus it removes the need to know where to extend the data with VB vs FB. Can have a nice descriptive name as well. OLDTOYCOMPUTERSTARTDATE or something even better...
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
Search our Forums:

Back to Top