Removing header & trailing records without sorting



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

Removing header & trailing records without sorting

Postby MitchellSTL » Thu Mar 22, 2012 6:18 am

I want to perform the following but I'm just not getting it correctly:

1. Reformat VB (LR=165) to FB (LR=161)
2. Delete the first 8 records
3. Delete the last 3 records
4. Do not sort the data in between
5. Position 5 of the input file is empty (I used SORT FIELDS=(5,1,CH,A) -- a pseudo sort, if you will)

I can get the DATASORT to work.. but I can't seem to get the VTOF to work in the same step. There should be a way to do it all in one step.. =(

Maybe it's just too late in the evening to be working on this... =)

TIA!
MitchellSTL
 
Posts: 27
Joined: Wed Feb 16, 2011 8:57 am
Has thanked: 1 time
Been thanked: 0 time

Re: Removing header & trailing records without sorting

Postby BillyBoyo » Thu Mar 22, 2012 6:38 am

Can you show the cards you have?

Are you saying you are sorting on one byte which contains a blank on each record just to get the processing done? Try "OPTION COPY" or "SORT FIELDS=COPY" if so, which will read the input DD from start to finish but not do any sorting.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Removing header & trailing records without sorting

Postby MitchellSTL » Thu Mar 22, 2012 6:49 pm

Yes that's what I'm saying...

This one had a RC=0 - yes I know it has two outputs, but I was grasping at straws last night and that it's wrong on soooo many levels... =)
//SORTOUT   DD SYSOUT=*                                         
//REFORMAT  DD SYSOUT=*                                         
//TOOLIN   DD *                                                 
  DATASORT FROM(FILEIN) TO(SORTOUT) FIRST(8) LAST(3) USING(CTL1)
/*                                                               
//CTL1CNTL  DD *                                                 
  OPTION VLSCMP                                                 
  SORT FIELDS=(5,1,CH,A)                                         
  OUTFIL FNAMES=REFORMAT,VTOF,                                   
     BUILD=(5,161)                                               
/*                                                               


But when I put SORT FIELDS=COPY or OPTION COPY, it fails with a RC=12

//SORTOUT   DD SYSOUT=*                                           
//REFORMAT  DD SYSOUT=*                                                         
//TOOLIN   DD *                                                   
  DATASORT FROM(FILEIN) TO(SORTOUT) FIRST(8) LAST(3) USING(CTL1) 
/*                                                               
//CTL1CNTL  DD *                                                 
  SORT FIELDS=COPY                                               
  OUTFIL FNAMES=REFORMAT,VTOF,                                   
     BUILD=(5,161)                                               
/*                                                               
MitchellSTL
 
Posts: 27
Joined: Wed Feb 16, 2011 8:57 am
Has thanked: 1 time
Been thanked: 0 time

Re: Removing header & trailing records without sorting

Postby BillyBoyo » Thu Mar 22, 2012 7:45 pm

I think SUBSET might be a good one for you instead of the DATASORT. You don't want to sort, so DATASORT is not the best choice.

I've tested this with 80-byte records, converting them to variable in a SORT step.

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=&&OUT,DISP=(OLD,PASS)
//OUT1 DD SYSOUT=*
//TOOLIN DD *
 SUBSET FROM(IN1) TO(OUT1) INPUT REMOVE FIRST(8) LAST(3) USING(CTL1)
                                                                     
//CTL1CNTL DD *
  OPTION COPY
  OUTFIL VTOF,OUTREC=(5,80)


With this input:

88888888
88888888
88888888
88888888
88888888
88888888
88888888
88888888
11111111
SOME
OTHER
STUFF
PRETENDING
TO
BE
TEST
DATA
33333333
33333333
33333333


I get this output:

11111111 
SOME     
OTHER     
STUFF     
PRETENDING
TO       
BE       
TEST     
DATA     


This is an extract from the output messages:

ICE210I 0 OUT1     : BSAM USED, LRECL = 80, BLKSIZE = 80, TYPE = FB     
ICE055I 0 INSERT 0, DELETE 8                                             
ICE054I 0 RECORDS - IN: 17, OUT: 9                                       
ICE227I 0 OUT1     : DELETED = 0, REPORT = 0, DATA = 9                   
ICE228I 0 OUT1     : TOTAL IN = 9, TOTAL OUT = 9                         
ICE052I 0 END OF DFSORT                                                 
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Removing header & trailing records without sorting

Postby MitchellSTL » Thu Mar 22, 2012 8:15 pm

Thank you!! Worked great! Never seen the SUBSET used before (even scanned our library of JCL and it's never been used at our shop - then again, neither has DATASORT). Thank you again!
MitchellSTL
 
Posts: 27
Joined: Wed Feb 16, 2011 8:57 am
Has thanked: 1 time
Been thanked: 0 time

Re: Removing header & trailing records without sorting

Postby BillyBoyo » Thu Mar 22, 2012 8:21 pm

No problem. Thanks for letting us know.

I'd not noticed it either, before today. I got it from the Smart DFSORT Tricks paper, well-worth getting a hold of and looking at the Table of Contents so you know the kind of stuff that is inside. Always my first port-of-call for "tricky" sort questions :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Removing header & trailing records without sorting

Postby Frank Yaeger » Thu Mar 22, 2012 11:34 pm

But when I put SORT FIELDS=COPY or OPTION COPY, it fails with a RC=12


That's because DATASORT requires a real SORT statement.

BB is correct that SUBSET is the appropriate DFSORT/ICETOOL operator for what you want to do.

If you're not familiar with all of the available DFSORT and DFSORT/ICETOOL functions, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post