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
 

 

Dynamic "INCLUDE COND"

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Dynamic "INCLUDE COND"
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Sep 17, 2012 6:52 pm    Post subject: Reply to: Dynamic "INCLUDE COND"
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: 645
Location: Pennsylvania

PostPosted: Mon Sep 17, 2012 6:56 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 578
Location: USA

PostPosted: Mon Sep 17, 2012 7:32 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Sep 17, 2012 7:40 pm    Post subject: Reply to: Dynamic "INCLUDE COND"
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    Post subject:
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: 578
Location: USA

PostPosted: Mon Sep 17, 2012 7:45 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Sep 17, 2012 8:19 pm    Post subject: Reply to: Dynamic "INCLUDE COND"
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    Post subject:
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: 578
Location: USA

PostPosted: Mon Sep 17, 2012 9:19 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Amount field is getting corrupted whe... thesumitk SYNCSORT 5 Tue Oct 18, 2016 8:20 pm
No new posts hot to get details when "EXEC CI... Andi1982 CICS 11 Tue Sep 20, 2016 5:01 pm
No new posts how to DYNAMICALLY write sort cond to... mohamedmubee COBOL Programming 13 Fri Aug 26, 2016 11:46 pm
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am


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