MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Split the records and write it in multiple file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Shankarganesh_gopal
Beginner


Joined: 24 May 2005
Posts: 36
Topics: 20
Location: chennai

PostPosted: Wed Sep 20, 2006 4:47 am    Post subject: Split the records and write it in multiple file Reply with quote

Hi,

I have a input file with 10 record. First character is number ( has 0 to 9). I want to write it into 10 file based on number. ie record with 0 should come in 1st file, 1 should come in 2nd file.....

Exapmle:

Input file
0AAA
1BBB
2CCC

Output file1.
0AAA

Output file2.
1BBB

Output FIle3.
2CCC

Can some one help me out.
Thanks,
Shankar.
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Wed Sep 20, 2006 7:18 am    Post subject: Reply with quote

Frank / Kolusu,

I tried using the code below but somehow i am unable to get it done.I am getting the error:
Code:

            OPTION COPY                                                         
            OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'0'),                               
                   OUTFIL FNAMES=OUT1,OUTREC=(1,5,80:X)),                       
                   $                                                           
ICE006A 0 OPERAND DEFINER ERROR                                                 
                   IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),                               
                   $                                                           


Can we not use OUTFIL FNAMES with IFTHEN ? Please let me know where i am wrong.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
acevedo
Beginner


Joined: 03 Dec 2002
Posts: 127
Topics: 0
Location: Europe

PostPosted: Wed Sep 20, 2006 7:42 am    Post subject: Reply with quote

maybe?

Code:

//*---------------------------------------------------------------------
//P01      EXEC PGM=ICEMAN                                             
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=INPUTFILE,DISP=SHR                                   
//SORTOF01 DD DSN=OUTPUTDSNAME1,DISP=(,CATLG),                         
//            SPACE=(TRK,(10,50),RLSE),AVGREC=K               
//SORTOF02 DD DSN=OUTPUTDSNAME2,DISP=(,CATLG),                         
//            SPACE=(TRK,(10,50),RLSE),AVGREC=K               
//SORTOF03 DD DSN=OUTPUTDSNAME3,DISP=(,CATLG),                         
//            SPACE=(TRK,(10,50),RLSE),AVGREC=K               
...                                                                     
//SYSIN    DD *                                                         
 OPTION COPY                                                           
 OUTFIL FILES=01,INCLUDE=(1,1,CH,EQ,C'0')                               
 OUTFIL FILES=02,INCLUDE=(1,1,CH,EQ,C'1')                               
 OUTFIL FILES=03,INCLUDE=(1,1,CH,EQ,C'2')                               
...                                                                     
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Sep 20, 2006 10:41 am    Post subject: Reply with quote

Shankar,

A DFSORT job like Acevedo showed will do what you want.

Quote:
Can we not use OUTFIL FNAMES with IFTHEN ? Please let me know where i am wrong


INCLUDE is what you want for including records, not IFTHEN. IFTHEN lets you use BUILD or OVERLAY to reformat records for different conditions.

You can use IFTHEN with OUTFIL, but your syntax is not correct. The syntax would be:

Code:

   ...
   OUTFIL FNAMES=OUT1,
      IFTHEN=(WHEN=(...),BUILD=(...)),
      ...
      IFTHEN=(WHEN=(...),BUILD=(...))

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Wed Sep 20, 2006 1:19 pm    Post subject: Reply with quote

Frank,

What would be the solution if i were to use code below with OUTFIL and IFTHEN routing to 10 different files or is it that we can get the solution only using ICEMAN as posted below ? Can you help me out ?
Code:

OUTFIL FNAMES=OUT1,
      IFTHEN=(WHEN=(...),BUILD=(...)),
      ...
      IFTHEN=(WHEN=(...),BUILD=(...))

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Sep 20, 2006 3:08 pm    Post subject: Reply with quote

OUTFIL INCLUDE routes the records to a file. OUTFIL IFTHEN only reformats records - it does not route them. You want to use INCLUDE for what you're doing, not IFTHEN. Why do you keep asking about IFTHEN when it has nothing to do with what you're trying to do?

Quote:
or is it that we can get the solution only using ICEMAN as posted below


I don't know what you mean by this.

Quote:
Can you help me out ?


Help you out with what? OUTFIL INCLUDE is the solution to what you asked for. What is it you need more help with?
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu Sep 21, 2006 1:52 am    Post subject: Reply with quote

Sorry Frank,

Now i am clear with the solution and the concepts of using IFTHEN and INCLUDE.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group