Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Splitting single record in multiple files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
pema_yozer

New User


Joined: 16 Feb 2009
Posts: 45
Location: pune

PostPosted: Thu Dec 06, 2012 2:09 pm    Post subject: Splitting single record in multiple files
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

Moderator


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

PostPosted: Thu Dec 06, 2012 2:13 pm    Post subject:
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    Post subject: Reply to: Splitting single record in multiple files
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Dec 06, 2012 5:17 pm    Post subject: Reply to: Splitting single record in multiple files
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    Post subject:
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: 45
Location: pune

PostPosted: Thu Dec 06, 2012 5:43 pm    Post subject: Reply to: Splitting single record in multiple files
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    Post subject: Reply to: Splitting single record in multiple files
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    Post subject: Re: Reply to: Splitting single record in multiple files
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: 45
Location: pune

PostPosted: Thu Dec 06, 2012 5:53 pm    Post subject:
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    Post subject: Reply to: Splitting single record in multiple files
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Dec 06, 2012 6:22 pm    Post subject: Re: Reply to: Splitting single record in multiple files
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: 45
Location: pune

PostPosted: Thu Dec 06, 2012 6:32 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Dec 06, 2012 6:48 pm    Post subject: Reply to: Splitting single record in multiple files
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: 45
Location: pune

PostPosted: Thu Dec 06, 2012 6:53 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Dec 06, 2012 7:02 pm    Post subject: Reply to: Splitting single record in multiple files
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: 45
Location: pune

PostPosted: Fri Dec 07, 2012 10:47 am    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sun Dec 16, 2012 2:13 pm    Post subject: Reply to: Splitting single record in multiple files
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sun Dec 16, 2012 3:29 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us