Posted: Thu Mar 23, 2006 2:35 pm Post subject: DF Sort : Copy file eliminating the spaces and adjust output
Hi,
We have DF Sort/ICETOOl in our system and looking for some help for the following scenario using the DF Sort/ICETOOl.
We have many fixed length, comma separated sequential files.
Some of the fields in the fixed length files are spcaes or partially spaces.
We are looking for your expertise help to remove the sapces from the fields and create a new output file which is of different length after eliminating the sapces from fields.
Below are the exmaples of what we have as inputs and what is expected in the outputs.
All Input files are of Fixed length 23 Bytes. The second and third fields are of different size in each of the input and we do not know the length of this field. But each field is comma separated.
The output files should be as shown below and of different length. The length of output file should be decided dynamically after removing the spaces from 3rd field.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Mar 23, 2006 3:30 pm Post subject:
DFSORT does not have any built-in functions for doing that kind of thing.
But depending on how many variations you have and what they look like, you may be able to use a variation of the "Find and extract values from different positions" Smart DFSORT Trick at:
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Apr 27, 2006 5:11 pm Post subject:
You can now use the new SQZ function available with z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) to do this kind of thing. Squeezing out the blanks is easy with SQZ. The tricky part here is setting the output LRECL to the length of the non-blank characters. Here's the DFSORT/ICETOOL job:
Code:
//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/23)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//S1 DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T2) USING(CTL2)
//CTL1CNTL DD *
* Squeeze out the blanks
INREC BUILD=(1,23,SQZ=(SHIFT=LEFT))
* Copy compressed records to T1
OUTFIL FNAMES=T1
* Convert first record to VB to get RDW length.
OUTFIL FNAMES=T2,FTOV,VLTRIM=C' ',ENDREC=1
//CTL2CNTL DD *
* Create a DFSORT symbol as:
* outrcd,1,n
* where n is rdw length - 4 = output lrecl length
OUTFIL FNAMES=S1,VTOF,BUILD=(C'outrcd,1,',
1,2,BI,SUB,+4,TO=ZD,LENGTH=5,80:X)
/*
//STEP2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
* Copy T1 to SORTOUT. Use the outrcd symbol to set the
* LRECL for SORTOUT.
OPTION COPY
OUTREC BUILD=(outrcd)
/*
For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTFs, see:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum