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

Dynamic "INCLUDE COND"


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Sep 17, 2012 6:39 pm
Reply with quote

Hi,

What would be the best way (fastest, simplest) to perform the following task:

I want to dynamically build a CNTL-card with a INCLUDE COND that looks like this:

Code:

INCLUDE COND=(SYMBOL,EQ,C'TYPE1',OR,
              SYMBOL,EQ,C'TYPE2',OR,
....
              SYMBOL,EQ,C'TYPEn')

Where "SYMBOL" is the name of a symbol referring to a field.

The values for the types are coming from file - and I don't know how many there will be, but I do know, that they are all different.

The output need only be syntaxical correct - the example is one solution - there are other possiblities, ie. move OR etc.
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 Sep 17, 2012 6:52 pm
Reply with quote

Don't have time to test, but by making the "dummy" tests for the first and last, which can be generated from HEADERn and TRAILERn, the construction of the actual tests you want is simplified. Read the conditions file and for every line generate the same with the contents of the data from your file being placed within the quotes of the literal in the INCLUDE tests.


Code:
INCLUDE COND=(1,1,CH,NE,1,1,CH,OR,
              SYMBOL,EQ,C'TYPE1',OR,
              SYMBOL,EQ,C'TYPE2',OR,
              ....
              SYMBOL,EQ,C'TYPEn',OR,
              1,1,CH,NE,1,1,CH)
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Mon Sep 17, 2012 6:56 pm
Reply with quote

I would write a REXX exec to read the 'file' and generate the include condition to an output file.

This output file would be part of a concatenated SYSIN DD for your actual sort step.

Just one of the possibilities.
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Sep 17, 2012 6:57 pm
Reply with quote

Hi Bill,

Sounds simple and fast - thanks icon_smile.gif I'll present the "fun" solution here later.. icon_wink.gif

/Claes
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Sep 17, 2012 6:58 pm
Reply with quote

Hi Dave, sure is. But I prefer to use ICETOOL if possible. icon_cool.gif
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Sep 17, 2012 7:25 pm
Reply with quote

Bill,

Decided that your solution was not only simple and fast, but also fun.. icon_cool.gif

No need to put more time into this.. Thanks again.
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Sep 17, 2012 7:29 pm
Reply with quote

Code:

//TOOLIN   DD *                                               
  SELECT FROM(IN) TO(OUT) ON(TYPE) FIRST USING(CTL1)
//CTL1CNTL DD *                                               
  OUTFIL FNAMES=OUT,                                           
    BUILD=(16X,C'TYPE,EQ,C',                       
               P,TYPE,P,C',OR,',80:X),             
    HEADER1=(2X,C'INCLUDE COND=(1,1,BI,NE,1,1,BI,OR,'),       
    TRAILER1=(16X,C'1,1,BI,NE,1,1,BI)')                 


Outputs:
Code:

  INCLUDE COND=(1,1,BI,NE,1,1,BI,OR,           
                TYPE,EQ,C'TYP1',OR,
                TYPE,EQ,C'TYP2',OR,
                TYPE,EQ,C'TYP3',OR,
                1,1,BI,NE,1,1,BI)             
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Sep 17, 2012 7:30 pm
Reply with quote

Note, P is a symbol equalvalent to X'7D' here at my site.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Sep 17, 2012 7:32 pm
Reply with quote

How and when are you going to find that 1,1,CH is not equal to 1,1CH but real quick without testing, below should help.

Code:
INCLUDE COND=(1,1,CH,NE,1,1,CH,OR,         -->??
              (SYMBOL(FIRST 4 BYTE),EQ,C'TYPE',AND,
              (SYMBOL(LAST BYTE),GE,1,AND,SYMBOL(LAST BYTE),LE,N)))

OR if last byte is numeric check only then...

Code:
INCLUDE COND=(1,1,CH,NE,1,1,CH,OR,        --> ??
              (SYMBOL(FIRST 4 BYTE),EQ,C'TYPE',AND,
              (SYMBOL(LAST BYTE),EQ,NUM)))


Thanks,
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 Sep 17, 2012 7:40 pm
Reply with quote

The test for the first byte not equal to the first byte is just a "placeholder". It will never be true, and combining it by using OR will not affect the processing of the selection actually desired in the INCLUDE.


<Some necessary opening stuff>NOT TRUE, OR
SOME CONDITION,OR,
SOME CONDITION,OR,
SOME CONDITION,OR,
NOT TRUE<some necessary closing stuff>

Purpose just to simplify the generation of the SOME CONDITION stuff, so no need to worry about first/last.

I saw Frank Yaeger using something like it and had no time to search for the example so "imagined" what it had to be :-)

Kolusu will be along later....
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Sep 17, 2012 7:42 pm
Reply with quote

Add REMOVECC, then it's all great.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Sep 17, 2012 7:45 pm
Reply with quote

Bill Woodger,
Quote:
The test for the first byte not equal to the first byte is just a "placeholder". It will never be true, and combining it by using OR will not affect the processing of the selection actually desired in the INCLUDE.

If this was a response to my question, why does OP want to add extra condition and processing? If the condition is never going to be true, why bother to have it in the card itself?

I was merely implying typo on OP's end when i asked that question.

Thanks,
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 Sep 17, 2012 8:19 pm
Reply with quote

I think everything is in the original post and in my reply.

Perhaps an even simpler way is to use concatenation:

//SYSIN DD "top of the cards"
// DD generated cards
// DD bottom of the cards

More "set up" this way.

The HEADERn and TRAILERn can be modified to generate any other control statements required, so a general "quick way of generating a sort deck with data from a file". Yes, slows down a little with the never-true tests, but gets the job done and is "reusable".

If the selection file is

Code:
TYPE1
TYPE2

and the data is

Code:
TYPE1
TYPE2
TYPE3

then testing for NUM is going to get too much.

My reading is that the selection file is more like

Code:
TYPE1
TOPEX
IJDK3
11111


From the original:

Quote:
I don't know how many there will be, but I do know, that they are all different.
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Sep 17, 2012 8:57 pm
Reply with quote

Yes, the types are diverse, like Bill suggests.

Maybe, it makes more sense if you just repeat the first and last record.

Like this:
Code:

INCLUDE COND=(TYPE,EQ,C'ABCD',OR,
              TYPE,EQ,C'ABCD',OR,
              TYPE,EQ,C'EFGH',OR,
              TYPE,EQ,C'IJKL',OR,
              TYPE,EQ,C'IJKL')
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Sep 17, 2012 9:19 pm
Reply with quote

Claes Norreen,

Since you have "diverse types", why not use JOINKEYs? Using dynamic sort card for too many INCLUDE/OMIT leaves you vulnerable to ice151a

Thanks,
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Sep 17, 2012 9:45 pm
Reply with quote

Sqlcode1,

I think you misunderstand the task I wish to do. I don't know I would use JOINKEYS here, anyway?
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Sep 17, 2012 10:20 pm
Reply with quote

Claes Norreen wrote:
Sqlcode1,

I think you misunderstand the task I wish to do. I don't know I would use JOINKEYS here, anyway?


I agree with SQLCODE that you can use JOINKEYS as you are looking for TYPE field which is at the same position for every record. So why not match the 2 files (extract file and Look up file) on the type field and get the matching records?
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Mon Sep 17, 2012 10:24 pm
Reply with quote

Ah, I see now. Maybe "diverse" was not correct English.. I have a few types I wish to include from a dataset, and I don't want to sort it by TYPE, but keep it the way it is. Hence, a copy operation makes sense.

Sorry for the confusion
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts PuTTY - "User is not a surrogate... IBM Tools 5
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts JCL Dynamic System Symbols JCL & VSAM 3
No new posts Newbie Stuck on "Duplicate Datas... TSO/ISPF 5
Search our Forums:

Back to Top