MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Date Replacing using JCL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
nbdtrjk
Beginner


Joined: 08 Mar 2006
Posts: 17
Topics: 11

PostPosted: Mon Mar 20, 2006 10:47 pm    Post subject: Date Replacing using JCL Reply with quote

Hi..
I am having a Flat File, recfm is FB and Lrecl is 80...In 25 position having some dates(YYYYMMDD). My requirement is i want to change the Existing Dates to Current Date usig JCL.


Thanks In Advance.
Back to top
View user's profile Send private message
sharada
Beginner


Joined: 24 Aug 2005
Posts: 32
Topics: 14
Location: Hyderabad

PostPosted: Tue Mar 21, 2006 1:34 am    Post subject: Reply with quote

Hi nbdtrjk,

you can hard code the current date in the required position using date functions (like &DATExP there are so many in built functions available).

Sharada.
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Tue Mar 21, 2006 7:04 am    Post subject: Reply with quote

Sharada,

Can yow show an example as how it can be done using those functions with a sample JCL ?
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Mar 21, 2006 8:09 am    Post subject: Reply with quote

Quote:

Can yow show an example as how it can be done using those functions with a sample JCL ?


Shekhar123,

Try this.

Code:

//STEP0100 EXEC PGM=SORT         
//SYSOUT    DD SYSOUT=*         
//SORTIN    DD *                 
ABC 2004-10-25                   
//SORTOUT   DD SYSOUT=*         
//SYSIN     DD *                 
  SORT FIELDS=COPY               
  OUTREC FIELDS=(1,4,DATE=(4MD-))
