Page 1 of 1

OMIT cond on sort rule not working

PostPosted: Tue Oct 18, 2011 2:46 am
by danilohgds
Hello there everyone. First post here :D


I'm having a problem where some of my files are getting weird records added to them. I wasn't able to detect where the records came from then i decided that i should just OMIT then in the sort card. The records have a field with blank value PAPER-RAG-REC-IND.

Here it is how it's defined in the COBOL copybook.

06 W233-PAPER-RAG-REC-IND PIC X VALUE SPACES.
88 W233-RAG-HDR-REC VALUE '0'.
88 W233-NOT-RAG-HDR-REC VALUE '1'.

And here it's the field after i map the output file with the copybook on fileaid.

W233-PAPER-RAG-REC-IND
1/AN
(51-51)
10--------------------
**************** TOP OF
1
1
1


But my problem is that my second OMIT COND statement isn't working, OMIT COND=((144,1,CH,EQ,C' '),AND,(51,1,CH,EQ,C' ')) . I thought the problem could be because the file
has a variable rec len of 4, so i tried positions 55 and 47, but had no success in either one of them.

My question is how should i write the omit cond to hide every record where paper rag is blank

Re: OMIT cond on sort rule not working

PostPosted: Tue Oct 18, 2011 3:11 am
by enrico-sorichetti
OMIT cond on sort rule not working

... it works the way You asked it

meditate a bit on the meaning of the AND and OR operators ...
and You will see that sort behaves according to Your <instructions>
the records will be omitted only if both conditions are satisfied
most probably You might want to use an OR


a mild advice when posting to a NON COBOL forum ...
refrain from using COBOL terminology just refer to the data in terms of
position, length, format
the format could be... character, packed, binary, zoned, signed zoned, leading sign, trailing sign, .....

Re: OMIT cond on sort rule not working

PostPosted: Tue Oct 18, 2011 3:23 am
by Frank Yaeger
danilohgds,

I believe you want OR, not AND, and you also need to add +4 to your positions to account for the RDW:

  OMIT COND=(148,1,CH,EQ,C' ',OR,55,1,CH,EQ,C' ')

Re: OMIT cond on sort rule not working

PostPosted: Tue Oct 18, 2011 3:24 am
by danilohgds
It worked with the OR. Kinda makes me feel like a fool, but i guess 10 hours straight of work are affecting me. Thanks for the help enrico. And also Frank who i talked with :D