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

Splitting single record in multiple files


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

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Thu Dec 06, 2012 2:09 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Dec 06, 2012 2:13 pm
Reply with quote

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
View user's profile Send private message
rakesha.hg

Active User


Joined: 21 Mar 2008
Posts: 161
Location: bangalore

PostPosted: Thu Dec 06, 2012 4:59 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Dec 06, 2012 5:17 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Dec 06, 2012 5:24 pm
Reply with quote

pema_yozer

Hope you understand what Bill says...
"just requiring two OUTFILs with different BUILD statements in a COPY operation"
Back to top
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Thu Dec 06, 2012 5:43 pm
Reply with quote

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
View user's profile Send private message
rakesha.hg

Active User


Joined: 21 Mar 2008
Posts: 161
Location: bangalore

PostPosted: Thu Dec 06, 2012 5:49 pm
Reply with quote

Bill,

Quote:
there is absolutely no need for two passes of the data

i expected this icon_biggrin.gif 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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Dec 06, 2012 5:51 pm
Reply with quote

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
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Thu Dec 06, 2012 5:53 pm
Reply with quote

yep.. actually ma page wasnt refreshed.. just saw it after posting the previous comment
Back to top
View user's profile Send private message
rakesha.hg

Active User


Joined: 21 Mar 2008
Posts: 161
Location: bangalore

PostPosted: Thu Dec 06, 2012 5:56 pm
Reply with quote

Sometime back reading franks post i remembered reading '/' operator works only with outfil ....
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Dec 06, 2012 6:22 pm
Reply with quote

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
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Thu Dec 06, 2012 6:32 pm
Reply with quote

thanks experts for your help, ive got the code to work
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Dec 06, 2012 6:48 pm
Reply with quote

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
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Thu Dec 06, 2012 6:53 pm
Reply with quote

Code:
OPTION COPY
  OUTFIL BUILD=(1,10),FNAMES=SORTOUT1
  OUTFIL BUILD=(3,2,10,6),FNAMES=SORTOUT2
/*
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Dec 06, 2012 7:02 pm
Reply with quote

OK. You know that 1,10 and 10,6 gives you another byte which is on both output files.
Back to top
View user's profile Send private message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 54
Location: pune

PostPosted: Fri Dec 07, 2012 10:47 am
Reply with quote

yep, i amended it to 1,10 and 11,6
Back to top
View user's profile Send private message
toughhou

New User


Joined: 21 Jan 2010
Posts: 5
Location: China

PostPosted: Sun Dec 16, 2012 1:48 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Dec 16, 2012 2:13 pm
Reply with quote

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
View user's profile Send private message
toughhou

New User


Joined: 21 Jan 2010
Posts: 5
Location: China

PostPosted: Sun Dec 16, 2012 2:53 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Dec 16, 2012 3:29 pm
Reply with quote

Quote:


Also thanks for Code my code.


Not actually me, so thanks passed on to the Code'r.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top