Page 1 of 1

DFSORT/Next Record

PostPosted: Tue Oct 19, 2010 5:32 am
by KarenM
Z/OS DFSORT V1R10 Record Type F

Hi

Is there a way to use DFSORT to take an action on the next record based on the value of the current record?

INPUT IS FB LRECL 80

AAAAAAAAAAAA,

BBBBBBBBBBBB,

CCCCCCCCCCCC,

DDDDDDDDDDDD,

EEEEEEEEEEEE,

FFFFFFFFFFFF,

GGGGGGGGGGGG,

HHHHHHHHHHHH,



Expected output is FB LRECL 80

When i/p record = EEEEEEEEEEE make the next record spaces 1 - 12



AAAAAAAAAAAA,

BBBBBBBBBBBB,

CCCCCCCCCCCC,

DDDDDDDDDDDD,

EEEEEEEEEEEE,

,

GGGGGGGGGGGG,

HHHHHHHHHHHH,



Thanks for your help

Re: DFSORT/Next Record

PostPosted: Tue Oct 19, 2010 8:17 am
by dick scherrer
Hello and welcome to the forum,

I don't have dfsort available so this i've not tested this.

You want something like:
 SORT FIELDS=COPY 
 OUTFIL IFTHEN=(WHEN=(1,12,CH,EQ,C'EEEEEEEEEEEE'),
               BUILD=(1,80,/,',',79X)),
       IFTHEN=(WHEN=NONE,
               BUILD=(1,80))


Hopefully, i've provided no typos. . . :)

Re: DFSORT/Next Record

PostPosted: Tue Oct 19, 2010 8:55 am
by KarenM
Thank you for the welcome and I appreciate your help. I will be trying this out first thing in the morning. :)

Re: DFSORT/Next Record

PostPosted: Tue Oct 19, 2010 9:22 am
by dick scherrer
You're welcome - good luck :)

d

Re: DFSORT/Next Record

PostPosted: Tue Oct 19, 2010 9:17 pm
by KarenM
This did work for me. Thank you.
Is there a way to skip or omit the next record after it processes this statement?
OUTFIL IFTHEN=(WHEN=(1,12,CH,EQ,C'EEEEEEEEEEEE'),
BUILD=(1,80,/,C',',79X)),
TIA! K

Re: DFSORT/Next Record

PostPosted: Tue Oct 19, 2010 9:42 pm
by skolusu
karenM,

The following DFSORT/ICETOOL JCL will give you the desired results.

//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG   DD SYSOUT=*                                     
//IN       DD *                                           
AAAAAAAAAAAA,                                             
BBBBBBBBBBBB,                                             
CCCCCCCCCCCC,                                             
DDDDDDDDDDDD,                                             
EEEEEEEEEEEE,                                             
FFFFFFFFFFFF,                                             
GGGGGGGGGGGG,                                             
HHHHHHHHHHHH,                                             
//OUT      DD SYSOUT=*                                     
//TOOLIN   DD *                                           
  SELECT FROM(IN) TO(OUT) ON(81,8,CH) FIRST USING(CTL1)   
//CTL1CNTL DD *                                           
  SORT FIELDS=COPY                                         
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),       
  IFTHEN=(WHEN=(1,12,CH,EQ,C'EEEEEEEEEEEE'),               
  OVERLAY=(81:81,8,ZD,ADD,+1,M11,LENGTH=8))               
  OUTFIL FNAMES=OUT,BUILD=(1,80)                           
//*

Re: DFSORT/Next Record

PostPosted: Wed Oct 20, 2010 12:01 am
by KarenM
Thank you
I ran your step first and the step provided by Dick Scherrer step 2nd and got what I needed. :)