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 

forming output file with mutiple steps based on input record

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


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Wed Aug 11, 2010 10:04 am    Post subject: forming output file with mutiple steps based on input record Reply with quote

Hi,

Based on my input file I need to generate an output file containing mutiple steps , if my input files is below , then i want the output as below
Code:

ABC
DEF
PQR
XYZ

Code:

//STEP010  EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=ABC,DISP=SHR
//SORTOUT  DD DSN=YYY,DISP=SHR
//SYSIN    DD *
  SORT FIELDS=COPY
/*
//STEP020  EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=DEF,DISP=SHR
//SORTOUT  DD DSN=YYY,DISP=SHR
//SYSIN    DD *
  SORT FIELDS=COPY
/*
//STEP030  EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=PQR,DISP=SHR
//SORTOUT  DD DSN=YYY,DISP=SHR
//SYSIN    DD *
  SORT FIELDS=COPY
/*
//STEP040  EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=XYZ,DISP=SHR
//SORTOUT  DD DSN=YYY,DISP=SHR
//SYSIN    DD *
  SORT FIELDS=COPY
/*

If my input file is below ,
Code:

ABC
DEF

then output file should be
Code:

//STEP010  EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=ABC,DISP=SHR
//SORTOUT  DD DSN=YYY,DISP=SHR
//SYSIN    DD *
  SORT FIELDS=COPY
/*
//STEP020  EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=DEF,DISP=SHR
//SORTOUT  DD DSN=YYY,DISP=SHR
//SYSIN    DD *
  SORT FIELDS=COPY
/*
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Aug 11, 2010 10:16 am    Post subject: Reply with quote

You either have to give your output files different names (preferred) or DISP=MOD otherwise you will end up with only the output from the last copy. So, which do you want? And if the first, then what naming convention?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Wed Aug 11, 2010 10:26 am    Post subject: Reply with quote

Nic,

I will tailor once the JCL with steps is created and I understand your point the files will be overwritten with the last copy of the data.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Aug 11, 2010 10:29 am    Post subject: Reply with quote

yadav2005 wrote:
I will tailor once the JCL with steps is created and I understand your point the files will be overwritten with the last copy of the data.


yadav2005,

*sigh* Use the following DFSORT JCL.
Code:

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
ABC                                                                 
DEF                                                                 
PQR                                                                 
XYZ                                                                 
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                   
  OUTFIL BUILD=(C'//STEP',SEQNUM,3,ZD,START=10,INCR=10,             
                C'  EXEC PGM=SORT',/,                               
                C'//SYSOUT   DD SYSOUT=*',/,                         
                C'//SORTIN   DD DISP=SHR,DSN=',1,44,/,               
                C'//SORTOUT  DD DSN=YOUR OUTPUT 44 BYTE DSN NAME,',/,
                C'//            DISP=(NEW,CATLG,DELETE),',/,         
                C'//            UNIT=SYSDA,',/,                     
                C'//            SPACE=(CYL,(X,Y),RLSE)',/,           
                C'//SYSIN    DD *',/,                               
                C'  SORT FIELDS=COPY',/,                             
                C'//*',80:X)                                         
//*                                                                 

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Wed Aug 11, 2010 11:03 am    Post subject: Reply with quote

Kolusu,

Thanks for your code it helped me.
Back to top
View user's profile Send private message
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