Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Replace a date in JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Replace a date in JCL
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: 8593
Location: Back in jolly old England

PostPosted: Thu Dec 02, 2010 1:05 pm    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Thu Dec 02, 2010 1:17 pm    Post subject:
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    Post subject: Reply to: Replace a date in JCL
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    Post subject:
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    Post subject: Re: Reply to: Replace a date in JCL
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us