Two different record length files

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
bhaskar.naidu
Member
Posts: 16
Joined: Mon Jul 06, 2009 5:25 pm

Two different record length files

Post by bhaskar.naidu » Wed Feb 24, 2010 11:12 pm

Hi,
I have a requirement where in a single GDG, I have two versions which is of different record lengths and I need to sort this GDG bases and need to write to an output file with the minimum record length format.

For ex: I have a GDG and it has two versions in it.
The first version has a record length of 100 and the second version has a record length of 120. So, I need to sort these two versions and write to the output file with a record length of 100 where I should extract only 100 bytes of the second version.

I have to do this in a single step of SORT.

Could you please let me know how to do this in SORT.

Thanks,
Bhaskar

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Wed Feb 24, 2010 11:53 pm

Are these files Fixed Block (FB) or Variable Block (VB)?

bhaskar.naidu
Member
Posts: 16
Joined: Mon Jul 06, 2009 5:25 pm

Post by bhaskar.naidu » Thu Feb 25, 2010 12:03 am

Both the versions are of Fixed Block.

skolusu
Member
Posts: 43
Joined: Sat Jul 26, 2008 12:38 am

Post by skolusu » Thu Feb 25, 2010 10:55 pm

bhaskar.naidu wrote:I have to do this in a single step of SORT.
I don't understand the fascination for doing everything in a single step which in this case can turn out to be quite inefficient. Even though it is a single step , it would actually require 3 passes of data to get the desired results. But using 2 steps it would be just 2 passes of data and this is much more efficient.

Here are the different approaches

Code: Select all

//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                            
//DFSMSG   DD SYSOUT=*                                            
//FB120    DD DSN=Your input FB120 file,DISP=SHR
//FB100    DD DSN=Your input FB100 file,DISP=SHR                   
//TEMPF    DD DSN=&&TEMPF,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)  
//OUT      DD SYSOUT=*                                            
//TOOLIN   DD *                                                   
  COPY FROM(FB120) TO(TEMPF) USING(CTL1)                          
  COPY FROM(FB100) TO(TEMPF)                                      
  SORT FROM(TEMPF) TO(OUT)  USING(CTL2)                           
//CTL1CNTL DD *                                                   
  OUTREC BUILD=(1,100)                                   
//CTL2CNTL DD *                                                   
  SORT FIELDS=(1,10,CH,A)                                         
//*


2 step approach

Code: Select all

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=&&FB120,DISP=SHR                             
//SORTOUT  DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)     
//SYSIN    DD *                                                
  SORT FIELDS=COPY                                             
  INREC BUILD=(1,100)                                          
//*                                                            
//STEP0200 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=&&FB100,DISP=SHR                             
//         DD DSN=&&T1,DISP=SHR                                
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                
  SORT FIELDS=(1,10,CH,A),EQUALS                               
//* 
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

bhaskar.naidu
Member
Posts: 16
Joined: Mon Jul 06, 2009 5:25 pm

Post by bhaskar.naidu » Fri Feb 26, 2010 12:07 am

Thanks a lot for your help.
This works for me.

Regards,
Bhaskar

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Sat Feb 27, 2010 1:29 am

skolusu wrote:I don't understand the fascination for doing everything in a single step which in this case can turn out to be quite inefficient.
Because they just don't understand the meaning of "how many passes of data are required" - for them, less number of lines in JCL, less the resources!
Regards,
Anuj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others