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
 

 

Need to split a file into 5 files

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

New User


Joined: 08 Jul 2010
Posts: 12
Location: Coimbatore

PostPosted: Sat Feb 26, 2011 11:01 am    Post subject: Need to split a file into 5 files
Reply with quote

Hi,

I am new to this forum. I have a requirement where in I will have to split one file into five files with trailer in it. My input file will have 5 sets of Detail and trailer records and need to be split into 5 files with each set of detail and trailer in each file

INPUT:
D
D
D
D
T
D
D
T
D
T
D
T
D
D
T

OUTPUT Expected:

OUTPUT1:
D
D
D
D
T
OUTPUT2:
D
D
T
OUTPUT3:
D
T
OUTPUT4:
D
T
OUTPUT5:
D
D
T

This is really an urgent requirement. Any help on this would really be appreciated.

Thanks,
Mani.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Feb 26, 2011 11:46 am    Post subject:
Reply with quote

Hello and welcome to the forum,

Quote:
This is really an urgent requirement.
Sorry, we don't do urgent. . . However, if this is truly urgent, this would take less than an hour of coding. . .

Very similar topics have been posted and have solutions posted. Suggest you become familiar with the forum SEARCH (above in the blue line/bar).

Which sort product is used on your system?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Mar 01, 2011 12:19 am    Post subject:
Reply with quote

Mani,

You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//OUT1 DD DSN=...  outnput file1 (FB/80)
//OUT2 DD DSN=...  outnput file2 (FB/80)
//OUT3 DD DSN=...  outnput file3 (FB/80)
//OUT4 DD DSN=...  outnput file4 (FB/80)
//OUT5 DD DSN=...  outnput file5 (FB/80)
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,END=(1,1,CH,EQ,C'T'),PUSH=(81:ID=1))
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,ZD,EQ,1),BUILD=(1,80)
  OUTFIL FNAMES=OUT2,INCLUDE=(81,1,ZD,EQ,2),BUILD=(1,80)
  OUTFIL FNAMES=OUT3,INCLUDE=(81,1,ZD,EQ,3),BUILD=(1,80)
  OUTFIL FNAMES=OUT4,INCLUDE=(81,1,ZD,EQ,4),BUILD=(1,80)
  OUTFIL FNAMES=OUT5,INCLUDE=(81,1,ZD,EQ,5),BUILD=(1,80)
/*
Back to top
View user's profile Send private message
kmk2mani

New User


Joined: 08 Jul 2010
Posts: 12
Location: Coimbatore

PostPosted: Thu Mar 03, 2011 3:41 pm    Post subject:
Reply with quote

Thank you Frank! The above code is writing only the trailer record in the output file. I need the outfile with Detail as well as trailer record. Could you help?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Thu Mar 03, 2011 5:04 pm    Post subject: Reply to: Need to split a file into 5 files
Reply with quote

Frank snippet behaves as requested!
what did You change ?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Mar 03, 2011 5:08 pm    Post subject:
Reply with quote

Probably best that you post the sysout from the run to let us see exactly what has happened with the run.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Mar 03, 2011 11:20 pm    Post subject:
Reply with quote

Mani,

My job does what you asked for based on the input you showed and the expected output you showed. If you're not getting the details records, then your input is either different than what you said it was, or you changed my job in some way.

Your input example shows D records followed by a T record for each group where D and T are in position 1. Is that what it really looks like?
If not, show a better example.

You would have to show me YOUR actual job and JES messages for the run before I could try to figure out what you did wrong.

Quote:
This is really an urgent requirement.


And yet, you didn't bother to show any useful information when you said it didn't work for you.
Back to top
View user's profile Send private message
kmk2mani

New User


Joined: 08 Jul 2010
Posts: 12
Location: Coimbatore

PostPosted: Mon Mar 07, 2011 9:34 pm    Post subject:
Reply with quote

Frank,

Sorry that was my bad. there was a small change in my JCL compared to yours but when I was trying just with your JCL it worked.

Thanks a ton for your efforts! icon_smile.gif
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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