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

ifthen not filtering, what am i doing wrong?


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

New User


Joined: 18 Sep 2005
Posts: 6

PostPosted: Sun Sep 18, 2005 5:09 am
Reply with quote

hello,
first of all i am new in this play ground and wrote my first JCL only a few weeks ago so bear with me...
i have been tried the following code with some changes, the code is of a splice that works on two FB fies;

File A: lrec= 470
File B: lrec=113

The code is documented so hopefuly you would understand what i intended to do there.
The problem is that the IFTHEN statements in CTL3 dosent seem to be doing any filtering.

Code:

//******************************************************
//* SPLICE
//******************************************************
//STEP100 EXEC  PGM=ICETOOL
//*  INPUT FILES
//IN1    DD DSN=...File A
//            DISP=SHR
//IN2    DD DSN=...File B
//            DISP=SHR
//*        TMP FILES
//T1       DD  DSN=&&T1,UNIT=SYSDA,SPACE=(568(2,1),RLSE),
//                         AVGREC=M,DISP=(,DELETE)
//T2       DD  DSN=&&T1,UNIT=SYSDA,SPACE=(568(2,1),RLSE),
//                         AVGREC=M,DISP=(,DELETE)
//CONCT   DD  DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,DELETE)
//             DD  DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,DELETE)
//*
//*  OUTPUT FILE
//BTH      DD  DSN=..ON BOTH, DISP=(,CATLG,CATLG),
//                        SPACE=(568,(2,1),RLSE),AVGREC=M
//ONA     DD  DSN=...ON A, DISP=(,CATLG,CATLG),
                        AVGREC=U, SPACE=(568,(1,10000),RLSE)
//ONB    DD  DSN=...ON B,DISP=(,CATLG,CATLG)
//                   SPACE=(113,(1,10),RLSE),AVGREC=K
//DFSMSG   DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN   DD  *
   COPY FROM(IN1) TO(T1) USING(CTL1)
   COPY FROM(IN2) TO(T2) USING(CTL2)
   SPLICE FROM(CONCT) TO(BTH) ON(1,18,CH) WITHALL -
                       WITH(568,1) KEEPNODUPS  USING(CTL3)
