conversion of date format



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

conversion of date format

Postby sankar » Thu Apr 10, 2008 8:50 pm

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
sankar
 
Posts: 6
Joined: Wed Mar 26, 2008 8:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: conversion of date format

Postby CICS Guy » Thu Apr 10, 2008 11:24 pm

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

Re: conversion of date format

Postby sankar » Sat Apr 12, 2008 9:32 pm

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
sankar
 
Posts: 6
Joined: Wed Mar 26, 2008 8:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: conversion of date format

Postby CICS Guy » Sat Apr 12, 2008 11:37 pm

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

Re: conversion of date format

Postby jayind » Mon May 05, 2008 3:57 pm

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
jayind
 
Posts: 62
Joined: Wed Apr 23, 2008 1:37 pm
Location: Chennai, India
Has thanked: 0 time
Been thanked: 0 time

Re: conversion of date format

Postby raghuvanshi » Thu Feb 16, 2012 11:42 pm

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.
You do not have the required permissions to view the files attached to this post.
raghuvanshi
 
Posts: 43
Joined: Tue Dec 07, 2010 5:32 pm
Has thanked: 3 times
Been thanked: 0 time

Re: conversion of date format

Postby NicC » Fri Feb 17, 2012 12:12 am

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: conversion of date format

Postby Frank Yaeger » Fri Feb 17, 2012 12:13 am

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.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: conversion of date format

Postby raghuvanshi » Fri Feb 17, 2012 12:36 am

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
raghuvanshi
 
Posts: 43
Joined: Tue Dec 07, 2010 5:32 pm
Has thanked: 3 times
Been thanked: 0 time

Re: conversion of date format

Postby raghuvanshi » Fri Feb 17, 2012 12:51 am

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
You do not have the required permissions to view the files attached to this post.
raghuvanshi
 
Posts: 43
Joined: Tue Dec 07, 2010 5:32 pm
Has thanked: 3 times
Been thanked: 0 time

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post