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?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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.
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
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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:
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:
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.
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.
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.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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.
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.
. 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)?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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: