Page 1 of 3

conversion of date format

PostPosted: Thu Apr 10, 2008 8:50 pm
by sankar
Hi all,
i have a requirement to convert dd-mm-yyyy into yyyy-mm-dd.
is there any JCL which would resolve my requirement.
pls post the JCL, if u have any.

with regards,
s.sankar

Re: conversion of date format

PostPosted: Thu Apr 10, 2008 11:24 pm
by CICS Guy
By JCL, do you mean without having to write a 'program'?
By JCL, do you mean a sort type utility would be OK?
If so, not that it really matters, what brand of sort will you be using?

Re: conversion of date format

PostPosted: Sat Apr 12, 2008 9:32 pm
by sankar
hi cics guy,

FYI i am a beginner.
I dont know is there any JCL which would answer my question.

thanks for ur kind reply.
with regards
sankar

Re: conversion of date format

PostPosted: Sat Apr 12, 2008 11:37 pm
by CICS Guy
sankar wrote:FYI i am a beginner.
I dont know is there any JCL which would answer my question.
sankar, again,

By JCL, do you mean without having to write a 'program'?
By JCL, do you mean a sort type utility would be OK?
If so, not that it really matters, what brand of sort will you be using?

Input
dd-mm-yyyy

  SORT FIELDS=COPY
  INREC FIELDS=(1:7,4,5:3,1,6:4,2,8:6,1,9:1,2)


output
yyyy-mm-dd

Re: conversion of date format

PostPosted: Mon May 05, 2008 3:57 pm
by jayind
Hi Sankar,

I don't know whether you got your answer or not? I dont know whether you understood the question asked by CICS Guy?
we are unclear about your requirement.. you didnt mention where do you want to use this conversion? whether it is in the program or in the JCL to convert a particular date in input file to a diffrent format in the output file without disturbing other fields.

I hope it is the second requirement, if so, YES it is possible.

Using the PGM=SORT, SORT FIELDS=COPY, INREC or OUTREC you can convert the date format

Look for INREC/OUTREC formats either in text books or IBMHELP

Re: conversion of date format

PostPosted: Thu Feb 16, 2012 11:42 pm
by raghuvanshi
Hi,

My requirement is to change date format from DD-MM-YYYY to MM/DD/YYYY. I am using the below code but getting the same result as in the input SORTIN, any inputs will be greatly appreciated.

Re: conversion of date format

PostPosted: Fri Feb 17, 2012 12:12 am
by NicC
After over a year on the forum you should know...
a) not to tailgate an old topic (very old) but to start your own.
b) not to post screen shots but to cut and paste and use the code tags to make it pretty.
c) to post diagnostic information - for example: we do not know what your input looks like so we do not know what you mean by your output being the same as your input.
d) to post in the correct section of the forum - you have a sort question -so you should be posting in the dfsort, syncsort, ca or other section - not JCL.

Re: conversion of date format

PostPosted: Fri Feb 17, 2012 12:13 am
by Frank Yaeger
raghuvanshi,

If that's not working for you, then there's something you're not telling us. When I run this job with DFSORT:

//S1 EXEC PGM=SORT                             
//SYSOUT DD SYSOUT=*                           
//SORTIN DD *                                   
31-01-2011                                     
25-05-2012                                     
//SORTOUT DD SYSOUT=*                           
//SYSIN DD *                                   
  SORT FIELDS=COPY                             
  OUTREC FIELDS=(4,2,C'/',1,2,C'/',7,4)         
/*


I get this output which is what you seem to be expecting:

01/31/2011   
05/25/2012   


This assumes your input file has RECFM=FB and the dd-mm-yyyy date starts in position 1 - is that correct?

If this doesn't help, tell me the RECFM and LRECL of your input file, and show an example of your input records and expected output. Also, show me the JES log for your run with the all of messages you received.

BTW, you should NOT specify SORTWKdd DDs for a COPY as they aren't used and just waste space. Actually, it's better to never specify SORTWKdd DDs and let DFSORT dynamically allocation them when needed.

Re: conversion of date format

PostPosted: Fri Feb 17, 2012 12:36 am
by raghuvanshi
Hi NicC

a.) I tailgated as this topic was already being discussed and I thought it was waste to start a new topic.
b.)I posted screen shots because I am unable to copy from mainframes,if any how I was able to copy from mainframes then why would I take the pain to print screen then edit on paint and then save on desktop and then attach on the forum.
c.)I will make sure to give inputs and required outputs in future.
d.)Again I put it over here because it was related to this topic.

But if you insist on points a and d .I will start new topics from now onwards.

Regards,
Raghuvanshi

Re: conversion of date format

PostPosted: Fri Feb 17, 2012 12:51 am
by raghuvanshi
Thanks for the quick reply Frank, yes that is correct the RECFM for input file is FB and the dd-mm-yyyy date starts at position 1
the RECFM and LRECL of the input file are FB and 800 respectively and the data in input file is 16-02-2012

Thanks for the suggestion on SORTWKdd.

Below is the message from spool