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

Validate date and numeric fields and set step rc


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 2481
Location: @my desk

PostPosted: Thu May 11, 2017 8:03 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

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

These links will help you get going with your vague needs.
ibmmainframes.com/about31415.html
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
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: 2481
Location: @my desk

PostPosted: Thu May 11, 2017 8:35 pm
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: 2481
Location: @my desk

PostPosted: Fri May 12, 2017 9:38 pm
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

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Sat May 13, 2017 8:11 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
Search our Forums:

Back to Top