View previous topic :: View next topic
|
Author |
Message |
pema_yozer
New User
Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
Hi
I have a requirement of splitting a single file into two files
Input
Code: |
aabbccddeeffgghh
aabbccddeeffgghh
aabbccddeeffgghh
aabbccddeeffgghh
aabbccddeeffgghh
|
the char bb ie position 3 and 4 should be present in both the files
and the record must be split from 10th position so the out put
looks like
output 1
Code: |
aabbccddee
aabbccddee
aabbccddee
aabbccddee
|
output 2
Code: |
bbffgghh
bbffgghh
bbffgghh
bbffgghh
|
Coul dthis be done through DFSORT |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
What did you try so far ??
I see you have some basic experience in SORT (After looking at your previous post)
If you encounter some errors in achieving the solution let us know we could help you for that
Also please use code tags going forward |
|
Back to top |
|
|
rakesha.hg
Active User
Joined: 21 Mar 2008 Posts: 161 Location: bangalore
|
|
|
|
hi,
try this icetool ... there can be still easier way to do this ...
Code: |
//SORT1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//IN DD *
AABBCCDDEEFFGGHH
AABBCCDDEEFFGGHH
AABBCCDDEEFFGGHH
AABBCCDDEEFFGGHH
AABBCCDDEEFFGGHH
XXBBYYZZ!@#$%ยข&*
/*
//T1 DD DSN=&&T1,DISP=(,PASS,DELETE),
// SPACE=(CYL,(1,1),RLSE)
//F1 DD DSN=A333448.IIRS.SORTOF1,DISP=(,CATLG,DELETE),
// SPACE=(CYL,(1,1),RLSE)
//F2 DD DSN=A333448.IIRS.SORTOF2,DISP=(,CATLG,DELETE),
// SPACE=(CYL,(1,1),RLSE)
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
COPY FROM(T1) USING(CTL2)
/*
//CTL1CNTL DD *
SORT FIELDS=COPY
INREC FIELDS=(1:1,10,11:3,2,13:11,6)
OUTFIL BUILD=(1,10,/,11,8)
/*
//CTL2CNTL DD *
SORT FIELDS=COPY
OUTFIL FNAMES=(F1,F2),SPLITBY=1
/* |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
rakesha.hg,
Thank you for contributing, but there is absolutely no need for two passes of the data.
The requirement is extremely simple, just requiring two OUTFILs with different BUILD statements in a COPY operation. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
pema_yozer
Hope you understand what Bill says...
"just requiring two OUTFILs with different BUILD statements in a COPY operation" |
|
Back to top |
|
|
pema_yozer
New User
Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
i couldnt get the above solution to work,
got error
Code: |
DFSORT CALL 0001 FOR COPY FROM IN TO T1 USING CTL1CNTL TERMINATED |
i had tried something like
Code: |
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,10),FNAMES=OUT1
INREC BUILD=(3,2,/,10,6),FNAMES=OUT2
/*
|
but oviously seems wrong, im not used to DFSORT |
|
Back to top |
|
|
rakesha.hg
Active User
Joined: 21 Mar 2008 Posts: 161 Location: bangalore
|
|
|
|
Bill,
Quote: |
there is absolutely no need for two passes of the data |
i expected this and did try to do in one pass and got lost .... i will do my home work and refine my skills. Thank you. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
pema_yozer wrote: |
i couldnt get the above solution to work,
got error
DFSORT CALL 0001 FOR COPY FROM IN TO T1 USING CTL1CNTL TERMINATED
i had tried something like
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,10),FNAMES=OUT1
INREC BUILD=(3,2,/,10,6),FNAMES=OUT2
/*
but oviously seems wrong, im not used to DFSORT |
Did you notice, Bill mentioned OUTFIL not inrec.... |
|
Back to top |
|
|
pema_yozer
New User
Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
yep.. actually ma page wasnt refreshed.. just saw it after posting the previous comment |
|
Back to top |
|
|
rakesha.hg
Active User
Joined: 21 Mar 2008 Posts: 161 Location: bangalore
|
|
|
|
Sometime back reading franks post i remembered reading '/' operator works only with outfil .... |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
rakesha.hg wrote: |
Sometime back reading Frank's post i remembered reading '/' operator works only with outfil .... |
Correct.
pema_yozer,
Unless two records are needed on the same output file from one input record, there is no need to use the Slash operator "/". |
|
Back to top |
|
|
pema_yozer
New User
Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
thanks experts for your help, ive got the code to work |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Thanks for letting us know. Can you show the code, please, as if you are using ICETOOL with a CNTL file, there is no need to? |
|
Back to top |
|
|
pema_yozer
New User
Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
Code: |
OPTION COPY
OUTFIL BUILD=(1,10),FNAMES=SORTOUT1
OUTFIL BUILD=(3,2,10,6),FNAMES=SORTOUT2
/* |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK. You know that 1,10 and 10,6 gives you another byte which is on both output files. |
|
Back to top |
|
|
pema_yozer
New User
Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
yep, i amended it to 1,10 and 11,6 |
|
Back to top |
|
|
toughhou
New User
Joined: 21 Jan 2010 Posts: 5 Location: China
|
|
|
|
Hi pema_yozer,
I'm learning ICETOOL, and here I can provide another way for your requirement using the SUBSET of ICETOOL. Very similar as yours, just for share.
Code: |
//IN1 DD *
AABBCCDDEEFFGGHH
AABBCCDDEEFFGGHH
AABBCCDDEEFFGGHH
//TOOLIN DD *
SUBSET FROM(IN1) TO(OUT1) USING(CTL1) KEEP INPUT
//CTL1 DD *
OUTFIL FNAMES=F01,OUTREC=(1,10)
OUTFIL FNAMES=F02,OUTREC=(C'BB',11,6)
//* |
CODE' D |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
toughhou,
Thank you for contributing and trying to help.
However, please next time read the whole thread and understand before posting anything.
There is no need to use any ICETOOL operator with a CNTL file. You are using SUBSET without specifying a "subset" of anything, so no need to use SUBSET, even if it "works". Anyone looking the at processing in two weeks time will think that something is missing, and take much longer to understand what is going on. |
|
Back to top |
|
|
toughhou
New User
Joined: 21 Jan 2010 Posts: 5 Location: China
|
|
|
|
Hi Bill,
Thanks for your kind remind and suggestion. I'm fresh to ICETOOL, and not quite clear about what kind of advantages each option of ICETOOL have. But I will try my best to pay more attention next time.
Also thanks for Code my code. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Quote: |
Also thanks for Code my code. |
Not actually me, so thanks passed on to the Code'r. |
|
Back to top |
|
|
|