I am using a file which has date in YYYY-MM-DD format.
How can I convert it into YYYY-MM-DD format
Date conversion - JCL
-
- Posts: 12
- Joined: Mon Nov 05, 2007 1:50 pm
- Skillset: Cobol,DB2,CICS,JCL,VSAM
- Referer: thru friends
-
- Posts: 12
- Joined: Mon Nov 05, 2007 1:50 pm
- Skillset: Cobol,DB2,CICS,JCL,VSAM
- Referer: thru friends
Re: Date conversion - JCL
This is to be done using JCL
Re: Date conversion - JCL
For starters, I'm having problems seeing the difference between "YYYY-MM-DD" and "YYYY-MM-DD".....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
Which utility do you want to use.....This is to be done using JCL
-
- Posts: 12
- Joined: Mon Nov 05, 2007 1:50 pm
- Skillset: Cobol,DB2,CICS,JCL,VSAM
- Referer: thru friends
Re: Date conversion - JCL
I can use SORT/SYNCSORT but can't use other utilities like ICETOOL etc.
Re: Date conversion - JCL
That is silly, ICETOOL is part of SORT....six of one, half dozen the other......Gaurav Chauhan wrote:I can use SORT/SYNCSORT but can't use other utilities like ICETOOL etc.
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'?
-
- Posts: 12
- Joined: Mon Nov 05, 2007 1:50 pm
- Skillset: Cobol,DB2,CICS,JCL,VSAM
- Referer: thru friends
Re: Date conversion - JCL
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
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
Have you concidered investing in a downloaded sort manual?
outrec fields=(1:1,20,21:27,4,25:26,1,26:21,5,31:31,7)
Code: Select all
000000000111111111122222222223
123456789012345678901234567890
-------1234---------05-23-2005-------
-------1234---------2005-05-23-------
Re: Date conversion - JCL
This is the program:
This will be the output display:
Code: Select all
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.
Code: Select all
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:
Code: Select all
BEFORE CONVERT: 05-23-2005
AFTER CONVERT: 2005-05-23