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
 

 

Help required in COND

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Help required in COND
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Mon Jul 21, 2014 3:12 pm    Post subject: Reply to: Help required in COND
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Mon Jul 21, 2014 5:29 pm    Post subject: Reply to: Help required in COND
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Mon Jul 21, 2014 5:53 pm    Post subject: Reply to: Help required in COND
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: 1219
Location: Israel

PostPosted: Mon Jul 21, 2014 8:00 pm    Post subject: Reply to: Help required in COND
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Mon Jul 21, 2014 10:02 pm    Post subject: Reply to: Help required in COND
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: 1219
Location: Israel

PostPosted: Tue Jul 22, 2014 1:39 pm    Post subject: Reply to: Help required in COND
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

Senior Member


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

PostPosted: Wed Jul 23, 2014 2:59 pm    Post subject: Re: Reply to: Help required in COND
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    Post subject:
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    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 how to DYNAMICALLY write sort cond to... mohamedmubee COBOL Programming 13 Fri Aug 26, 2016 11:46 pm
No new posts COND parameter vs IF THEN ELSE Alks JCL & VSAM 11 Fri Jun 17, 2016 5:28 pm
No new posts FTP help required amitc23 All Other Mainframe Topics 3 Thu Apr 28, 2016 12:02 pm
No new posts Why Newcopy is required when we have ... DIXINSH CICS 5 Thu Apr 28, 2016 9:47 am
No new posts Include Cond issue vickey_dw DFSORT/ICETOOL 6 Tue Mar 29, 2016 8:51 pm


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