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

Check for numeric using Syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Arun Raj

Moderator


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

PostPosted: Wed Oct 31, 2007 5:08 pm
Reply with quote

Hi all,

I have an input file.my requirement is to validate certain fields whether it is numeric or not.
I know that this is possible using DFSORT's INCLUDE COND=(1,6,FS,EQ,NUM).
Is it possible using SYNCSORT/SYNCTOOL??.

Thanks,
Arun
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Wed Oct 31, 2007 5:36 pm
Reply with quote

arcvns,

Try this.

Code:
//SYSIN       DD *                                                     
 SORT FIELDS=COPY                                                       
 INCLUDE COND=(1,1,CH,GT,C'Z',AND,2,1,CH,GT,C'Z',AND,3,1,CH,GT,C'Z',   
           AND,4,1,CH,GT,C'Z',AND,5,1,CH,GT,C'Z',AND,6,1,CH,GT,C'Z')   
/*                                                                     



Alphabets are always less than numerals when compared. This wont be the best option when the field length increases.
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Wed Oct 31, 2007 6:11 pm
Reply with quote

Aaru,

In your code you are checking for value greater than 'Z' i.e., X'E9'.

Greater than X'E9' are X'EA', X'EB', X'EC', X'ED', X'EE', X'EF', X'F0', X'F1', X'F2', X'F3', X'F4', X'F5', X'F6', X'F7', X'F8', X'F9', X'FA', X'FB', X'FC', X'FD', X'FE' and X'FF'.

But numeric values are from X'F0', X'F1', X'F2', X'F3', X'F4', X'F5', X'F6', X'F7', X'F8' and X'F9'.

Suppose if the fields contain the values X'EA', X'EB', X'EC', X'ED', X'EE', X'EF', X'FA', X'FB', X'FC', X'FD', X'FE' and X'FF', the output will be wrong.

Please correct me if i am wrong.

arcvns,

Please check with the following code for your requirement.
Code:
INCLUDE COND=(1,1,SS,EQ,C'0123456789',AND,
              2,1,SS,EQ,C'0123456789',AND
              3,1,SS,EQ,C'0123456789',AND
              4,1,SS,EQ,C'0123456789',AND
              5,1,SS,EQ,C'0123456789',AND
              6,1,SS,EQ,C'0123456789')
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Oct 31, 2007 6:13 pm
Reply with quote

Thanks for the immediate response...

How about comparison with special characters
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Oct 31, 2007 6:16 pm
Reply with quote

arcvns
i would prefer shankar's solution, more straight forward, clear and accurate icon_biggrin.gif
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Oct 31, 2007 6:37 pm
Reply with quote

If you could use a TSO command, then
Code:
F ALL P'$' 1 6

This finds the occurance of Special Character between 1 and 6th position.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Oct 31, 2007 7:40 pm
Reply with quote

Hi all,

Thanks for all...

I got it through batch file-aid, here is the job

Code:
//STEP0001 EXEC PGM=FILEAID                   
//SYSPRINT DD SYSOUT=*                       
//DD01     DD DISP=SHR,DSN=TEST.INPUT
//DD01O    DD DISP=SHR,DSN=TEST.OUTPUT
//SYSIN    DD *                               
*                                             
$$DD01 COPY IF=(1,6,EQN)     
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Nov 01, 2007 3:56 am
Reply with quote

Hi,
using SYSNCORT, what about the following code

Gerry
Code:


 SORT FIELDS=COPY                                         
 INCLUDE COND=(1,6,CH,GE,C'000000',AND,1,6,CH,LE,C'999999')
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Nov 01, 2007 5:02 am
Reply with quote

Nope. That would include values like:

10000A
1A0000

(which would not be included by DFSORT's 1,6,FS,EQ,NUM).
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Nov 01, 2007 5:19 am
Reply with quote

Hi Frank,
my apologies, as always you are correct.


Gerry
Back to top
View user's profile Send private message
sabarikanth

New User


Joined: 07 Jun 2010
Posts: 59
Location: coimbatore

PostPosted: Thu Apr 21, 2011 3:57 am
Reply with quote

In the below code,
how to check numeric value for two positions,
Say i have to check numeric value from 1-6 and 10-16.
if so how to modify the below code...
Please advise.

Code:
//STEP0001 EXEC PGM=FILEAID                   
//SYSPRINT DD SYSOUT=*                       
//DD01     DD DISP=SHR,DSN=TEST.INPUT
//DD01O    DD DISP=SHR,DSN=TEST.OUTPUT
//SYSIN    DD *                               
*                                             
$$DD01 COPY IF=(1,6,EQN)     


I tried with
Code:
$$DD01 COPY IF=(1,6,EQN,10,6,EQN)


but this condition works when both the positions have non-numeric value.
My question is if anyone of the position (either 1-6 or 10-16) has non-numeric value then i have to skip the record. How to achive this..?

Thanks,
Sab.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Thu Apr 21, 2011 8:22 am
Reply with quote

With the syncsort 1.3 Version or above you will be able to achieve the output with the same code you used for DFSORT

Code:
SORT FIELDS=COPY               
INCLUDE COND=(1,9,FS,EQ,NUM)   


If you check the latest manual you will find the below enhancement

Quote:
Other Enhancements
• INCLUDE/OMIT Control Statement
• The NUM subparameter has been added. NUM determines if a field is numeric or
non-numeric in CSF/FS, PD, or ZD format.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Apr 21, 2011 8:38 am
Reply with quote

Hi,

try this
Code:
$$DD01 COPY IF=(1,6,EQN),   
           AND=(10,6,EQN)   



Gerry
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts EMPTY file check scenario JCL & VSAM 6
No new posts Find a record count/numeric is multip... COBOL Programming 1
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts DFSORT/SYNCSORT/ICETOOL JCL & VSAM 8
No new posts Syncsort "Y2C" Function SYNCSORT 1
Search our Forums:

Back to Top