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
 

 

Validate date and numeric fields and set step rc

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Rick Silvers

New User


Joined: 31 Mar 2012
Posts: 9
Location: USA

PostPosted: Thu May 11, 2017 6:51 pm    Post subject: Validate date and numeric fields and set step rc
Reply with quote

Hi

I need to validate value in 4 fields in an input file, can I do this with sort or ICETOOL and set step RC if a field contains incorrect value ?



date1, date2, date3, blance_amount

date1 is format YYYYMM
date2 is format YYYYMMDD
date3 is format YYYYMMDD
blance_format is format 999999999
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Thu May 11, 2017 8:03 pm    Post subject:
Reply with quote

Rick,

Most probably yes. What kind of validation do you need to perform on these fields? Can you provide details on each of those.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1696
Location: NY,USA

PostPosted: Thu May 11, 2017 8:10 pm    Post subject:
Reply with quote

These links will help you get going with your vague needs.
http://ibmmainframes.com/about31415.html
http://ibmmainframes.com/about47344.html
Back to top
View user's profile Send private message
Rick Silvers

New User


Joined: 31 Mar 2012
Posts: 9
Location: USA

PostPosted: Thu May 11, 2017 8:22 pm    Post subject:
Reply with quote

Arun Raj wrote:
Rick,

Most probably yes. What kind of validation do you need to perform on these fields? Can you provide details on each of those.


date1, date2, date3, blance_amount

date1 is format YYYYMM and can be only YYYYMM
date2 is format YYYYMMDD and can be only YYYYMMDD
date3 is format YYYYMMDD and can be only YYYYMMDD
blance_format is format 999999999 and needs to be numeric, no characters or . (decimals)
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Thu May 11, 2017 8:35 pm    Post subject:
Reply with quote

Rick,

You could use the 'NUM' function to check for numeric, but for date validation there might not be built-in functions.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Fri May 12, 2017 9:38 pm    Post subject:
Reply with quote

Rick,

A good friend and a mentor of mine pointed out that we could validate any input date by merely applying a date conversion on the input date field.
If the input date is invalid, the output date from the conversion would have asterisks ('*').

Ran a test and here is what I got.
Code:
//STEP01  EXEC PGM=SORT               
//SYSOUT    DD SYSOUT=*               
//SORTIN    DD *                       
20170228                               
20170229                               
20180229                               
20190229                               
20200229                               
20170332                               
20170500                               
20171301                               
//SORTOUT   DD SYSOUT=*               
//SYSIN     DD *                       
  OPTION COPY                         
  INREC OVERLAY=(10:1,8,Y4T,TOGREG=Y4T)

SORTOUT had
Code:
20170228 20170228
20170229 ********
20180229 ********
20190229 ********
20200229 20200229
20170332 ********
20170500 ********
20171301 ********
For your requirement, you could do a similar conversion for each input date field and then check the resultant date for numeric data (using NUM), to achieve what you want.
For the first date field - date1 (YYMM), you might want to suffix '01' before the conversion.

Good luck!
Back to top
View user's profile Send private message
sergeyken

New User


Joined: 29 Apr 2008
Posts: 83
Location: Maryland

PostPosted: Sat May 13, 2017 8:11 pm    Post subject:
Reply with quote

Arun Raj wrote:
Rick,

A good friend and a mentor of mine pointed out that we could validate any input date by merely applying a date conversion on the input date field.
If the input date is invalid, the output date from the conversion would have asterisks ('*').

Good idea. Thanks for sharing it!
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm


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