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

sort issue - please help


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jammy_27

New User


Joined: 06 Aug 2009
Posts: 17
Location: USA

PostPosted: Thu Oct 01, 2009 12:25 pm
Reply with quote

Hi

I got a PS file with the following records

Every third record will act as an identifier
Example
DCAD010 EDIAPFS00100
DCAD010 NONEDIAPFS007
DCAD 101 021000021900510223509081911480094101BRENDAN SHAH
DCAD010 EDIAPFS00100
DCAD010 NONEDIAPFS007
DCAD 101 021000021900510223509081911480094101BRENDAN SHAH RETAIL
DCAD010 EDIAPFS00100
DCAD010 NONEDIAPFS007
DCAD 101 021000021900510223509081911480094101BRENDAN SHAH, N.A.

Now, i need to split the file into three different files depending on the 3rd record
i.e -
DCAD 101 021000021900510223509081911480094101BRENDAN SHAH
DCAD 101 021000021900510223509081911480094101BRENDAN SHAH RETAIL
DCAD 101 021000021900510223509081911480094101BRENDAN SHAH, N.A.

i wanted to avoid writing a cobol program for the same.
Please let me know if this can be done via File manager/DFSORT etc
(also, the original file can have the single indetifier or the combination of two or all three(as mentioned above) and then we need to split accordingly)

TIA
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Oct 01, 2009 12:34 pm
Reply with quote

Will there be maximum three identifiers present in your input dataset?

What is LRECL and RECFM of input dataset?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Oct 01, 2009 12:41 pm
Reply with quote

Please explain clearly the rules for splitting a file, such as which records go where.

It looks as though when an "identifier" is encountered the records before and including this record should be grouped together. That is my guess, but a guess is not good enough really.

What are the RECFM and LRECL of the file. What are the positions, lengths and formats of the split control fields.
Back to top
View user's profile Send private message
jammy_27

New User


Joined: 06 Aug 2009
Posts: 17
Location: USA

PostPosted: Thu Oct 01, 2009 1:27 pm
Reply with quote

I am not concerned about the records preceeding and succeeding.The records which contain Brendan must be split into different files.
Example -

BRENDAN SHAH - should go to file 1
BRENDAN SHAH RETAIL - should go to file 2
BRENDAN SHAH,N.A - should go to file 3

The input file can contain various combinations of the identifiersBRENDAN SHAH, BRENDAN SHAH RETAIL and BRENDAN SHAH,N.A.

RECL = 600
RECFM = FB
start position of BRENDAN SHAH is 58

Please let me know if you need further details
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Oct 01, 2009 2:32 pm
Reply with quote

Hi Jammy, Use below to get desired result.

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//SORTIN   DD DSN=your input dataset                                             
//OUT1 DD  DSN=your output dataset1                                             
//OUT2 DD  DSN=your output dataset2                                             
//OUT3 DD  DSN=your output dataset3                                             
//SYSIN DD *                                                     
  SORT FIELDS=COPY                                               
  OUTFIL INCLUDE=(58,19,CH,EQ,C'BRENDAN SHAH       '),FNAMES=OUT1
  OUTFIL INCLUDE=(58,19,CH,EQ,C'BRENDAN SHAH RETAIL'),FNAMES=OUT2
  OUTFIL INCLUDE=(58,19,CH,EQ,C'BRENDAN SHAH, N.A. '),FNAMES=OUT3
/*                                                               


Dheeraj,
SS is not required here as we know the starting position of string
Back to top
View user's profile Send private message
jammy_27

New User


Joined: 06 Aug 2009
Posts: 17
Location: USA

PostPosted: Thu Oct 01, 2009 3:03 pm
Reply with quote

thanks Sambhaji.
i should have thought of the blanks to identify the first split icon_smile.gif
I will try and update you guys acordingly

many thanks
jammy
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Oct 01, 2009 3:42 pm
Reply with quote

jammy wrote:
thanks Sambhaji.

You are welcome.

jammy wrote:
I thought of this but honestly havent tried.


That is something honestly you should do first and post when you encounter any issue with it..
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 Oct 01, 2009 9:51 pm
Reply with quote

Jammy,

Based on your statement that

Quote:
Now, i need to split the file into three different files depending on the 3rd record


here's a more "generic" DFSORT solution:

Code:

  OPTION COPY                                       
  OUTFIL FNAMES=OUT1,STARTREC=3,ENDREC=3           
  OUTFIL FNAMES=OUT2,STARTREC=6,ENDREC=6           
  OUTFIL FNAMES=OUT3,STARTREC=9,ENDREC=9           
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top