View previous topic :: View next topic
Author
Message
pshongal New User Joined: 14 Jun 2012Posts: 96 Location: India
Hi,
Can I write the O/P in the same O/P file with different condition?
Below is my SORT card, but it is failing.
Code:
JOINKEYS FILE=F1,FIELDS=(35,23,A),SORTED,NOSEQCK
JOINKEYS FILE=F2,FIELDS=(31,23,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:5,1450,F2:1,1451,?)
OPTION COPY
OUTFIL FNAMES=OUT1,INCLUDE=((2902,1,CH,EQ,C'B',AND,
2901,1,CH,EQ,C'U),OR,
(2902,1,CH,EQ,C'2'))
BUILD=(1451,1450)
OUTFIL FNAMES=OUT1,INCLUDE=(2902,1,CH,EQ,C'1'),
BUILD=(1,1450)
/*
Error:
Code:
ICE219I 0 DUPLICATE DDNAME OUT1 IGNORED
I tried with same O/P file name but different DD name, that also did not work.
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
Quick fix ................
Possibly using two executions of the sort step and using DISP=MOD for the second step,
or
Create two datasets in one iteration of sort and then append one to the other
or possibly pre creating the dataset and using DISP=MOD in the sort pgm
Back to top
Nic Clouston Global Moderator Joined: 10 May 2007Posts: 2455 Location: Hampshire, UK
Each OUTFIL defines a new DDname so you cannot have duplicate names.
You did not show the error message(s) for the when you uded different FNAMES. Perhaps you forgot to update the JCL to take into acount the second DDname and data set.
Back to top
pshongal New User Joined: 14 Jun 2012Posts: 96 Location: India
Hi Expat, Actually I wanted to avoid 2 sort steps, so was trying this way.
Hi Nic,
When I used same dataset with different DD name I got message as:
File cannot be allocated as duplicate name exists.
I used MOD,CATALOG,DELETE as Disp parameter
Back to top
Nic Clouston Global Moderator Joined: 10 May 2007Posts: 2455 Location: Hampshire, UK
Do not use the same data set name on both DD statements.
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2018 Location: USA
pshongal wrote:
I tried with same O/P file name but different DD name, that also did not work.
It definitely cannot work, if you ever tried to read about some fundamentals of zOS file system organization.
SORT opens all specified FNAMES (=DDNAMES) simultaneously, to be able to write all of them in parallel. The same dataset (=DSNAME) with DSORG=PS cannot be open for output more than once at the same time; only sequential OPEN-CLOSE-OPEN-CLOSE-... is allowed.
Try to use ICETOOL to perform two SORT steps as one job step.
Back to top
pshongal New User Joined: 14 Jun 2012Posts: 96 Location: India
Thanks Sergeyken. Could you pls tell me how Icetool can be used...?
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2018 Location: USA
Question #1: is ICETOOL available in your environment?
Question #2: did you read something about ICETOOL? For instance - One of available DFSORT/ICETOOL manuals
General approach to run more than one SORT step in a single job step, is as follows
Code:
COPY FROM(INPUT1) TO(OUTPUT) USING(SEL1)
COPY FROM(INPUT2) TO(OUTPUT) USING(SEL2)
If //OUTPUT DD is defined with DISP=NEW, or DISP=MOD, then the result of the second COPY is appended to the result of the first COPY.
For details I recommend to read one of ICETOOL manuals.
Back to top
pshongal New User Joined: 14 Jun 2012Posts: 96 Location: India
Thank you. Yes, ICETOOL is available in our environment. I will try this approach
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
pshongal wrote:
Thank you. Yes, ICETOOL is available in our environment. I will try this approach
OR you could also try modifying your control statements to conditionally reformat the output records using something like this:
Code:
JOINKEYS FILE=F1,FIELDS=(35,23,A),SORTED,NOSEQCK
JOINKEYS FILE=F2,FIELDS=(31,23,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:5,1450,F2:1,1451,?)
OPTION COPY
INCLUDE COND=((2902,1,CH,EQ,C'B',AND,
2901,1,CH,EQ,C'U'),OR,
2902,1,CH,EQ,C'1',OR,
2902,1,CH,EQ,C'2')
OUTFIL FNAMES=OUT1,
IFTHEN=(WHEN=(2902,1,SS,EQ,C'B,2'),
BUILD=(1451,1450)),
IFTHEN=(WHEN=(2902,1,CH,EQ,C'1'),
BUILD=(1,1450)),IFOUTLEN=1450
Back to top
Please enable JavaScript!