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

Help required in COND


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

New User


Joined: 13 Feb 2008
Posts: 15
Location: Chennai

PostPosted: Mon Jul 21, 2014 3:01 pm
Reply with quote

Hi,

I have an i/p file with LREC-80 and i have to omit the record, if it contains '9999...' from col 01 - 80.
Could you please let me know, is there any easier way to acheive this?

SORT FIELDS=COPY
INCLUDE COND=(1,80,CH,EQ,C'99...').

I felt, placing 80 occurances of '99...' in COND wouldn't be a better option.
Could you please update, is there any smart way to omit this record?
Thanks in advance.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 21, 2014 3:12 pm
Reply with quote

Try 80C'9'.
Back to top
View user's profile Send private message
wiprov

New User


Joined: 13 Feb 2008
Posts: 15
Location: Chennai

PostPosted: Mon Jul 21, 2014 3:57 pm
Reply with quote

Hi Bill,

I have tried the below code and it is throwing me syntax error.

Code:

  SORT FIELDS=COPY                         
  INCLUDE COND=(1,80,CH,NE,80C'9')         
                           *               
WER268A  INCLUDE STATEMENT : SYNTAX ERROR 
]
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 21, 2014 5:29 pm
Reply with quote

Well, that's a No then.

I'd suggest two consecutive tests for 40 9's, to save having to continue the literal.

Please post SyncSort questions in the JCL part of the forum, not in DFSORT.
Back to top
View user's profile Send private message
wiprov

New User


Joined: 13 Feb 2008
Posts: 15
Location: Chennai

PostPosted: Mon Jul 21, 2014 5:39 pm
Reply with quote

Thanks Bill..

I have tried the below code but still facing the same issue

Code:

   SORT FIELDS=COPY                                         
   INCLUDE COND=(1,40,CH,NE,40C'9',AND,41,40,CH,NE,40C'9')   
                            *                               
 WER268A  INCLUDE STATEMENT : SYNTAX ERROR                   


Kindly suggest
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 21, 2014 5:53 pm
Reply with quote

No, I meant since you can't use the repetition factor in a condition, then you can't use it.

Code:
 OMIT COND=(1,40,CH,EQ,C'999999forty of them',
          AND,
            1,40,CH,EQ,41,40,CH)


Something like that.

Looking now at your code, you'd be better off with OMIT to avoid negating the conditions.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Mon Jul 21, 2014 8:00 pm
Reply with quote

Code:
 OMIT COND=(1,1,CH,EQ,C'9',AND,2,79,CH,EQ,1,79)

icon_wink.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 21, 2014 10:02 pm
Reply with quote

Indeed Marso. Needs documentation, else people will just stare at it :-)


Define some symbols on DDname SYMNAMES:

Code:
  FIELD-TO-CHECK-FOR-SAME-VALUE,3,40,CH         
      POSITION,FIELD-TO-CHECK-FOR-SAME-VALUE     
    SAME-VALUE-FIRST-BYTE,*,1,=                 
    FIELD-EXCLUDING-LEADING-BYTE,*,39,=         
      POSITION,SAME-VALUE-FIRST-BYTE             
    FIELD-EXCLUDING-TRAILING-BYTE,*,=,=         
* CONSTANT                                       
ALL-VALUE-TO-IGNORE,C'U'     


Include SYMNOUT DDname for run-time copy of symbols and hteir translation:

Code:
------- ORIGINAL STATEMENTS FROM SYMNAMES -------
  FIELD-TO-CHECK-FOR-SAME-VALUE,3,40,CH         
      POSITION,FIELD-TO-CHECK-FOR-SAME-VALUE     
    SAME-VALUE-FIRST-BYTE,*,1,=                 
    FIELD-EXCLUDING-LEADING-BYTE,*,39,=         
      POSITION,SAME-VALUE-FIRST-BYTE             
    FIELD-EXCLUDING-TRAILING-BYTE,*,=,=         
* CONSTANT                                       
ALL-VALUE-TO-IGNORE,C'U'                         
                                                 
------------------ SYMBOL TABLE -----------------
FIELD-TO-CHECK-FOR-SAME-VALUE,3,40,CH           
SAME-VALUE-FIRST-BYTE,3,1,CH                     
FIELD-EXCLUDING-LEADING-BYTE,4,39,CH             
FIELD-EXCLUDING-TRAILING-BYTE,3,39,CH           
ALL-VALUE-TO-IGNORE,C'U'     


The code:

Code:
  OPTION COPY                                         
  OMIT COND=((SAME-VALUE-FIRST-BYTE,                 
             EQ,                                     
             ALL-VALUE-TO-IGNORE),                   
            AND,                                     
             (FIELD-EXCLUDING-TRAILING-BYTE,         
             EQ,                                     
              FIELD-EXCLUDING-LEADING-BYTE))     


The translated code:

Code:
  OPTION COPY                                         
 OMIT COND=((3,1,CH,EQ,C'U'),AND,(3,39,CH,EQ,4,39,CH))


When the field needs to be different, change the start, length and the length-minus-one value, and the constant to match to. That's it.

(note, names chosen are just for demonstration, not actual suggestions...)
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Jul 22, 2014 1:39 pm
Reply with quote

Bill wrote:
Indeed Marso. Needs documentation, else people will just stare at it :-)

Indeed :-)

It works because character comparison goes from left to right.
So I make sure the first character is a '9':
Code:
1,1,CH,EQ,C'9'
then I check that the 2nd char is equal to the 1st, the 3rd equal to the 2nd, and so on until the end of the field:
Code:
2,79,CH,EQ,1,79
If all come true, then 1st char = 2nd char = 3rd = 4th ... = 80th, all of them being equal to '9'.

(I remember using similar tricks when I was programming in Assembler, way back in the 20th century)
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Jul 23, 2014 2:59 pm
Reply with quote

Marso wrote:
Code:
 OMIT COND=(1,1,CH,EQ,C'9',AND,2,79,CH,EQ,1,79)

icon_wink.gif
Good trick! icon_smile.gif
Back to top
View user's profile Send private message
wiprov

New User


Joined: 13 Feb 2008
Posts: 15
Location: Chennai

PostPosted: Wed Jul 23, 2014 10:08 pm
Reply with quote

Super.....Thanks for the smart code....
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Reference for COND parameter. JCL & VSAM 1
No new posts IEF142I and Cond. Code 12 All Other Mainframe Topics 3
No new posts Cond parameter and Rc code of a proce... JCL & VSAM 5
No new posts INCLUDE COND with WHEN=GROUP SYNCSORT 12
Search our Forums:

Back to Top