Page 1 of 1

Date conversion - JCL

PostPosted: Thu Nov 15, 2007 1:48 pm
by Gaurav Chauhan
I am using a file which has date in YYYY-MM-DD format.
How can I convert it into YYYY-MM-DD format

Re: Date conversion - JCL

PostPosted: Thu Nov 15, 2007 1:49 pm
by Gaurav Chauhan
This is to be done using JCL

Re: Date conversion - JCL

PostPosted: Thu Nov 15, 2007 3:48 pm
by CICS Guy
Gaurav Chauhan wrote:I am using a file which has date in YYYY-MM-DD format.
How can I convert it into YYYY-MM-DD format
For starters, I'm having problems seeing the difference between "YYYY-MM-DD" and "YYYY-MM-DD".....
This is to be done using JCL
Which utility do you want to use.....

Re: Date conversion - JCL

PostPosted: Thu Nov 15, 2007 7:52 pm
by Gaurav Chauhan
I can use SORT/SYNCSORT but can't use other utilities like ICETOOL etc.

Re: Date conversion - JCL

PostPosted: Thu Nov 15, 2007 8:01 pm
by CICS Guy
Gaurav Chauhan wrote:I can use SORT/SYNCSORT but can't use other utilities like ICETOOL etc.
That is silly, ICETOOL is part of SORT....six of one, half dozen the other......

Never the less, I'm having problems seeing the difference between "YYYY-MM-DD" and "YYYY-MM-DD".....
What does your input look like and what do you want it to look like after 'conversion'?

Re: Date conversion - JCL

PostPosted: Thu Nov 15, 2007 8:25 pm
by Gaurav Chauhan
Sorry....has to be converted from MM-DD-YYYY to YYYY-MM-DD format

File would be something like this
-------1234---------05-23-2005-------

Should look like this:
-------1234---------2005-05-23-------

Position of date field in the file before and after conversion should b same

Re: Date conversion - JCL

PostPosted: Thu Nov 15, 2007 11:11 pm
by CICS Guy
Have you concidered investing in a downloaded sort manual?

000000000111111111122222222223
123456789012345678901234567890
-------1234---------05-23-2005-------
-------1234---------2005-05-23-------
outrec fields=(1:1,20,21:27,4,25:26,1,26:21,5,31:31,7)

Re: Date conversion - JCL

PostPosted: Wed Jan 09, 2008 8:57 pm
by b4dboyz
This is the program:
01  IN-DATE.
  05  IN-DATE-MM   PIC 99.
  05  FILLER       PIC X.
  05  IN-DATE-DD   PIC 99.
  05  FILLER       PIC X.
  05  IN-DATE-YYYY PIC 9(4).

01  OUT-DATE.
  05  OUT-DATE-YYYY  PIC 9(4).
  05  FILLER         PIC X VALUE '-'.
  05  OUT-DATE-MM    PIC 99.
  05  FILLER         PIC X VALUE '-'.
  05  OUT-DATE-DD    PIC 99.


MOVE '05-23-2005' TO IN-DATE.

MOVE IN-DATE-MM   TO OUT-DATE-MM.
MOVE IN-DATE-DD   TO OUT-DATE-DD.
MOVE IN-DATE-YYYY TO OUT-DATE-YYYY.

DISPLAY 'BEFORE CONVERT: ' IN-DATE.
DISPLAY 'AFTER CONVERT: ' OUT-DATE.


This will be the output display:
BEFORE CONVERT: 05-23-2005
AFTER CONVERT: 2005-05-23