|
View previous topic :: View next topic
|
| Author |
Message |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
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 |
|
 |
Aaru
Senior Member

Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
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 |
|
 |
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
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 |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Thanks for the immediate response...
How about comparison with special characters |
|
| Back to top |
|
 |
krisprems
Active Member

Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
arcvns
i would prefer shankar's solution, more straight forward, clear and accurate  |
|
| Back to top |
|
 |
krisprems
Active Member

Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
If you could use a TSO command, then
This finds the occurance of Special Character between 1 and 6th position. |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
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 |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Nope. That would include values like:
10000A
1A0000
(which would not be included by DFSORT's 1,6,FS,EQ,NUM). |
|
| Back to top |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Frank,
my apologies, as always you are correct.
Gerry |
|
| Back to top |
|
 |
sabarikanth
New User
Joined: 07 Jun 2010 Posts: 59 Location: coimbatore
|
|
|
|
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 |
|
 |
kratos86
Active User

Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
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 |
|
 |
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
try this
| Code: |
$$DD01 COPY IF=(1,6,EQN),
AND=(10,6,EQN)
|
Gerry |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|