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
 

 

Check for numeric using Syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Arun Raj

Moderator


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

PostPosted: Wed Oct 31, 2007 5:08 pm    Post subject: Check for numeric using Syncsort
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: 1288
Location: Chennai, India

PostPosted: Wed Oct 31, 2007 5:36 pm    Post subject: Reply to: Check for numeric using Syncsort
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    Post subject:
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: 2238
Location: @my desk

PostPosted: Wed Oct 31, 2007 6:13 pm    Post subject:
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    Post subject:
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    Post subject:
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: 2238
Location: @my desk

PostPosted: Wed Oct 31, 2007 7:40 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Thu Nov 01, 2007 3:56 am    Post subject: Reply to: Check for numeric using Syncsort
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 Moderator


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

PostPosted: Thu Nov 01, 2007 5:02 am    Post subject:
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: 1703
Location: Australia

PostPosted: Thu Nov 01, 2007 5:19 am    Post subject: Reply to: Check for numeric using Syncsort
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    Post subject: Reply to: Check for numeric using Syncsort
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    Post subject:
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: 1703
Location: Australia

PostPosted: Thu Apr 21, 2011 8:38 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am


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