IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Replace a date in JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anandkumarrn

New User


Joined: 06 Feb 2009
Posts: 23
Location: India

PostPosted: Thu Dec 02, 2010 12:57 pm
Reply with quote

Hi,,

I have a requirement like the below said,

I have a FB record which is more than 10000 byte..

I have a date field in the file like <DATE>07/11/2010</DATE> (MM/DD/YYYY). I need to replace the date format to <YYYY/MM/DD> like <DATE>2010/07/11</DATE>.

The date mentioned can be in any position.

I need this to be done via. JCL. please advise.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Dec 02, 2010 1:05 pm
Reply with quote

/RANT ON
Once more let us clarify exactly what JCL is.

it is Job Control Language.

By itself it does nothing. It is used to invoke the chosen program and to define which datasets are to be used by the DD names associated with the chosen program.

JCL does not have magical powers that solve all problems, JCL is merely the vehicule for telling the processor which program you want it to execute.
/RANT OFF

So, if you might just care to tell us which program you wish the JCL to execute, we might be able to help you
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Dec 02, 2010 1:17 pm
Reply with quote

To add to expats post :

An acronym for Junior Classical League, aka Latin Club. The second largest club in America for youths (the first being Boy Scouts). An awesome club that allows you to accel in graphic arts, academics, service to your community, or just being a cool person.

'Johnny Come Lately'

Used to describe glory hunters who have no integrity and follow the latest football team to win something, or people who join a forum and start spouting their idiotic views as if they own the place, what do they know about the blood that was shed or the sacrifices our forefathers made in order for that football team/forum to exist
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Dec 02, 2010 11:41 pm
Reply with quote

anandkumarrn,

The following DFSORT JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
----+----1----+----2----+----3----+----4----+----5----+--
<DATE>07/11/2010</DATE>                                 
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  INREC IFOUTLEN=80,                                     
  IFTHEN=(WHEN=INIT,OVERLAY=(81:7,10,UFF,M11,LENGTH=8)),
  IFTHEN=(WHEN=INIT,OVERLAY=(07:81,8,Y4W,TOGREG=Y4T(/)))
//*


The output from this job is
Code:

<DATE>2010/07/11</DATE>                                                       
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Dec 03, 2010 4:44 am
Reply with quote

anandkumarrn,

I just realized that your date is not fixed and it can be any where. Here is a DFSORT JCL which will give you the desired results assuming that the input file is FB recfm and LRECL of 80.
Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                   
<DATE>07/11/2010</DATE>                                           
                <DATE>07/11/2010</DATE>                           
        <DATE>07/11/2010</DATE>                                   
                                       <DATE>07/11/2010</DATE>   
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                               
  INREC IFOUTLEN=80,IFTHEN=(WHEN=(1,80,SS,EQ,C'<DATE>'),         
  OVERLAY=(81:C'"',1,80,C'"',2X),HIT=NEXT),                       
                                                                 
  IFTHEN=(WHEN=(1,80,SS,EQ,C'<DATE>'),FINDREP=(STARTPOS=82,       
  INOUT=(C'<DATE>',C'<DATE>"',C'</DATE>',C'"</DATE>')),HIT=NEXT),
                                                                 
  IFTHEN=(WHEN=(1,80,SS,EQ,C'<DATE>'),                           
  PARSE=(%01=(ABSPOS=81,ENDAT=C'<DATE>"',FIXLEN=66),             
         %02=(FIXLEN=10),                                         
         %03=(STARTAT=C'"</DATE>',FIXLEN=66)),                   
  OVERLAY=(165:%01,%02,UFF,M11,LENGTH=8,2X,%03),HIT=NEXT),       
                                                                 
  IFTHEN=(WHEN=(1,80,SS,EQ,C'<DATE>'),                           
  OVERLAY=(231:231,8,Y4W,TOGREG=Y4T(/),                           
           165:165,142,SQZ=(SHIFT=LEFT,PAIR=QUOTE)),HIT=NEXT),   
                                                                 
  IFTHEN=(WHEN=(1,80,SS,EQ,C'<DATE>'),                           
  FINDREP=(STARTPOS=165,INOUT=(C'"',C'')),HIT=NEXT),             
  IFTHEN=(WHEN=(1,80,SS,EQ,C'<DATE>'),                           
  OVERLAY=(01:165,80))                                           

//*


The output of this job is
Code:

<DATE>2010/07/11</DATE>                                       
                <DATE>2010/07/11</DATE>                       
        <DATE>2010/07/11</DATE>                               
                                       <DATE>2010/07/11</DATE>
Back to top
View user's profile Send private message
anandkumarrn

New User


Joined: 06 Feb 2009
Posts: 23
Location: India

PostPosted: Sat Dec 04, 2010 7:47 am
Reply with quote

Thanks....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top