|
From: mftips@gmail.com on 7 Feb 2006 21:32 To Search for a particular string within a file when the exact position of that string within a record is not known and to write that record in the Output file the following SORT card can be used. Example 1: SORT FIELDS=COPY INCLUDE COND= (1, 80, SS, EQ, C'FIND STRING') Here, SS - Sub string, 1 - Starting position of the range 80 - Width of the search range EQ - Comparison operators The Sort card for this will need information like range of columns within which you want the search to be performed. To search in the whole file you can give the start position as 1 and LRECL of the file as the width of the search range as done above. We can also replace the 'EQ' parameter by 'NE' which will fetch us all the records which don't have the specified string. Only EQ & NE can be used for comparison. We can even use OMIT COND instead of INCLUDE. This can also be used to find the records with string that match one of the strings in the COND. Example 2: SORT FIELDS=COPY INCLUDE COND= (1, 80, SS, EQ, C'HDR,TRL') The above sort card returns all records with the substring ' HDR' or 'TRL' occurring within the search range(1-80) of the record in the input file. Thanks, MFTIPS http://mftips.blogspot.com/
From: Howard Brazee on 8 Feb 2006 10:09 On 7 Feb 2006 18:32:01 -0800, "mftips(a)gmail.com" <mftips(a)gmail.com> wrote: >To Search for a particular string within a file when the exact position >of that string within a record is not known and to write that record in >the Output file the following SORT card can be used. > >Example 1: >SORT FIELDS=COPY >INCLUDE COND= (1, 80, SS, EQ, C'FIND STRING') This is not the best forum for a SORT question. If you are referring to IBM's mainframe sort, you might want to e-mail Frank Yeager yaeger(a)ibm-main.lst or join the IBM list server list: ibm-main(a)bama.ua.edu, (which he subscribes to), or look at the newsgroup that has a copy of that listserver (which he may or may not catch) bit.listserv.ibm-main . Or check http://www-03.ibm.com/servers/storage/support/software/sort/mvs/professor_sort/srtmainf.html
From: on 9 Feb 2006 08:41 In article <m12ku1lkrkudaa1bbglofuqu9l357tb63f(a)4ax.com>, Howard Brazee <howard(a)brazee.net> wrote: >On 7 Feb 2006 18:32:01 -0800, "mftips(a)gmail.com" <mftips(a)gmail.com> >wrote: > >>To Search for a particular string within a file when the exact position >>of that string within a record is not known and to write that record in >>the Output file the following SORT card can be used. >> >>Example 1: >>SORT FIELDS=COPY >>INCLUDE COND= (1, 80, SS, EQ, C'FIND STRING') > >This is not the best forum for a SORT question. I did not read this as a question, Mr Brazee, I read it as a suggestion/tip... and it was a new one to me, too. I've used batch SUPERC jobs to do this in the past, eg: //SEARCH EXEC PGM=ISRSUPC, // PARM=(SRCHCMP, // 'ANYC') //NEWDD DD DSN=YOUR.DSN.HERE, // DISP=SHR //OUTDD DD SYSOUT=* //SYSIN DD * SRCHFOR 'SMITH' CMPCOLM 1:200 .... but I was unaware that DFSORT could do this ('SS' as a format is mentioned in the documentation here and there but appears to be missing from <http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/3.7.2.1?DT=20031124143823#TBLBOZO> and <http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/C.1?SHELF=&DT=20031124143823&CASE=> ... and to learn A New Thing can be pleasant. E'en more interesting... I just ran a test against a VSAM KSDS, LRECL=350, about 65,000 recs, searching for 'SMITH' in columns 1 - 200. ISRSUPC used 1538 I/O counts (whatever those measure) and 2.04 CPU sec, DFSORT (REL 14.0) used 202 I/O counts and 1.10 CPU sec. DD
From: Howard Brazee on 9 Feb 2006 09:16 On Thu, 9 Feb 2006 13:41:21 +0000 (UTC), docdwarf(a)panix.com () wrote: >I did not read this as a question, Mr Brazee, I read it as a >suggestion/tip... and it was a new one to me, too. I've used batch SUPERC >jobs to do this in the past, eg: Here's some compare JCL I've used that you might find interesting. //TBEB EXEC PGM=IEFBR14 //SORTOUT DD DSN=UMS.D44201.TEMP, // DISP=(MOD,DELETE),SPACE=(TRK,0) //SORTSTEP EXEC PGM=SORT //SORTIN DD DSN=,DISP=SHR // DD DSN=UMS.D44201.LAMV.LOAN.MASTER,DISP=SHR //*DFSPARM DD DSN=UMS.TEST.DATA(DYNALLOC),DISP=SHR //*SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,82,,CONTIG) //*SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,82,,CONTIG) //*SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,82,,CONTIG) //SORTOUT DD DSN=UMS.D44201.TEMP, // UNIT=DEVEDISK, // SPACE=(CYL,(75,15),RLSE), // DCB=(RECFM=FB,LRECL=1200,BLKSIZE=12000), // DISP=(NEW,CATLG,DELETE) //SYSOUT DD SYSOUT=* //SYSIN DD * SORT FIELDS=(01,1010,A), FORMAT=CH SUM FIELDS=NONE ELIMINATE DUPLICATES //SUPERC EXEC PGM=ISRSUPC, * // PARM=(DELTAL,LINECMP, // ' NOSEQ', // '') //NEWDD DD DSN=UMS.D44201.LLDJ.MSTRFILE, // DISP=SHR //OLDDD DD DSN=UMS.D44201.LAMV.LOAN.MASTER, // DISP=SHR //OUTDD DD SYSOUT=(*) //SYSIN DD * OFOCUS COLS 1101:1115 NFOCUS COLS 1101:1115 LSTCOLM 1101:1115 /* // CMPCOLM 30:60,75 HTTP://PUBLIBZ.BOULDER.IBM.COM/CGI-BIN/BOOKMGR_OS390/BOOKS/ISPZU220/APPENDIX1
From: on 9 Feb 2006 10:03 In article <2fjmu1ldr7aomn0g69vjb6epqj49qp674h(a)4ax.com>, Howard Brazee <howard(a)brazee.net> wrote: >On Thu, 9 Feb 2006 13:41:21 +0000 (UTC), docdwarf(a)panix.com () wrote: > > >>I did not read this as a question, Mr Brazee, I read it as a >>suggestion/tip... and it was a new one to me, too. I've used batch SUPERC >>jobs to do this in the past, eg: > >Here's some compare JCL I've used that you might find interesting. [snip] >LSTCOLM 1101:1115 *Most* interesting... thanks much! DD
|
Next
|
Last
Pages: 1 2 3 Prev: File declarations in the Environment and Data division Next: Search for a string using SORT |