Page 1 of 1

DFSORT help

PostPosted: Fri Aug 21, 2009 6:00 pm
by pulcinella
First of all sorry if someone has asked this question

I have two files. The first file has a length of 173; the second file has a length of 37. I need obtain two files:

- output1 with the records that exist at input2
- output2 with the records that not exist at input2

input1 (173)
--------------

00000001xxxx001xxxxxxxxxx
00000002xxxx006xxxxxxxxxx
00000002xxxx007xxxxxxxxxx
00000004xxxx001xxxxxxxxxx
00000005xxxx003xxxxxxxxxx
00000007xxxx003xxxxxxxxxx
00000007xxxx009xxxxxxxxxx
00000007xxxx012xxxxxxxxxx
00000008xxxx009xxxxxxxxxx
00000008xxxx013xxxxxxxxxx
00000010xxxx003xxxxxxxxxx
........

input2 (37)
-------------

00000001xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000001xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000001xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000001xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx008
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx009
00000004xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000004xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000004xxxxxxxxxxxxxxxxxxxxxxxxxx004
00000004xxxxxxxxxxxxxxxxxxxxxxxxxx008
00000005xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000005xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000005xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000005xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000006xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000006xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000006xxxxxxxxxxxxxxxxxxxxxxxxxx005
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx002
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx002
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx002
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx004
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx007
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx007
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx007
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx009
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx009
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx009
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx011
00000009xxxxxxxxxxxxxxxxxxxxxxxxxx003
.......


the field with 'x' is not relevant for comparation.

output1 (37) (the same records)
-------------------------------------

00000001xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000001xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000001xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000004xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000005xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000005xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000005xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000005xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx009
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx009
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx009

output2 (137) (distint records)
------------------------------------

00000002xxxx007xxxxxxxxxx (the record not exist at input2)
00000008xxxx013xxxxxxxxxx (the record not exist at input2)


As you see I compare the positions 1-8, 13, 14, 15 of input1 with the positions 1-8, 35, 36, 37 of input2. This is positions
are the keys of both files.

I need compare the first 1-8 position and If it's are the same, compare the other position (13, 14, 15 input1; 35, 36, 37 input2)

Thank you

Re: DFSORT help

PostPosted: Fri Aug 21, 2009 9:56 pm
by skolusu
pulcinella,

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


//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//FB037    DD DSN=Your fb 37 byte file,DISP=SHR
//FB173    DD DSN=your fb 173 byte file,DISP=SHR
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)     
//OUT1     DD SYSOUT=*                                             
//OUT2     DD SYSOUT=*                                             
//TOOLIN   DD *                                                   
  SORT FROM(FB173) USING(CTL1)                                     
  COPY FROM(FB037) USING(CTL2)                                     
  SPLICE FROM(T1) TO(OUT1) ON(174,11,CH) WITH(1,173) WITH(185,1) -
  WITHALL KEEPNODUPS USING(CTL3)                                   
//CTL1CNTL DD *                                                   
  SORT FIELDS=(1,8,CH,A,13,3,CH,A),EQUALS                         
  SUM FIELDS=NONE                                                 
  OUTFIL FNAMES=T1,OVERLAY=(174:1,8,13,3,C'11')                   
//CTL2CNTL DD *                                                   
  OUTFIL FNAMES=T1,OVERLAY=(174:1,8,35,3,C'22')                   
//CTL3CNTL DD *                                                   
  OUTFIL FNAMES=OUT1,INCLUDE=(185,2,ZD,EQ,21),BUILD=(1,37)         
  OUTFIL FNAMES=OUT2,INCLUDE=(185,2,ZD,EQ,11),BUILD=(1,173)       
