MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
gharidoss Beginner Joined: 14 Mar 2005 Posts: 38 Topics: 15 Location: Bangalore
Posted: Thu Nov 17, 2005 2:09 am Post subject: Split one Record into 2 Records using sort in one step
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Thu Nov 17, 2005 5:37 am Post subject:
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
gharidoss Beginner Joined: 14 Mar 2005 Posts: 38 Topics: 15 Location: Bangalore
Posted: Mon Nov 21, 2005 12:32 am Post subject:
Hi Kolusu,
Sorry for the late reply, I tested, it's working fine and thanks a lot.
Thanks,
Hari
Back to top
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