Date conversion - JCL



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Date conversion - JCL

Postby Gaurav Chauhan » Thu Nov 15, 2007 1:48 pm

I am using a file which has date in YYYY-MM-DD format.
How can I convert it into YYYY-MM-DD format
Gaurav Chauhan
 
Posts: 12
Joined: Mon Nov 05, 2007 1:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Date conversion - JCL

Postby Gaurav Chauhan » Thu Nov 15, 2007 1:49 pm

This is to be done using JCL
Gaurav Chauhan
 
Posts: 12
Joined: Mon Nov 05, 2007 1:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Date conversion - JCL

Postby CICS Guy » Thu Nov 15, 2007 3:48 pm

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.....
CICS Guy
 
Posts: 246
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: Date conversion - JCL

Postby Gaurav Chauhan » Thu Nov 15, 2007 7:52 pm

I can use SORT/SYNCSORT but can't use other utilities like ICETOOL etc.
Gaurav Chauhan
 
Posts: 12
Joined: Mon Nov 05, 2007 1:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Date conversion - JCL

Postby CICS Guy » Thu Nov 15, 2007 8:01 pm

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'?
CICS Guy
 
Posts: 246
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: Date conversion - JCL

Postby Gaurav Chauhan » Thu Nov 15, 2007 8:25 pm

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
Gaurav Chauhan
 
Posts: 12
Joined: Mon Nov 05, 2007 1:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Date conversion - JCL

Postby CICS Guy » Thu Nov 15, 2007 11:11 pm

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)
CICS Guy
 
Posts: 246
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: Date conversion - JCL

Postby b4dboyz » Wed Jan 09, 2008 8:57 pm

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
b4dboyz
 
Posts: 1
Joined: Wed Jan 09, 2008 8:46 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post