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
 

 

Date conversion using DFSORT
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
avelayudhan

New User


Joined: 30 Nov 2005
Posts: 26

PostPosted: Wed Nov 30, 2005 7:04 pm    Post subject: Date conversion using DFSORT
Reply with quote

Hi,

Date conversions are possible in DFSORT? For example, to convert Julian date format to greg format? Any help is greatly appreciated.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Nov 30, 2005 9:47 pm    Post subject:
Reply with quote

What is the length and format of your Julian date (CH, PD, ?) and what does it look like (yyyyddd? yyddd?). What is the length and format of the gregorian date you want and what does it look like?
Back to top
View user's profile Send private message
avelayudhan

New User


Joined: 30 Nov 2005
Posts: 26

PostPosted: Wed Nov 30, 2005 9:52 pm    Post subject:
Reply with quote

File contains date in Julain format in PD in the format yyyyddd. Like to convert into the format yyyymmdd, or any other format that the situation demands.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Nov 30, 2005 10:55 pm    Post subject:
Reply with quote

DFSORT does not really have date conversion functions, but for the case you're talking about, there is a trick we can use to convert from P'yyyyddd' to Z'yyyymmdd' or P'yyyymmdd'.

Are you only dealing with 20yy dates or are you dealing with 19yy and 20yy dates? And do you want the output date to be ZD or PD?
Back to top
View user's profile Send private message
avelayudhan

New User


Joined: 30 Nov 2005
Posts: 26

PostPosted: Wed Nov 30, 2005 10:59 pm    Post subject:
Reply with quote

Yaeger,

We are dealing with both 19 and 20 dates. Whether the output to be ZD or PD does not have a bearing on the method to be used, right?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Nov 30, 2005 11:26 pm    Post subject:
Reply with quote

Here's a DFSORT job that will handle both 19 and 20 dates and convert to both Z'yyyymmdd' and P'yyyymmdd'. I assumed the input P'yyyyddd' date starts in position 1, but you can change that as appropriate.

Code:

//S1  EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
* Convert X'19yyddds' to X'00yyddds'.
* Convert X'20yyddds' to X'01yyddds'.
  INREC FIELDS=(1:1,1,CHANGE=(1,X'19',X'00',X'20',X'01'),
    NOMATCH=(X'02'),2:2,3)
* Use SMF date format (DT1) to convert X'0cyyddds' to Z'yyyymmdd'
* and P'yyyymmdd'.
  OUTREC FIELDS=(1,4,DT1,X,1,4,DT1,TO=PD,LENGTH=5)