/*                 
//CTL1CNTL DD  *
********************************************************
*   MARK EACH RECORD IN(49,1)= 2|4 AS 'Y' ALL OTHERS WITH 'N'
*   TO USE FOR FILTERINGAT SPLICE END.
********************************************************         
   OUTREC IFOUTLEN=568,
         IFTHEN=(WHEN=(49,1,CH,EQ,C'2',OR,49,1,CH,EQ,C'4'),
                  BUILD=(1,470,95X,C'Y',567:C'11')),
         IFTHEN=(WHEN=NONE,
                  BUILD=(1,470,95X,C'N',567:C'11'))
/*                                     
//CTL2CNTL DD  *
   OUTREC FIELDS=(1,18,452X,19,95,1X,567:C'22')
/*                                     
//CTL3CNTL DD  *
************************************************************
* 'Y12'-> OK, PUT IN OUTPUT UNCHANGED
* 'N12'-> INVALID, CORRECT(49,1) TO 2
************************************************************
OUTFIL FNAMES=BOTH, 
          IFTHEN=(WHEN=(566,3,CH,EQ,C'Y12')
                        BUILD=(1,569))             --> CAN BE DROPPRD OUT?
          IFTHEN=(WHEN=(566,3,CH,EQ,C'N12'),
                       OVERLAY=(49:C'2'))
************************************************************
*--ONA
* 'N11'-> OK, PUT ON OUTPUT FILE AS IS
* 'Y11'-> INVALID, CORRECT(49,1) TO 0
************************************************************
 OUTFIL FNAMES=ON41,
          IFTHEN=(WHEN=(566,3,CH,EQ,C'N11'),
                       BUILD=(1,568)),
          IFTHEN=(WHEN=(566,3,CH,EQ,C'Y11'),
                       OVERLAY=(49:C'0'))
************************************************************
*--ON0112 FILE--
* '22' -> NON MATCHED RECORDS FROM FILE B
************************************************************
 OUTFIL FNAMES=ON112,INCLUDE=(566,2,CH,EQ,C'22'),
        OUTREC=(1,18,471,95)
/*


The ONB file is coming out empty as expected.
The thing is that the BTH & ONA file come out with the same number of record, and both conatain all the possible record variations('Y11','Y12', '22'...),
as if the IFTHEN statements where completely ignored.

i have tried different variations, mainly simple stuff(originaly used OVERLAY where ever possible insted of BUILD, deleted the IFTHEN in the ONA OUTFIL) and went through the manuels, and i cant see where i did wrong.

Would very much appreciate any input and remarks.

BTW. is there any (space or performance) issues resulting from using the above splice with its 3 temp files(T1,T2 & concat) as it is used here over using a single temp file as i saw in some examples?
Back to top
View user's profile Send private message
Dindi

New User


Joined: 18 Sep 2005
Posts: 6

PostPosted: Sun Sep 18, 2005 1:07 pm
Reply with quote

Hi,
i just noted that the version i pasted here is an older one with a few bugs in the column positioning(Sorry);

in CTL3 it should be:
Code:

//OUTFIL FNAMES=ON112,INCLUDE=(57,2,CH,EQ,C'22'),
//        OUTREC=(1,18,471,95)

and note that i left the output records in LREC=568 intentionaly.

thanks.[/code]
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Sep 23, 2005 2:27 am
Reply with quote

Well, for starters, you have //BTH and TO(BTH), but you have FNAMES=BOTH. Try using FNAMES=BTH and see if that fixes it up. If not, let me know and I'll take a closer look.
Back to top
View user's profile Send private message
Dindi

New User


Joined: 18 Sep 2005
Posts: 6

PostPosted: Sun Sep 25, 2005 5:16 am
Reply with quote

thank you Frank for the replay.
It seems I did a partial job in changing the names of the files in an unsuccessful attempt to make it more understandable.
As i said, i am green but i do know when a job ends ok. What you saw was just a mistake made due to the changes i made in the file names of this post and if I'm not mistaken the BOTH/BTH mistake would have(?) resulted in an JCL error, or at least RC>4.
Sorry for all the mistakes, Here is a clean version:
Code:

//******************************************************
//* SPLICE
//******************************************************
//STEP100 EXEC  PGM=ICETOOL
//*  INPUT FILES
//IN1    DD DSN=...File A
//            DISP=SHR
//IN2    DD DSN=...File B
//            DISP=SHR
//*   TEMP FILES
//T1       DD  DSN=&&T1,UNIT=SYSDA,SPACE=(568(2,1),RLSE),
//                         AVGREC=M,DISP=(,DELETE)
//T2       DD  DSN=&&T1,UNIT=SYSDA,SPACE=(568(2,1),RLSE),
//                         AVGREC=M,DISP=(,DELETE)
//CONCT    DD  DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,DELETE)
//             DD  DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,DELETE)
//*
//*  OUTPUT FILES
//BTH      DD  DSN=..ON BOTH, DISP=(,CATLG,CATLG),
//                        SPACE=(568,(2,1),RLSE),AVGREC=M
//ONA      DD  DSN=...ON A, DISP=(,CATLG,CATLG),
//                        AVGREC=U, SPACE=(568,(1,10000),RLSE)
//ONB      DD  DSN=...ON B,DISP=(,CATLG,CATLG)
//                   SPACE=(113,(1,10),RLSE),AVGREC=K
//DFSMSG   DD SYSOUT=*
//TOOLMSG  DD SYSOUT=*
//TOOLIN   DD  *
   COPY FROM(IN1) TO(T1) USING(CTL1)
   COPY FROM(IN2) TO(T2) USING(CTL2)
   SPLICE FROM(CONCT) TO(BTH) ON(1,18,CH) WITHALL -
                       WITH(568,1) KEEPNODUPS  USING(CTL3)
/*                 
//CTL1CNTL DD  *
********************************************************
*   MARK EACH RECORD IN(49,1)= 2|4 AS 'Y' ALL OTHERS WITH 'N'
*   TO USE FOR FILTERINGAT SPLICE END.
********************************************************         
   OUTREC IFOUTLEN=568,
         IFTHEN=(WHEN=(49,1,CH,EQ,C'2',OR,49,1,CH,EQ,C'4'),
                  BUILD=(1,470,95X,C'Y',567:C'11')),
         IFTHEN=(WHEN=NONE,
                  BUILD=(1,470,95X,C'N',567:C'11'))
/*                                     
//CTL2CNTL DD  *
   OUTREC FIELDS=(1,18,452X,19,95,1X,567:C'22')
/*                                     
//CTL3CNTL DD  *
************************************************************
* 'Y12'-> VALID, PUT ON OUTPUT FILE AS IS
* 'N12'-> INVALID, CORRECT(49,1) TO 2
************************************************************
OUTFIL FNAMES=BTH, 
          IFTHEN=(WHEN=(566,3,CH,EQ,C'Y12')
                        BUILD=(1,569))             --> CAN BE DROPPRD OUT?
          IFTHEN=(WHEN=(566,3,CH,EQ,C'N12'),
                       OVERLAY=(49:C'2'))
************************************************************
*--ONA
* 'N11'-> VALID, PUT ON OUTPUT FILE AS IS
* 'Y11'-> INVALID, CORRECT(49,1) TO 0
************************************************************
OUTFIL FNAMES=ONA,
          IFTHEN=(WHEN=(566,3,CH,EQ,C'N11'),
                       BUILD=(1,568)),
          IFTHEN=(WHEN=(566,3,CH,EQ,C'Y11'),
                       OVERLAY=(49:C'0'))
************************************************************
*--ONB FILE--
* '22' -> NON MATCHED RECORDS FROM FILE B
************************************************************
OUTFIL FNAMES=ONB,INCLUDE=(567,2,CH,EQ,C'22'),
        OUTREC=(1,18,471,95)
/*

Although the IFTHEN clauses in CTL3 do what they supposd to do on the records matching the criteria(the corrections using the OVERLAY), but i also expected to get a filtering effect like the one i get when using INCLUDE, instead the BTH and ONA files came out the same size, and both contain all possible record variation('Y12', 'N12','Y11','Y11' & '22'). It seems like no filtering took place.
Can u see anything wrong in the code? or did i missunderstood someting about the way IFTHEN is supposed to work?

Would very much appriciate any help/remarks anyone could givee
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sun Sep 25, 2005 10:23 pm
Reply with quote

Since it's Sunday, I'd like you to do a little more work on this yourself and give me some more information before I spend the time to analyze your job. You have:

Code:

...
//T1       DD  DSN=&&T1,UNIT=SYSDA,SPACE=(568(2,1),RLSE),
//                         AVGREC=M,DISP=(,DELETE)
//T2       DD  DSN=&&T1,UNIT=SYSDA,SPACE=(568(2,1),RLSE),
//                         AVGREC=M,DISP=(,DELETE)
//CONCT    DD  DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,DELETE)
//             DD  DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,DELETE)
...


You're using &&T1 for both T1 and T2 - I assume you meant to use &&T2 for T2, so change that first and see if that helps. Better yet, avoid the concatenation which can result in problems due to a system restriction, and use just a T1 MOD data set instead:

Code:

//T1       DD  DSN=&&T1,UNIT=SYSDA,SPACE=(568(2,1),RLSE),
//                         AVGREC=M,DISP=(MOD,PASS)
...
//TOOLIN   DD  *
   COPY FROM(IN1) TO(T1) USING(CTL1)
   COPY FROM(IN2) TO(T1) USING(CTL2)
   SPLICE FROM(T1) TO(BTH) ON(1,18,CH) WITHALL -
                       WITH(568,1) KEEPNODUPS  USING(CTL3)   


If that doesn't help (I haven't really analyzed whether it will or not), then show me an example of the records in each input file (just the relevent values), what you expect for the records in each output file, and what you're actually getting for the records in each output file. It would also help if you explained what it is you're trying to do.
Back to top
View user's profile Send private message
Dindi

New User


Joined: 18 Sep 2005
Posts: 6

PostPosted: Wed Sep 28, 2005 4:01 am
Reply with quote

Hello Frank,
I tried both options, but with no change in the results(btw, in my original code the //T2 line was actually &&T2 and not as it was in the code i posted)
the line structure is more or less as follows:
1-18-record key,
49,1 a flag.
In this JCL's context 49,1 = 2 or 4 means 'Y' all other values as 'N'(although i could skip this and check for 4 or 2 at CLT3, but i tried that too)
i try to seperate the file to BOTH, ONA, & ONB and while at it,as you can see from the code, i have what i define as the Valid combinations and the INVALID ones;
- the valid ones i want outputed with no change.
- the invlid lines have the 49,1 corrected.

examples:
input A:
1-18-----...49,1 ==>location
A1............2
A2............4
A3............3
A4............2

input B:
1-18-----. ==>location
A1
A3
B1
B2

after CTL1 expected values(which seenms to come out as expected):
1-18-----...49,1.......56,3 ==>location
A1............2............Y11
A2............4............Y11
A3............3............N11
A4............1............N11

expected output on BTH:
1-18-----...49,1.......56,3 ==>location
A1............2............Y12
A3............2............N12


actual result on BTH:
A1............2............Y12
A2............4............Y11
A3............2............N12
A4............1............N11

as i said before, All possible combinations turn out in BTH file as well on the ONA file. The ON B file is expected to come out empty, and it does.

hope the example was helps.
Dindi.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Sep 28, 2005 4:32 am
Reply with quote

Oh, I see the problem now. You say you want only certain records in BTH and ONA, but you're not doing an INCLUDE or OMIT for BTH or ONA to get just those records, so you get all of the records for those two.

Your OUTFIL for BTH only has IFTHENs. IFTHENs just reformat the records - they don't drop any records. You need to have INCLUDE= or OMIT= in your OUTFIL for BTH to actually drop records.

Likewise for your OUTFIL for ONA.

Your OUTFIL for ONB does have an INCLUDE, so it only includes certain records.
Back to top
View user's profile Send private message
Dindi

New User


Joined: 18 Sep 2005
Posts: 6

PostPosted: Wed Sep 28, 2005 12:56 pm
Reply with quote

Thanks allot Frank!
For some reason i was have decided that INCLUDE|OMIT cant be used along with IFTHEN, so i presumed that the IFTHEN also does all that INCLUDE and OMIT can do. I don't know how i missed that in the manual.

Thank you.[/quote]
Back to top
View user's profile Send private message
Dindi

New User


Joined: 18 Sep 2005
Posts: 6

PostPosted: Wed Sep 28, 2005 2:10 pm
Reply with quote

Quote:
. Better yet, avoid the concatenation which can result in problems due to a system restriction, and use just a T1 MOD data set instead:


Can u elaborate on this a bit Frank (or anyone else)?
The SPLICE syntax i posted is the one most commonly used here, and we have been experiencing a few problems- we think that we might be loosing records - could the concatenation cause that under some system restriction (space or other)?

Dindi.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Sep 28, 2005 8:19 pm
Reply with quote

Yes, the concatenation can cause loss of records due to the system restriction. See the second bullet in the link below to "z/OS DFSORT Application Guide" for a description of this system restriction:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/1.8.3.1?SHELF=&DT=20050222160456&CASE=

It's best to use one MOD data set for these cases rather than concatenation to avoid problems caused by this system restriction.
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 Abend S0C4 11 (Page Translation Excep... PL/I & Assembler 16
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts REXX SDSF filtering CLIST & REXX 8
No new posts Cant find hex value using IFTHEN=(WHEN DFSORT/ICETOOL 12
No new posts Using REXX to access SDSF; What am I ... CLIST & REXX 39
Search our Forums:

Back to Top