Page 1 of 1

DFSORT on variable length file

PostPosted: Tue Apr 01, 2008 9:40 am
by nobin
Hi,

I have variable length file where the length can vary between 50 to 20050 bytes. The file structure is as shown below,

Fixed data of 50 bytes length.
Array of 50 bytes which occurs from 0 to 400 times with a depending on clause. Offsets 49 and 50 of the file (last 2 bytes of fixed data) contains the value of array occurance.

Our requirement is to write all the records having a value of '01' in the first two bytes in any occurance of array into an output file.
For eg:
if first record in file have '01' in 51 & 52 offset (ie first two fields of first occurance of array), that record should be written to output file.
if second record is having '01' in 101 & 102 offset (ie first two fields of second occurance of array), that record should also be written to output file.
Similary if '01' is present in first two bytes of any other occurance of array, those records should be written into output file.

Please guide us in writting the sort card for above requirement where variable length file needs to be handled.

Thanks in advance.


Regards
Nobin

Re: DFSORT on variable length file

PostPosted: Tue Apr 01, 2008 8:44 pm
by CICS Guy

Re: DFSORT on variable length file

PostPosted: Tue Apr 01, 2008 8:55 pm
by Frank Yaeger
Nobin,

CICS guy is right. You will need VLSCMP and 400 INCLUDE conditions to do this. I could show you a way to "generate" the INCLUDE conditions so you don't have to code them by hand. But first I need to know the following:

Fixed data of 50 bytes length


Does this fixed data include the RDW in positions 1-4, or does it really start in position 5 after the RDW?

Re: DFSORT on variable length file

PostPosted: Wed Apr 02, 2008 8:59 am
by nobin
Hi Frank,

The 50 bytes of fixed data is without including the RDW in positions 1-4. The data really starts from offset 5 after RDW.

Thanks
Nobin

Re: DFSORT on variable length file

PostPosted: Wed Apr 02, 2008 10:23 pm
by Frank Yaeger
Here's a DFSORT/ICETOOL job that will do what you asked for:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//ONE DD *
RECORD
/*
//C1 DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//TOOLIN   DD    *
COPY FROM(ONE) USING(CTL1)
COPY FROM(IN) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=C1,REPEAT=400,
    BUILD=(2X,SEQNUM,5,ZD,START=55,INCR=50,
      C',2,EQ,C''01'',OR,',80:X)
/*
//CTL2CNTL DD *
  OPTION COPY,VLSCMP
  INCLUDE FORMAT=CH,
    COND=(1,1,NE,1,1,OR,
/*
//    DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS)
// DD *
       1,1,NE,1,1)
/*