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
 

 

sort issue - please help

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: sort issue - please help
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Oct 01, 2009 12:41 pm    Post subject:
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    Post subject: information
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    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Oct 01, 2009 9:51 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts JCL sort Match and NoMatch rakeshsekar1987 SYNCSORT 2 Thu Feb 02, 2017 10:26 pm


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