/*                               


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Tue Mar 21, 2006 8:23 am    Post subject: Reply with quote

Kolusu,

I am getting syntax error.Can u please let me know what should be the correct code ?.

Code:

ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE000I 1 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - 18:43 ON TUE MAR
            SORT FIELDS=COPY                                                   
            OUTREC FIELDS=(1,4,DATE=(4MD-))                                     
                               $                                               
ICE007A E SYNTAX ERROR                                                         
ICE052I 3 END OF DFSORT                                                         


_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Mar 21, 2006 8:33 am    Post subject: Reply with quote

shekar123,

I guess you are missing the latest PTF. Frank might be able to tell you if your version supports the date parameter.

Mean while try this

Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT    DD SYSOUT=*   
//SORTIN    DD *           
ABC 2004-10-25             
//SORTOUT   DD SYSOUT=*   
//SYSIN     DD *           
  SORT FIELDS=COPY         
  OUTREC FIELDS=(1,4,DATE1)
/*   


This will give you the date in ccyymmdd

If you want the date to be ccyy-mm-dd then use the following job.

Code:

//STEP0100 EXEC PGM=SORT           
//SYSOUT    DD SYSOUT=*           
//SORTIN    DD *                   
ABC 2004-10-25                     
//SORTOUT   DD SYSOUT=*           
//SYSIN     DD *                   
  SORT FIELDS=COPY                 
  OUTREC FIELDS=(1,4,DATE1)       
  OUTFIL OUTREC=(1,4,             
                5,4,               
                C'-',             
                9,2,               
                C'-',             
               11,2)               
/*                                 


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Tue Mar 21, 2006 8:51 am    Post subject: Reply with quote

Kolusu,

The DATE1 code also did not work in my test shop and i am guessing that i have R14 (not latest PFT) which is not supporting me , so i had run your code in my development system and it works fine.You are simply great.


Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
ABC 2004-10-25                                                         
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTREC FIELDS=(1,4,DATE=(4MD-))                                         
/*                                                                     
//STEP0200 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
ABC 2004-10-25                                                         
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTREC FIELDS=(1,4,DATE1)                                             
  OUTFIL OUTREC=(1,4,
                5,4,
                C'-',
                9,2,
                C'-',
               11,2)
/*                   
//


OUTPUT

Code:

STEP0100   ABC 20060321
STEP0200   ABC 2006-03-21


_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
nbdtrjk
Beginner


Joined: 08 Mar 2006
Posts: 17
Topics: 11

PostPosted: Tue Mar 21, 2006 9:15 am    Post subject: Reply with quote

STEP0100 ABC 2006-03-21
STEP0200 ABC 2006-03-21



In Both the above Steps i got same values...What is wrong in that...and Give explanation abt OUTREC FIELDS=(1,4,DATE=(4MD/))... Espeically DATE=(4MD/)





below is the one which i submitted
Code:

//NBDTRJKE JOB (0008293ZZS,0J1,,C),'SORT JCL',       
//    CLASS=0,MSGCLASS=U,NOTIFY=&SYSUID               
//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                       
ABC 2004-10-25                                       
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                   
  OUTREC FIELDS=(1,4,DATE=(4MD/))                     
/*                                                   
//STEP0200 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                       
ABC 2004-10-25                                       
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                   
  OUTREC FIELDS=(1,4,DATE1)                           
  OUTFIL OUTREC=(1,4,                                 
                5,4,                                 
                C'/',                                 
                9,2,                                 
                C'/',                                 
               11,2)                                 
/*
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Mar 21, 2006 10:16 am    Post subject: Reply with quote

nbdtrjk,

Quote:


STEP0100 ABC 2006-03-21
STEP0200 ABC 2006-03-21


In Both the above Steps i got same values...What is wrong in that...and Give explanation abt OUTREC FIELDS=(1,4,DATE=(4MD/))... Espeically DATE=(4MD/)


Are you sure that step0100 produced the date with hyphens even though your control card has / as the date seperator?

DATE(abcd)
Specifies printing of the date.For example, on March 21, 2006, DATE(4MD-) would produce '2006-03-21' and DATE(4MD/) would produce '2006/03/21' and DATE(MDY.) would produce '03.21.06'

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nbdtrjk
Beginner


Joined: 08 Mar 2006
Posts: 17
Topics: 11

PostPosted: Tue Mar 21, 2006 10:44 am    Post subject: Reply with quote

Sorry for my Mistake


STEP0100 ABC 2006/03/21
STEP0200 ABC 2006/03/21


Both the above Steps i got same values...What is wrong in that ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Mar 21, 2006 10:49 am    Post subject: Reply with quote

Quote:

Both the above Steps i got same values...What is wrong in that ?


huh ? What exactly is your question? Date=(4md/) would produce '2006/03/21' and Date1 would produce 20060321 and using OUTREC on OUTFIL we are reformating it to '2006/03/21'

I just showed shekhar123 an example since his sort version gave an error on Date=(4md/) parm. So I showed him an alternate method to get the desired result.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Mar 21, 2006 11:21 am    Post subject: Reply with quote

Code:

   OUTREC FIELDS=(1,4,DATE=(4MD-))


works fine with DFSORT R14 or z/OS DFSORT V1R5 as long as you have the Dec, 2004 PTF and will give you C'yyyy-mm-dd'. You could also use DATENS=(4MD) if you don't want the separator character - that will give you C'yyyymmdd'.

DATE1 will give the same result as DATENS=(4MD). DATE1(-) will give you the same result as DATE=(4MD-). The DATEn variations have been available with DFSORT since March, 2002, so if they don't work, you're very, very far behind on DFSORT service. Ask your System Programmer to install DFSORT R14 PTF UQ95213 (it's free). That will get you all the latest DFSORT/ICETOOL functions.

Quote:
I am having a Flat File, recfm is FB and Lrecl is 80...In 25 position having some dates(YYYYMMDD). My requirement is i want to change the Existing Dates to Current Date usig JCL.


Note that with the Dec, 2004 DFSORT PTF, you can use:

Code:

   OPTION COPY
   OUTREC OVERLAY=(25:DATE1)

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group