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

Need to split a file into 5 files


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

New User


Joined: 08 Jul 2010
Posts: 12
Location: United Kingdom

PostPosted: Sat Feb 26, 2011 11:01 am
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

Moderator Emeritus


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

PostPosted: Sat Feb 26, 2011 11:46 am
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 Developer


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

PostPosted: Tue Mar 01, 2011 12:19 am
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: United Kingdom

PostPosted: Thu Mar 03, 2011 3:41 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Mar 03, 2011 5:04 pm
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: 8797
Location: Welsh Wales

PostPosted: Thu Mar 03, 2011 5:08 pm
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 Developer


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

PostPosted: Thu Mar 03, 2011 11:20 pm
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: United Kingdom

PostPosted: Mon Mar 07, 2011 9:34 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top