/*

Re: DFSORT help

PostPosted: Mon Aug 24, 2009 6:01 pm
by pulcinella
Great. Thank you for your help.

Could you help with another problem involving the above example?

I have other file with 16 positions and I need matching with the output file (OUT1) generated in the previous example (37 positions) for obtain two files:

output 1 a file that the key are the same
output 2 a file that the key are not the same


Input1 (15)
-----------

00000002xxxx006
00000002xxxx008
00000003xxxx001
00000004xxxx003
00000004xxxx008
00000008xxxx002
00000008xxxx003

Input2 (37) output file of previus example
-----------

00000001xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000001xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000001xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000001xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx008
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx009
00000004xxxxxxxxxxxxxxxxxxxxxxxxxx001
00000004xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000004xxxxxxxxxxxxxxxxxxxxxxxxxx004
00000004xxxxxxxxxxxxxxxxxxxxxxxxxx008
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx002
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx002
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx002
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx004
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx007
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx007
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx007
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx009
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx009
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx009
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx011

(the field with 'x' is not relevant for comparation. )

output1 (37) the same
------------

00000002xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx006
00000002xxxxxxxxxxxxxxxxxxxxxxxxxx008
00000004xxxxxxxxxxxxxxxxxxxxxxxxxx003
00000004xxxxxxxxxxxxxxxxxxxxxxxxxx008
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx002
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx002
00000008xxxxxxxxxxxxxxxxxxxxxxxxxx002

output2 (15) not the same
-------------

00000003xxxx001
00000008xxxx003

I modified the previous example this way:

//STEP0xxx EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*

//FB037 DD DSN=Your fb 37 byte file,DISP=SHR
//FB015 DD DSN=your fb 173 byte file,DISP=SHR
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//TOOLIN DD *
SORT FROM(FB015) USING(CTL1)
COPY FROM(FB037) USING(CTL2)
SPLICE FROM(T1) TO(OUT1) ON(16,11,CH) WITH(1,15) WITH(27,1) -
WITHALL KEEPNODUPS USING(CTL3)
//CTL1CNTL DD *
SORT FIELDS=(1,8,CH,A,13,3,CH,A),EQUALS
SUM FIELDS=NONE
OUTFIL FNAMES=T1,OVERLAY=(16:1,8,13,3,C'11')
//CTL2CNTL DD *
OUTFIL FNAMES=T1,OVERLAY=(16:1,8,35,3,C'22')
//CTL3CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(27,2,ZD,EQ,21),BUILD=(1,37)
OUTFIL FNAMES=OUT2,INCLUDE=(27,2,ZD,EQ,11),BUILD=(1,15)
/*

But I did something wrong because it gives the error.

ICE000I 0 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 13:31 ON MON AUG
OUTFIL FNAMES=T1,OVERLAY=(16:1,8,35,3,C'22')
ICE146I 0 END OF STATEMENTS FROM CTL2CNTL - PARAMETER LIST STATEMENTS FOLLOW
DEBUG NOABEND,ESTAE
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL2,SORTIN=FB037
DYNALLOC
SORT FIELDS=COPY
ICE201I F RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE222A 0 37 BYTE FIXED RECORD LENGTH IS NOT EQUAL TO 28 BYTE LRECL FOR T1
ICE751I 0 C5-K90013 C6-K90013 C7-K90000 C8-K42135 E9-K90013 E7-K44563
ICE052I 3 END OF DFSORT

Could you tell me where this error?

Thank you very much

Re: DFSORT help

PostPosted: Mon Aug 24, 2009 6:02 pm
by pulcinella
excuse me:

//STEP0xxx EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*

//FB037 DD DSN=Your fb 37 byte file,DISP=SHR
//FB015 DD DSN=your fb 15 byte file,DISP=SHR
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//TOOLIN DD *
SORT FROM(FB015) USING(CTL1)
COPY FROM(FB037) USING(CTL2)
SPLICE FROM(T1) TO(OUT1) ON(16,11,CH) WITH(1,15) WITH(27,1) -
WITHALL KEEPNODUPS USING(CTL3)
//CTL1CNTL DD *
SORT FIELDS=(1,8,CH,A,13,3,CH,A),EQUALS
SUM FIELDS=NONE
OUTFIL FNAMES=T1,OVERLAY=(16:1,8,13,3,C'11')
//CTL2CNTL DD *
OUTFIL FNAMES=T1,OVERLAY=(16:1,8,35,3,C'22')
//CTL3CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(27,2,ZD,EQ,21),BUILD=(1,37)
OUTFIL FNAMES=OUT2,INCLUDE=(27,2,ZD,EQ,11),BUILD=(1,15)
/*

thank you