Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Date converstion using DFSORT (DD-MMM-YY to MM/DD/YYYY)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
saravanakumar N

New User


Joined: 24 Mar 2010
Posts: 5
Location: Chennai

PostPosted: Thu Dec 22, 2011 7:19 pm    Post subject: Date converstion using DFSORT (DD-MMM-YY to MM/DD/YYYY)
Reply with quote

Hi

I need to convert input record's date format from DD-MMM-YY (29-OCT-08) to MM/DD/YYYY (10/29/2008). Can we do this using DFSORT or ICETOOL..?

my sample record is
1N4AA51E09C800016~29-OCT-08~TN
Back to top
View user's profile Send private message

Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Thu Dec 22, 2011 8:09 pm    Post subject:
Reply with quote

Hi Saravana,

Yes, this can be done using DFSORT.

Tips : Looks into the usage of INREC - IFTHEN-WHEN - OUTREC.

Also, there are same or related topics aleady discussed in this forum.

*Note: Preferrably, when asking similiar kind of question, it is better to post the expected output record also.
And use 'code' button to display the record in a more readable form.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Dec 22, 2011 9:15 pm    Post subject: Reply to: Date converstion using DFSORT (DD-MMM-YY to MM/DD
Reply with quote

Code:
//DATECONV EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD *
ALL-OF-RECORD,1,30,CH
FIRST-PART-OF-RECORD,1,18,CH
MMM-IN-RECORD,22,3,CH
DD-IN-RECORD,19,2,CH
YY-IN-RECORD,26,2,CH
LAST-PART-OF-RECORD,28,3,CH
REFORMATTED-DATE,31,6,CH
//SORTIN   DD *
1N4AA51E09C800016~29-OCT-08~TN
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,
     BUILD=(ALL-OF-RECORD,31:
       MMM-IN-RECORD,
       CHANGE=(2,C'JAN',C'01',C'FEB',C'02',C'MAR',C'03',C'APR',C'04',
                 C'MAY',C'05',C'JUN',C'06',C'JUL',C'07',C'AUG',C'08',
                 C'SEP',C'09',C'OCT',C'10',C'NOV',C'11',C'DEC',C'12'),
       DD-IN-RECORD,
       YY-IN-RECORD)),
        IFTHEN=(WHEN=INIT,
     BUILD=(FIRST-PART-OF-RECORD,
         REFORMATTED-DATE,Y2W,EDIT=(TT/TT/TTTT),
         LAST-PART-OF-RECORD))


Gives this output:

Code:
1N4AA51E09C800016~10/29/2008~TN


I "borrowed" the idea from the DFSORT Smart Tricks manual for how to do the names to numbers.

I suspect a cleaner solution will arrive.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Dec 22, 2011 9:20 pm    Post subject:
Reply with quote

Use the following DFSORT JCL which will give you the desired results. I assumed that the reformatted date is placed at pos 40 and your input lrecl=80 and recfm=fb
Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
----+----1----+----2----+----3----+----4----+----5----+----6----+----7-
1N4AA51E09C800016~29-OCT-08~TN                                         
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  OPTION COPY,Y2PAST=1980                                             
  INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,OVERLAY=(81:22,3,19,2,26,2)),   
  IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=81,                             
   INOUT=(C'JAN',C'01',C'FEB',C'02',C'MAR',C'03',C'APR',C'04',         
          C'MAY',C'05',C'JUN',C'06',C'JUL',C'07',C'AUG',C'08',         
          C'SEP',C'09',C'OCT',C'10',C'NOV',C'11',C'DEC',C'12'))),     
  IFTHEN=(WHEN=INIT,OVERLAY=(40:81,6,Y2W(/)))                         
//*                                                                   
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us