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

write records based on the input file


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

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 2:43 pm
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Jan 31, 2007 2:54 pm
Reply with quote

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
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 2:58 pm
Reply with quote

do i put the above in sysin ? where do i code the above ?
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Jan 31, 2007 3:02 pm
Reply with quote

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
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 3:39 pm
Reply with quote

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
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 3:40 pm
Reply with quote

the above does not give me any o/p even if there needs to be something in the o/p file.
Back to top
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 4:08 pm
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Jan 31, 2007 4:28 pm
Reply with quote

Hi murali922,

R u sure that i/p file is fixed length file what is the DCB of i/p file?
Back to top
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 4:38 pm
Reply with quote

hi,

there was a problem with the position i gave... it works fine now ! icon_smile.gif

thanks.... icon_biggrin.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Jan 31, 2007 5:23 pm
Reply with quote

murali922 wrote:
there was a problem with the position i gave... it works fine now ! icon_smile.gif
was it "INCLUDE=(2,1,"?
Back to top
View user's profile Send private message
murali922

New User


Joined: 25 Jul 2005
Posts: 92
Location: India

PostPosted: Wed Jan 31, 2007 8:01 pm
Reply with quote

yes. it was 2,1 icon_biggrin.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Jan 31, 2007 8:10 pm
Reply with quote

Dang I'm good...... icon_biggrin.gif
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: Wed Jan 31, 2007 9:53 pm
Reply with quote

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
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 How to split large record length file... DFSORT/ICETOOL 8
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top