/*
Back to top
View user's profile Send private message
avelayudhan

New User


Joined: 30 Nov 2005
Posts: 26

PostPosted: Thu Dec 01, 2005 12:49 am    Post subject:
Reply with quote

My date field (PD - YYYYDDD starts at 38. I used the following card, seems to have problems:

Code:

//SYSIN    DD    *                                         
   OPTION COPY                                               
   INREC FIELDS=(38:1,1,CHANGE=(1,X'19',X'00',X'20',X'01'), 
     NOMATCH=(X'02'),39:2,3)                                 
   OUTREC FIELDS=(38,4,DT1,X,38,4,DT1,TO=PD,LENGTH=5)       
/*                                                         
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Dec 01, 2005 2:42 am    Post subject:
Reply with quote

Quote:
seems to have problems


You didn't change the statements correctly for a field starting at 38. Here's what you need:

Code:

//SYSIN    DD    * 
   OPTION COPY
   INREC FIELDS=(1:38,1,CHANGE=(1,X'19',X'00',X'20',X'01'),
      NOMATCH=(X'02'),2:39,3)                               
   OUTREC FIELDS=(1,4,DT1,X,1,4,DT1,TO=PD,LENGTH=5)         
/*   


The converted fields will start in position 1 of the output record.
Back to top
View user's profile Send private message
avelayudhan

New User


Joined: 30 Nov 2005
Posts: 26

PostPosted: Fri Dec 02, 2005 1:41 am    Post subject:
Reply with quote

Yaeger..you rocks! thanks for all the help..looking forward for more of such great help. icon_biggrin.gif
Back to top
View user's profile Send private message
avelayudhan

New User


Joined: 30 Nov 2005
Posts: 26

PostPosted: Sat Dec 03, 2005 12:25 am    Post subject:
Reply with quote

Yaeger,

One more thing. The date format of DT1 is yyyymmdd, right? is there way to get the format to mmddyyyy? I have not seen any other mask that does this.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sat Dec 03, 2005 12:50 am    Post subject:
Reply with quote

DT1 actually converts a P'0cyyddd' date to a Z'yyyymmdd' date. You could then move the Z'yyyymmdd' bytes around to get Z'mmddyyyy', and if necessary, convert that to PD. Here's an example:

Code:

  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
* Convert X'19yyddds' to X'00yyddds'.
* Convert X'20yyddds' to X'01yyddds'
          BUILD=(1:38,1,CHANGE=(1,X'19',X'00',X'20',X'01'),
            NOMATCH=(X'02'),2:39,3)),
* Use SMF date format (DT1) to convert X'0cyyddds' to Z'yyyymmdd'
        IFTHEN=(WHEN=INIT,BUILD=(1,4,DT1)),
* Convert Z'yyyymmdd' to Z'mmddyyyy' - stop here if you don't
* want P'0mmddyyyy'
        IFTHEN=(WHEN=INIT,BUILD=(5,4,1,4)),
* Copy Z'mmddyyy' and convert Z'yyyymmdd' to P'0mmddyyyy'
        IFTHEN=(WHEN=INIT,BUILD=(1,8,X,1,8,ZD,TO=PD,LENGTH=5))
Back to top
View user's profile Send private message
SJI77

New User


Joined: 11 Jan 2007
Posts: 4
Location: Chennai

PostPosted: Thu Jan 11, 2007 6:38 pm    Post subject: Julian to Greg
Reply with quote

Yaeger,

I have a requirement like this. A Julian date of 5 digits (YYDDD) needs to be converted to Greg format of (MM/DD/YYYY). Input field is in CH format and want the output also in same. The date starts at position 6 in a FB file. Please let me know how I can achieve this using the ICEMAN?

Thanks in advance
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jan 11, 2007 10:39 pm    Post subject:
Reply with quote

What range of years does YY represent - for example, 2000-2099 or 1980-2079 or what?
Back to top
View user's profile Send private message
SJI77

New User


Joined: 11 Jan 2007
Posts: 4
Location: Chennai

PostPosted: Fri Jan 12, 2007 11:22 am    Post subject: Julian to Greg (contd)
Reply with quote

The date ranges between 1980-2079.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Jan 12, 2007 9:47 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you want. It's quite similar to the job I showed earlier.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY,Y2PAST=1980
  INREC IFTHEN=(WHEN=INIT,BUILD=(6,5,Y2T,TO=PD,LENGTH=4)),
        IFTHEN=(WHEN=INIT,
          OVERLAY=(1:1,1,CHANGE=(1,X'19',X'00',X'20',X'01'),
              NOMATCH=(X'02'))),
        IFTHEN=(WHEN=INIT,BUILD=(1,4,DT1)),
        IFTHEN=(WHEN=INIT,BUILD=(5,2,C'/',7,2,C'/',1,4))
/*
Back to top
View user's profile Send private message
harish_mf

New User


Joined: 31 Jul 2005
Posts: 18
Location: bangalore

PostPosted: Wed Jan 17, 2007 2:10 pm    Post subject:
Reply with quote

Hi,

what is NOMATCH= ?


THANKS & REGARDS

HARISH.B
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Jan 17, 2007 9:55 pm    Post subject:
Reply with quote

Code:

  1,1,CHANGE=(1,X'19',X'00',X'20',X'01'),
        NOMATCH=(X'02')


NOMATCH tells DFSORT what to do if none of the CHANGE conditions are matched. For the statement above:

- if position 1 contains X'19', it is changed to X'00'
- if position 1 contains X'20', it is changed to X'01'
- if position 1 does not contain X'19' or X'20', it is changed to X'02'

For some more information on DFSORT's CHANGE and NOMATCH functions, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CG20/2.4.11?DT=20060615173822
Back to top
View user's profile Send private message
SJI77

New User


Joined: 11 Jan 2007
Posts: 4
Location: Chennai

PostPosted: Thu Jan 18, 2007 5:55 pm    Post subject: Re: Date conversion using DFSORT
Reply with quote

Hi,

I am getting syntax error. We are using Syncsort in our mainframe. The control 'TO=PD' is getting error.Please find below the screen print.

Code:

SYSIN :                                                       
  OPTION COPY,Y2PAST=1980                                     
    INREC IFTHEN=(WHEN=INIT,BUILD=(6,5,Y2T,TO=PD,LENGTH=4)), 
                                           *                 
          IFTHEN=(WHEN=INIT,                                 
            OVERLAY=(1:1,1,CHANGE=(1,X'19',X'00',X'20',X'01'),
                NOMATCH=(X'02'))),                           
          IFTHEN=(WHEN=INIT,BUILD=(1,4,DT1)),                 
          IFTHEN=(WHEN=INIT,BUILD=(5,2,C'/',7,2,C'/',1,4))   
WER268A  INREC STATEMENT   : SYNTAX ERROR                     
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                 
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE               


I tried so many combinations but nothing worked out. Please help me in solving this issue.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jan 18, 2007 9:33 pm    Post subject:
Reply with quote

The job works fine with DFSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
SJI77

New User


Joined: 11 Jan 2007
Posts: 4
Location: Chennai

PostPosted: Fri Jan 19, 2007 2:12 pm    Post subject: Re: Date conversion using DFSORT
Reply with quote

Thanks Frank Yaeger for the help.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Conversion of a VB file to FB. isssal DFSORT/ICETOOL 1 Mon Oct 31, 2016 10:23 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
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am


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