View previous topic :: View next topic
|
Author |
Message |
murali922
New User
Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
I have a file like below :_
Code: |
I - EN123456
I - EN789101
D - EN12345678912
D - EN1436578 |
All records starting with "I" should be written into O/P file A. Like below :-
Code: |
I - EN123456
I - EN789101 |
All records starting with "D" should be written into O/P file B like below :-
Code: |
D - EN12345678912
D - EN1436578 |
|
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi There,
You can use sort for this
Code: |
...
//SORTOFA DD DSN=... output file1
//SORTOFD DD DSN=... output file2
//SYSIN DD *
OPTION COPY
OUTFIL FILES=A,INCLUDE=(1,1,CH,EQ,C'I')
OUTFIL FILES=B,INCLUDE=(1,1,CH,EQ,C'D')
|
Hope it will helpful |
|
Back to top |
|
|
murali922
New User
Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
do i put the above in sysin ? where do i code the above ? |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Murli,
Yes u have to put them in sysin
Code: |
//STEP001 EXEC PGM=SORT
//SYSIN DD *
OPTION COPY
OUTFIL FILES=A,INCLUDE=(1,1,CH,EQ,C'I')
OUTFIL FILES=B,INCLUDE=(1,1,CH,EQ,C'D')
/*
//SORTIN DD DSN=TBH2.XOI.FORMAT.DATA,DISP=SHR
//SORTOFA DD output filea
//SORTOFB DD output fileb
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=* |
Hope it is clear now |
|
Back to top |
|
|
murali922
New User
Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
PV9793a.keep is the input file. Its contents are :-
ID SOURCE LINES
Code: |
I - BP/MR10FYI/0806MR10FYI2006080B
I - BP/MR10FYI/0806MR10FYI2006080C
D - BP/MR10FYI/0806MR10FYI2006080A |
Code: |
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=PV9793A.KEEP,DISP=(MOD,KEEP)
//SORTOFA DD DSN=PV9793A.OUTPUT.FILEA,
// DISP=SHR
//SORTOFB DD DSN=PV9793A.OUTPUT.FILEB,
// DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL FILES=A,INCLUDE=(1,1,CH,EQ,C'I')
OUTFIL FILES=B,INCLUDE=(1,1,CH,EQ,C'D')
//*SORT FIELDS=(1,2,CH,A)
//* INCLUDE COND=(6,2,CH,EQ,C'EN')
//*OUTREC FIELDS=(6,75)
/*
// |
|
|
Back to top |
|
|
murali922
New User
Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
the above does not give me any o/p even if there needs to be something in the o/p file. |
|
Back to top |
|
|
murali922
New User
Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
though everything is correct, there is nothing in the o/p files. This means the sort due to some reason is not picking up the records needed.
Request some one to help.... |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi murali922,
R u sure that i/p file is fixed length file what is the DCB of i/p file? |
|
Back to top |
|
|
murali922
New User
Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
hi,
there was a problem with the position i gave... it works fine now !
thanks.... |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
murali922 wrote: |
there was a problem with the position i gave... it works fine now ! |
was it "INCLUDE=(2,1,"? |
|
Back to top |
|
|
murali922
New User
Joined: 25 Jul 2005 Posts: 92 Location: India
|
|
|
|
yes. it was 2,1 |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Dang I'm good...... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Murali,
Since you're doing a COPY you don't need the SORTWKdd DD statements - they just waste space unless you're doing a SORT and even then it's better not to specify the SORTWKdd DD statements so sort can dynamically allocate the work data sets.
You also don't need the OUTREC=(1,80) operands unless you want to reformat the records.
I've cleaned up all the jobs above. |
|
Back to top |
|
|
|