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

SPLIT PS file into multiple output files based on month


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

New User


Joined: 24 Aug 2007
Posts: 4
Location: bangalore

PostPosted: Fri Aug 24, 2007 9:43 am
Reply with quote

Please let me know how to split a file using SORT into Multiple files based on key field.

In this case the key field is Month. For ex
01 XXX
02 YYY
03 ZZZ
04 AAA

This has to split into 4 files. The next month the key fields change to
02 XXX
03 YYY
04 ZZZ
05 AAA

So the Key field values are dynamic but it would contain only 4 values
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Aug 24, 2007 10:26 am
Reply with quote

ranganathan,

Your requirement is not clear. Provide more info with examples.
Back to top
View user's profile Send private message
ranganathanv

New User


Joined: 24 Aug 2007
Posts: 4
Location: bangalore

PostPosted: Fri Aug 24, 2007 10:32 am
Reply with quote

THE PARENT FILE CONTAINS FOLLOWING RECORDS FOR THIS MONTH

06 XXX
07 YYY
08 NNN
09 MMM

WHERE 06, 07 , 08, 09 ARE THE KEYS
OUTPUT FILES SHOULD CONTAIN

FILE 1:
06 XXX
FILE 2
07 YYY
FILE 3:
08 NNN
FILE 4:
08 MMM

THE NEXT MONTH DATE IN PARENT FILE CHANGES TO

07 YYY
08 NNN
09 MMM
10 PPP

OUTPUT FILES SHOULD CONTAIN

FILE 1:
07 YYY
FILE 2
08 NNN
FILE 3:
09 MMM
FILE 4:
10 PPP
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Aug 24, 2007 11:19 am
Reply with quote

ranganathan,

Does your IP file contain only MONTH part? If not, what is the date format (like ddmmyy/mmddyyyy etc...).

Also post your file attribs.
Back to top
View user's profile Send private message
ranganathanv

New User


Joined: 24 Aug 2007
Posts: 4
Location: bangalore

PostPosted: Fri Aug 24, 2007 11:32 am
Reply with quote

The IP file contains only the Month part. Ex: 06

File attributes

RECFM=FB
LRECL=1768
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: Fri Aug 24, 2007 8:27 pm
Reply with quote

Quote:
Please let me know how to split a file using SORT into Multiple files
... the Key field values are dynamic but it would contain only 4 values


Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (4 records)
//OUT1 DD DSN=...  output file (first record)
//OUT2 DD DSN=...  output file (second record)
//OUT3 DD DSN=...  output file (third record)
//OUT4 DD DSN=...  output file (fourth record)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL FNAMES=(OUT1,OUT2,OUT3,OUT4),SPLIT
/*
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
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 Populate last day of the Month in MMD... SYNCSORT 2
Search our Forums:

Back to Top