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 

Checking date format

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Tue Apr 24, 2012 8:56 am    Post subject: Checking date format Reply with quote

Hi,

Request you to let me know how to check whether received date format is correct or not using SORT. Our file has records like this in the below given format and this should be checked for correct format only (CCYY-MM-DD)

Input File:
Code:

9999-99-99
2005-01-12
2007-09-18
2006/11-21


Output:
Code:

9999-99-99
2005-01-12
2007-09-18


The last entry "2006/11-21" should be omitted because it has "/" in 5th position.

Please help.

Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Tue Apr 24, 2012 9:43 am    Post subject: Reply with quote

ranga_subham,
If you really meant to check any other values than '-' in the 5th and 8th position, shouldn't you omit such records? OR did you mean to check for valid date values as well?

Something like below?

Code:
//STEP0001 EXEC PGM=SORT                         
//SORTIN   DD  *                                 
9999-99-99                                       
2005-01-12                                       
2007-09-18                                       
2006/11-21                                       
//SORTOUT  DD  SYSOUT=*                         
//SYSIN DD *                                     
   OPTION COPY
   OMIT COND=(5,1,CH,NE,C'-',OR,8,1,CH,NE,C'-') 
/*                                               
//SYSOUT DD SYSOUT=*                             
//*

OUTPUT
Code:
9999-99-99
2005-01-12
2007-09-18

Thanks,
Back to top
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Thu Apr 26, 2012 7:24 am    Post subject: reply Reply with quote

sqlcode, actually, I want to correct the data by replacing any other character with "-" in those positions so that our process does not omit but consider them. Right now, its been handled by program and we report it back saying error records.

Thanks.
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Apr 26, 2012 10:28 am    Post subject: Re: reply Reply with quote

ranga_subham wrote:
sqlcode, actually, I want to correct the data by replacing any other character with "-" in those positions so that our process does not omit but consider them. Right now, its been handled by program and we report it back saying error records.

Thanks.


If your intention is to just replace the character, use the following DFSORT JCL
Code:

//STEP0100 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*         
//SORTIN   DD *               
9999-99-99                     
2005-01-12                     
2007-09-18                     
----+----1----+----2----+----3-
2006/11-21                     
//SORTOUT  DD SYSOUT=*         
//SYSIN    DD *               
  OPTION COPY                 
  INREC OVERLAY=(5:C'-',8:C'-')
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
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 -> Utilities 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