SORT Help



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

SORT Help

Postby SpadoBeans » Fri Feb 11, 2011 1:34 am

Not sure if DFSORT can handle this or not. I have a 100 BYTE flat file that looks like this:

DOC XXXXXX INDEX
INFO
INFO
DOC XXXXXX INDEX
INFO
INFO
DOC ABCDEF INDEX
INFO
INFO
DOC XYZ INDEZ
INFO

I want to output a file that only contains the variable located in between 'DOC' and 'INDEX'. However, that variable can be anywhere from 3-8 bytes in length. What would the SORT CARD look like? I would want to SORT by this variable too so this is what I imagine the output file looking like:

ABCDEF
XXXXXX
XXXXXX
XYZ

Thanks
SpadoBeans
 
Posts: 4
Joined: Fri Feb 11, 2011 1:25 am
Has thanked: 0 time
Been thanked: 0 time

Re: SORT Help

Postby skolusu » Fri Feb 11, 2011 3:01 am

Spadobeans,

The following DFSORT JCL will give you the desired results. I am assuming that INDEZ is a typo for index.

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
DOC XXXXXX INDEX                                               
INFO                                                           
INFO                                                           
DOC XXXXXX INDEX                                               
INFO                                                           
INFO                                                           
DOC ABCDEF INDEX                                               
INFO                                                           
INFO                                                           
DOC XYZ INDEX                                                   
INFO                                                           
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INCLUDE COND=(1,3,CH,EQ,C'DOC')                               
  INREC PARSE=(%01=(STARTAFT=C'DOC',ENDBEFR=C'INDEX',FIXLEN=8)),
  BUILD=(%01,JFY=(SHIFT=LEFT))                                 
/*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: SORT Help

Postby SpadoBeans » Fri Feb 11, 2011 3:19 am

Thanks for the VERY quick response. I'll give this a try.

One more question. I have another file that I'm looking to do something similar to, but the INPUT file is VB and the value that I want to extract is always in column 31 (for 3 bytes). I'd like to copy these 3 bytes to a 80 byte FB output file. Would I use OUTREC FIELDS=(31,3,77X)? I've attempted this but I receive this error:

INVALID DATA SET ATTRIBUTES: SORTOUT RECFM - REASON CODE IS 08
SpadoBeans
 
Posts: 4
Joined: Fri Feb 11, 2011 1:25 am
Has thanked: 0 time
Been thanked: 0 time

Re: SORT Help

Postby skolusu » Fri Feb 11, 2011 3:29 am

One more question. I have another file that I'm looking to do something similar to, but the INPUT file is VB and the value that I want to extract is always in column 31 (for 3 bytes). I'd like to copy these 3 bytes to a 80 byte FB output file. Would I use OUTREC FIELDS=(31,3,77X)? I've attempted this but I receive this error:


You need to use the parm VTOF to convert a VB file to FB file. Assuming that you accounted for the RDW in calculating the position of the field, then use the following control cards
   SORT FIELDS=COPY
   OUTFIL VTOF,BUILD=(31,3,80:X)
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post