MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Split one Record into 2 Records using sort in one step

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
gharidoss
Beginner


Joined: 14 Mar 2005
Posts: 38
Topics: 15
Location: Bangalore

PostPosted: Thu Nov 17, 2005 2:09 am    Post subject: Split one Record into 2 Records using sort in one step Reply with quote

Hi All,

I have the name file. It contains Party1 names and Party2 names. I want to extract Party1 and Party2 names and write into two records.

Example
Record1: Other fields-Party1 Names -otherfields-Party2 Names
Record2: Other fields-Party1 Names -otherfields-Party2 Names

Desired Output
Party1 Name from first record
Party2 Name from first record
Party1 Name from second record
Party2 Name from second record

I got this by using following code
Code:

//DELFILE1 EXEC PGM=IDCAMS                               
//SYSPRINT DD  SYSOUT=*                                 
//SYSIN    DD  *                                         
  DELETE PARTY1.NAME                 
  DELETE PARTY2.NAME                 
  SET MAXCC=0                                           
/*                                                       
//*******************************************************
//STEP0001 EXEC PGM=SORT,PARM='HIPRMAX=OPTIMAL'         
//SORTWK01 DD UNIT=TSRT,SPACE=(CYL,(200,200))           
//SORTWK02 DD UNIT=TSRT,SPACE=(CYL,(200,200))           
//SORTWK03 DD UNIT=TSRT,SPACE=(CYL,(200,200))           
//SORTWK04 DD UNIT=TSRT,SPACE=(CYL,(200,200))           
//SORTWK05 DD UNIT=TSRT,SPACE=(CYL,(200,200))           
//SORTWK06 DD UNIT=TSRT,SPACE=(CYL,(200,200))           
//SORTWK07 DD UNIT=TSRT,SPACE=(CYL,(200,200))           
//SORTWK08 DD UNIT=TSRT,SPACE=(CYL,(200,200))           
//SORTIN   DD DISP=SHR,DSN=INPUT FILE
//SORTOUT1 DD DSN=PARTY1.NAME,       
//             DISP=(NEW,CATLG,DELETE),                     
//             UNIT=(TARC,15),                               
//             SPACE=(CYL,(1,5),RLSE),                       
//             DCB=(RECFM=FB,LRECL=105)                     
//SORTOUT2 DD DSN=PARTY2.NAME,           
//             DISP=(NEW,CATLG,DELETE),                     
//             UNIT=(TARC,15),                               
//             SPACE=(CYL,(1,5),RLSE),                       
//             DCB=(RECFM=FB,LRECL=105)                     
//SYSOUT   DD SYSOUT=*                                       
//SYSIN    DD *                                             
 SORT FIELDS=COPY                                           
 OUTFIL FNAMES=SORTOUT1,OUTREC=(EXTRACT PARTY1 NAMES ONLY)
 OUTFIL FNAMES=SORTOUT2,OUTREC=(EXTRACT PARTY2 NAMES ONLY) 
/*                                                           
//**********************************************
//DELFILE2 EXEC PGM=IDCAMS                   
//SYSPRINT DD  SYSOUT=*                     
//SYSIN    DD  *                             
  DELETE ALL PARTY NAMES
  SET MAXCC=0                                               
/*                                                         
//**********************************************************
//STEP0002 EXEC PGM=SORT,PARM='HIPRMAX=OPTIMAL'             
//SORTWK01 DD UNIT=TSRT,SPACE=(CYL,(200,200))               
//SORTWK02 DD UNIT=TSRT,SPACE=(CYL,(200,200))               
//SORTWK03 DD UNIT=TSRT,SPACE=(CYL,(200,200))               
//SORTWK04 DD UNIT=TSRT,SPACE=(CYL,(200,200))               
//SORTWK05 DD UNIT=TSRT,SPACE=(CYL,(200,200))               
//SORTWK06 DD UNIT=TSRT,SPACE=(CYL,(200,200))               
//SORTWK07 DD UNIT=TSRT,SPACE=(CYL,(200,200))               
//SORTWK08 DD UNIT=TSRT,SPACE=(CYL,(200,200))               
//SORTIN   DD DISP=SHR,DSN=PARTY1.NAME
//         DD DISP=SHR,DSN=PARTY2.NAME
//SORTOUT  DD DSN=ALL PARTY NAMES,         
//             DISP=(NEW,CATLG,DELETE),                     
//             UNIT=(TARC,15),                             
//             SPACE=(CYL,(1,5),RLSE),                     
//             DCB=(RECFM=FB,LRECL=105)                               
//SYSOUT   DD SYSOUT=*                                               
//SYSIN    DD *                                                       
 SORT FIELDS=COPY
 INCLUDE COND=(1,1,CH,NE,C' ')
/*                                                                   
//***********************************************************



It's possible to acheive this output in single sort step? Because in the second sort step, I used include condition

Any ideas would be greatly appreciated...

Thanks,
Hari
Back to top
View user's profile Send private message Send e-mail MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Thu Nov 17, 2005 5:37 am    Post subject: Reply with quote

gharidoss,

try this

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
IBM       FRANK YAEGER
MVSFORUMS KOLUSU
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT FIELDS=COPY
  OUTFIL OUTREC=(01,10,/,
                 11,10)
/*   


this will create a 10 byte file as follows
Code:

IBM
FRANK YAE
MVSFORUMS
KOLUSU


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu


Last edited by kolusu on Thu Nov 17, 2005 7:49 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gharidoss
Beginner


Joined: 14 Mar 2005
Posts: 38
Topics: 15
Location: Bangalore

PostPosted: Mon Nov 21, 2005 12:32 am    Post subject: Reply with quote

Hi Kolusu,

Sorry for the late reply, I tested, it's working fine and thanks a lot.

Thanks,
Hari
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group