View previous topic :: View next topic
|
Author |
Message |
baljinders
New User
Joined: 21 Aug 2006 Posts: 72
|
|
|
|
Hi,
I am trying to sort a flat file based on a 15 byte account number. The problem is the below card is successfully eliminating account number fields which have either spaces or low values in them. But it is not eliminating a record which has both spaces and low values in it.
Sort card is ,
Code: |
SORT FIELDS=COPY
OMIT COND = (18,15,CH,EQ,C' ',OR, 18,15,CH,EQ,X'00') |
Example,
account field which does not get eliminated. It has first 12 bytes as spaces and last three as low values.
Record field
-------
Hex representation of the above field.
-----
Code: |
...
4444444444444000
0000000000000000 |
Does, anybody has any idea what is wrong here ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Topic has been moved as it says Syncsort (not DFSORT).
Quote: |
Does, anybody has any idea what is wrong here ? |
If i understand, the code is simply wrong. . .
Look closely at the code you have used and consider if you had coded some programming language.
Quote: |
But it is not eliminating a record which has both spaces and low values in it. |
Nothing in the OMIT conditions tell the sort to do this. . . |
|
Back to top |
|
|
baljinders
New User
Joined: 21 Aug 2006 Posts: 72
|
|
|
|
Thanks Dick,
The file that i am trying to sort is the ouput of a cobol program. I'll look into the code tomorrow and try to figure out the problem and get back with the findings. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Good luck
Keep in mind the having the process run as you want is that there is a clear understanding of what should happen |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
I am trying to sort a flat file based on a 15 byte account number. The problem is the below card is successfully eliminating account number fields which have either spaces or low values in them |
If you're trying to extract only character numeric values, you could try the NUM parameter as below.
Code: |
INCLUDE COND=(18,15,FS,EQ,NUM) |
If the account number can have alphabets as well, then you might need to check for each position separately for a
space/low-value. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Arun,
So far, i don't believe i understand just what should happens when this "works". . .
d |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Hi Dick,
The OP was trying to omit all accounts that were blanks or low-values or a combination of both. So I was suggesting an alternative if the account has only numeric data, include only those. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Arun,
Thanks for the clarification
As posted, the "requirement" was just clear as mud to me. . .
No real description, insufficient sample data, etc. I have no idea why some people believe showing one sample record for a process that needs to deal with multiple conditions will get them the help they want. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
baljinders wrote: |
The file that i am trying to sort is the ouput of a cobol program. |
Obviously, the best thing to do would be to prevent the cobol program from writing erroneous data.
And if you can't solve the problem at the source you can try:
Code: |
OMIT COND=(18,15,SS,EQ,C' ',OR,18,15,SS,EQ,X'00') |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
To follow on with what Marso said (but more strongly):
It is nonsense to have "production" code that creates invalid data output. Rather than fiddling with fixing the output in another step, the problem code should be fixed.
Any proper review/promotion will not allow this to be placed into production. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
Rather than fiddling with fixing the output in another step, the problem code should be fixed. |
unfortunately too many of the topics being discussed deal with poor coding and poor overall application architecture
why oh why so many counting and so many get rid of duplicates issues |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
unfortunately too many of the topics being discussed deal with poor coding and poor overall application architecture
why oh why so many counting and so many get rid of duplicates issues
|
Enrico, I think you answered your own question before you asked it! Our PC / server applications developers now think it is normal and usual to have to manually run processes that fail, even if they are production processes. They just don't seem to understand how to build a robust application architecture. |
|
Back to top |
|
|
baljinders
New User
Joined: 21 Aug 2006 Posts: 72
|
|
|
|
Sorry for the late reply....
The problem was fixed in the cobol code itself. Proper initialization did the trick.
Thanks everyone for your time and effort. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Good to hear it is working and that the better resoluton was used
Thanks for letting us know,
d |
|
Back to top |
|
|
|