Search for a string using SORT #2

  • Permalink
  • submit to reddit
  • Email
  • Follow


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/

0
Reply mftips (9) 2/8/2006 2:32:03 AM

See related articles to this posting


mftips@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.
>...

Your examples are actually incorrect.  Your control statements contain
blanks that will result in syntax errors.  For example 1, the INCLUDE
statement should be:

   INCLUDE COND=(1,80,SS,EQ,C'FIND STRING')

Your second example does NOT do what you say it does.

   INCLUDE COND=(1,80,SS,EQ,C'HDR,TRL')

will actually include records with the string 'HDR,TRL' in them.  To
include records with the string 'HDR' or the string 'TRL' in them, you
would use this DFSORT INCLUDE statement:

   INCLUDE COND=(1,80,SS,EQ,C'HDR',OR,
                1,80,SS,EQ,C'TRL')

To include records with the string 'HDR' or the string 'TRL' in
positions 11-13, you could use this DFSORT INCLUDE statement:

   INCLUDE COND=(11,3,SS,EQ,C'HDR,TRL')

For those who are not familiar with DFSORT and DFSORT's ICETOOL, I'd
suggest reading through "z/OS DFSORT:  Getting Started".  It's an
excellent tutorial, with lots of examples, that will show you how to
use DFSORT, DFSORT's ICETOOL and DFSORT Symbols.  You can access it
online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html

Frank Yaeger - DFSORT Team  (IBM) - yaeger@us.ibm.com
Specialties: ICETOOL, IFTHEN, OVERLAY, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/

0
Reply yaeger (25) 2/9/2006 5:51:29 PM

mftips@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.
>...

Your examples are actually incorrect.  Your control statements contain
blanks that will result in syntax errors.  For example 1, the INCLUDE
statement should be:

   INCLUDE COND=(1,80,SS,EQ,C'FIND STRING')

Your second example does NOT do what you say it does.

   INCLUDE COND=(1,80,SS,EQ,C'HDR,TRL')

will actually include records with the string 'HDR,TRL' in them.  To
include records with the string 'HDR' or the string 'TRL' in them, you
would use this DFSORT INCLUDE statement:

   INCLUDE COND=(1,80,SS,EQ,C'HDR',OR,
                1,80,SS,EQ,C'TRL')

To include records with the string 'HDR' or the string 'TRL' in
positions 11-13, you could use this DFSORT INCLUDE statement:

   INCLUDE COND=(11,3,SS,EQ,C'HDR,TRL')

For those who are not familiar with DFSORT and DFSORT's ICETOOL, I'd
suggest reading through "z/OS DFSORT:  Getting Started".  It's an
excellent tutorial, with lots of examples, that will show you how to
use DFSORT, DFSORT's ICETOOL and DFSORT Symbols.  You can access it
online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html

Frank Yaeger - DFSORT Team  (IBM) - yaeger@us.ibm.com
Specialties: ICETOOL, IFTHEN, OVERLAY, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/

0
Reply yaeger (25) 2/9/2006 5:51:33 PM

On 9 Feb 2006 09:51:33 -0800, yaeger@us.ibm.com wrote:

>For those who are not familiar with DFSORT and DFSORT's ICETOOL, I'd
>suggest reading through "z/OS DFSORT:  Getting Started".  It's an
>excellent tutorial, with lots of examples, that will show you how to
>use DFSORT, DFSORT's ICETOOL and DFSORT Symbols.  You can access it
>online, along with all of the other DFSORT books, from:
>
>www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
>
>Frank Yaeger - DFSORT Team  (IBM) - yaeger@us.ibm.com
>Specialties: ICETOOL, IFTHEN, OVERLAY, Symbols, Migration
>=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/


What happened to
HTTP://PUBLIBZ.BOULDER.IBM.COM/CGI-BIN/BOOKMGR_OS390/BOOKS/ISPZU220/APPENDIX1
?
0
Reply howard (6282) 2/9/2006 5:59:43 PM

Howard Brazee wrote:
> What happened to
> HTTP://PUBLIBZ.BOULDER.IBM.COM/CGI-BIN/BOOKMGR_OS390/BOOKS/ISPZU220/APPENDIX1
> ?

Howard,

Sorry, but I don't understand your question.  Are you looking for an
Appendix in a specific DFSORT book?  If so, which Appendix in which
book?  If not, please clarify.

Frank Yaeger - DFSORT Team  (IBM) - yaeger@us.ibm.com
Specialties: ICETOOL, IFTHEN, OVERLAY, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/

0
Reply yaeger (25) 2/9/2006 6:09:16 PM

On 9 Feb 2006 10:09:16 -0800, yaeger@us.ibm.com wrote:

>> What happened to
>> HTTP://PUBLIBZ.BOULDER.IBM.COM/CGI-BIN/BOOKMGR_OS390/BOOKS/ISPZU220/APPENDIX1
>> ?
>
>Howard,
>
>Sorry, but I don't understand your question.  Are you looking for an
>Appendix in a specific DFSORT book?  If so, which Appendix in which
>book?  If not, please clarify.

I had it as a link written in as documentation for a job.  It no
longer points to anything and I want to update my documentation with
wherever that old documentation was moved to.   Trouble is, I don't
remember what it said.
0
Reply howard (6282) 2/9/2006 6:34:23 PM

Howard Brazee wrote:
> On 9 Feb 2006 10:09:16 -0800, yaeger@us.ibm.com wrote:
>
> >> What happened to
> >> HTTP://PUBLIBZ.BOULDER.IBM.COM/CGI-BIN/BOOKMGR_OS390/BOOKS/ISPZU220/APPENDIX1
> I had it as a link written in as documentation for a job.  It no
> longer points to anything and I want to update my documentation with
> wherever that old documentation was moved to.   Trouble is, I don't
> remember what it said.

Sorry, I don't know what that used to point to so I can't help.

If you're looking for the DFSORT books, you can access them all from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html

Frank Yaeger - DFSORT Team  (IBM) - yaeger@us.ibm.com
Specialties: ICETOOL, IFTHEN, OVERLAY, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/

0
Reply yaeger (25) 2/10/2006 5:40:41 PM
comp.lang.cobol 4202 articles. 4 followers. Post

6 Replies
503 Views

Similar Articles

[PageSpeed] 40


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Search for a string using SORT
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 fil...

sorting strings using 2 criteria
hi all, suppose i have following set of strings : 'f13' 'g12' 'g13' 'h12' 'j12' 'j13' 'k12' 'm12' 'm13' 'm15' 'n12' 'q12' 'u12' 'v12' 'x12' 'z12' 'z13' 'z14' 'z15' 'z16' 'z17' 'z19' i would like to sort them according to following 2 rules: 1. letters should be in this order F G H J K M N Q U V ...

Using Unix sort command to sort on 2 fields
I am attempting to sort a CSV file by 2 fields (sort the 1st field ascending ASCII and then sort the 7th field by descending numeric). The command I've tried after reading extensively the man pages is sort -t, -o PSASort1.dat +0 -1 -n -r +6 -7 PSATst1.csv I assumed this would (1) use "," as the input separator, (2) write the sorted output to PSASort1.dat, (3) sort in ascending order the first field in the record, and then (4) sort in descending (-r) numeric order (-n) the 7th field in the record. In fact this sorted only the 7th field in the record in descending numeric ord...

searching an array, string compare functions, string sorting
Hello, I would like to use an array as a search index. The code defining the array is not generated with JavaScript. When searching a word in the index, I do a quick binary search. Which fails, of course, if the order of the words in the array is not in exactly the way as JavaScript would sort them. The words in the index can contain special characters, e.g. from the german, french or spanish alphabet. I wonder what might be easier: To teach the external application to sort the index array in a way that equals the JavaScript sorting, OR to teach JavaScript to compare strings in a way that ...

Re: How to find out duplicates by using sql (Not using proc sort #2
On Tue, 1 Jul 2008 05:36:20 -0700, ravikumarpsas@GMAIL.COM wrote: >Hi, > >I am Ravi kumar. >I have a simple question. >data a; >input x; >cards; >2 >6 >2 >9 >6 >; >run; >For the above question,How to findout the duplicates by using sql. >output: >2 >6 >Please help me on the same >Many Thanks >Ravi proc sql; select x from a group by x having count('x') > 1; quit; ...

problems with in 2.3.2 developed modules used with 2.2.2
Sorry for the long header of this mail ;-) Has anyone experienced modules developed in 2.3.2 (using IDLE and = PythonWin as IDE) don't work under 2.2.2.... I mean basic stuff like it = can not see classes from your .py file, so an import fails? It almost likes that in my case 2.2.2 doesn't like the file format = generated by IDLE or PythonWin in 2.3.2. Does someone know if this is a known problem? Vincent Try deleting the .pyc version of the file... maybe 2.2.2 doesn't realize that the magic number is wrong and that it should recompile from the .py source. Kevin. "Raa...

How to using incremental search using viper search?
Though I know I can use ctrl-s to perform incremental search, but I am customed to using vim way ( / key) to perform search. How to perform incremental search using / key in viper mode? Thanks ...

String search #2
Hi, Iam new to tcl. Iam writing a simple script to search a string starting with '0' and get that string and assign that string to a variable so that I can use it for future. The main string is like this s:/dest/file/forward/0342_uid_forward_gu.90w I want to search for the substring starting with '0', and assign that to a variable. Please help me. Tanks in advance. Regards, Kukku. kukkus1234@rediffmail.com wrote: > > Hi, > > Iam new to tcl. Iam writing a simple script to search a string starting > with '0' and get that string and assign that ...

Search for 2 strings
Hi I have a file containing 2 words on 2 seperate lines: e.g. car bike I want to pipe this file through sed or awk, and only return the output only **both** words are found. Could someone help me do this? As they are on different lines grep wont work. Thanks On Wed, 11 Aug 2010 10:26:47 -0700 (PDT) Chris <cconnell_1@lycos.com> wrote: > Hi > I have a file containing 2 words on 2 seperate lines: > > e.g. > > car > bike > > I want to pipe this file through sed or awk, and only return the > output only **both** words are found. C...

Problems compiling programs using wxWindows 2.2.9 using GCC-3.2.3
PLATFORM: Windows XP COMPILER: g++ Version 3.2.3 wxWINDOWS VERSION: wxWindows 2.2.9 Hi: I have successfully compiled wxWindows 2.2.9 on MinGW-3.0.0-rc4 [GCC Version 3.2.3] after commenting out the compilation of dynlib.cpp and fontenum.cpp (error at line 155) in the makefile.g95. The 2 source files were causing compilation errors which caused make to exit with an errnum of 1. My problem is this. A sample "Hello, World!" program - basic.cpp - fails during linking: C:\myzz>make 2>err g++ --pipe -c -D_X86_=1 -DWIN32 -D_WIN32 -DWINVER=0x0400 -D__WIN95__ -D__...

Chris Pine tutorial assistance chapter 7 sort data without use of .sort method #2
I'm learning to program and came across Chris Pine's Ruby Tutorial. I've got to the Array and Iterators chapter ( http://pine.fm/LearnToProgram/?Chapter=07 ). and the following assignment " Let's write a program which asks us to type in as many words as we want (one word per line, continuing until we just press Enter on an empty line), and which then repeats the words back to us in alphabetical order. OK? " ****** HOWEVER I'm not allowed to use the .sort method ******** The covered chapters (1 ~ 7) have not covered method creation, Classes, Blocks or Procs, so...

write in 2 columns using a &quot;write to spreadsheet file&quot; if I have 2 strings which are in columns
I have tried, but I don't know how to do it Thanks Duplicate <a href="http://forums.ni.com/ni/board/message?board.id=170&amp;message.id=249412&amp;jump=true" target="_blank">thread</a> Please stick to one thread ...

strings #2 #2
Greetings, I am writing a routine that will print out the beginning and end strings for a game: String A1 -> "Begin msg1" String B1 -> "End msg1" String A2 -> "Begin msg2" String B2 -> "End msg2" At the game start it prints a string and when game ends it prints a matching string that is related to the first string such as "Shakespeare awakens." (String A1) and then "Shakespear goes to sleep." (String B1) So the strings have to match. First I thought of making one char pointer array and having 2 functions, one to prin...

Sorting #2 #2
Hi, I'm looking to read a directory to get a list of files in Descending sorted order by timestamp. I've gotten this so far, but it is in ascending. Can anyone help with the descending part? my $dir = '/home/logfiles'; opendir my $DH, $dir or die "Cannot opendir '$dir' $!"; my @sorted_files = map $_->[1], sort { $a->[0] <=> $b->[0] } map -f "$dir/$_" ? [ ( stat _ )[9], $_ ] : (), readdir $DH; for ($i=0; $i<20; $i++) { print "FILE: $sorted_files[$i]\n"; } Thank a bunch! sort { $b->[0] <=> $a->[0] } ...

search string in other string
I have many files in directory ~/a/ Each file in this directory has name made from letters and numbers, e.g. abc1234def.txt bcd4567asdfd.txt zyx4543c.txt The numbers are always on characters posiotions 4-7. I have also one file in directory ~/b/b.txt which has several lines with numbers. I would like to write a script which will check for each file in ~/a/ if its name is equal to some number in file ~/b/b.txt I know position of numbers in files name so I can use "cut": #---- foo="~/b/b.txt" for file in ~/a/*.txt do var1=`echo $file | cut -c 4-7` var2=`g...

String #2 #2
src_array = imgs.collect{|img| img.attributes["src"]} can you people explain this code => imgs.collect{|img| img.attributes["src"]} -- Posted via http://www.ruby-forum.com/. On Fri, Aug 22, 2008 at 6:29 AM, Newb Newb <hema@angleritech.com> wrote: > src_array = imgs.collect{|img| img.attributes["src"]} > > can you people explain this code => imgs.collect{|img| > img.attributes["src"]} The method collect comes from the Enumerable module: http://www.ruby-doc.org/core/classes/Enumerable.html#M003158 As it explains in the docume...

wxMSW 2.5.2 (Sep 2004 cvs version)
Compiler: VC++ 6.0 wxWidgets 2.5.2 cvs Sep 2004 version Platform: Windows I have an application and a dll that work on Windows and Mac. Both the application and dll are dynamically linked with wxWidgets. Within the dll, I start two threads A and B. Thread A does some processing and goes to sleep using = wxThread::Sleep(30000) Later, Thread B does some processing and goes to sleep using = wxThread::Sleep(10000) Thread B wakes up and starts running after sleeping for 10 seconds. = Thread A never gets scheduled. It gets stuck. I have already tried using SetPriority and Yie...

string search on grep #2
Hello, do you know how to exclude a string from grep result? Basically, I don't want a certain word in the greped output, but it seems there is not document online about this. Does anyone know how to do this. Thank you very much. Regards, Jian On Wed, 04 Apr 2007 05:36:28 -0700, jian wrote: > Hello, do you know how to exclude a string from grep result? > Basically, I don't want a certain word in the greped output, but it > seems there is not document online about this. Does anyone know how to > do this. Thank you very much. > > Regards, > Jian Hi Jian, try t...

How would you use qsort to sort on a string
I'm curious if you can easily use qsort to sort the letters in a null terminated string, without using any conditional statements? char str[ ] = "bdace"; becomes "abcde" "Eddy C" <eddy73@gmail.com> writes: > I'm curious if you can easily use qsort to sort the letters in a null > terminated string, without using any conditional statements? > > char str[ ] = "bdace"; > > becomes "abcde" The following is not compiled or well proofread. It will only produce the desired output for your example on systems where ...

searching strings using variables
Hi, all. Another bewildered newbie struggling with Python goodness. This time it's searching strings. The goal is to search a string for a value. The string is a variable I assigned the name 'myvar'. however, it doesn't seem to be seeing it... Here's a snippet. import re # list of items to search... mylist = [ 5 , 6 , 16 , 17 , 18 , 19 , 20 , 21 ] # my variable I want to search with... myvar = '16' print re.search('myvar','mylist') .... just returns none. Tried it also with... mylist.index('myvar') to see if I could spook it out but I...

Re: search string #2
Hello M M Scanning a string for a character ... I would use substr() function ... the rest depends on your desired output. Two different out-s below.. HTH Magnus --------------- begin code --------------- data in ; input string $ 1-25; cards; ----+-+-+----+ --+---------+- ------++---+-+ ; run; data out_1; set in; length pos $ 100; do i = 1 to length(string); if (substr(string, i, 1) = '+') then pos = trim(left(pos)) || ';' || put(i, 8.-L); end; keep string pos; run; data out_2; set in; do pos = 1 to length(string); if (substr...

Sorting by using parts of a string
Hi, This is a tougher one, but I'm quite sure someone will have a solution for this. Of course, a last minute thing thrown at me by my boss. I have a unique identifier consisting of regions, districts, a road class value and then sequential numbers, in that order, eg: GA-GAD-C-005 The thing is that the sequential values don't follow onto each other as it does the sorting on the road class value first (which could be A, I or C). So, you'll have the first three parametres correct, but the number skips values, which appears in a different "group" for that district. I n...

Searching a sorted array of strings
Hi All- I am an infrequent user of Perl. I sat down this morning to do a simple task, which started with referring to some data. It took me a while to write this simple routine, making most every mistake on the way. Perhaps it will be useful to someone. I tried to use qw( "name" "name space" ); and had problems, so I use the long form. Constructive comments welcome. The array is almost a thousand elements actually, edited for usenet <- snip -> #! /usr/bin/perl -w use strict; use warnings; my @CA_Cities = ( "adelanto", "agoura hills",...

Search string in Array #2
I have one 1D array in that array the elements are started like 04_02_26LS1004(format is yy_mm_ddserialnumber).I Dont know the array size. It may go more than 60000. I want to search the elements which are all matching for the first 8 characters(yy_mm_dd).I don't need to compare one element by one element using for loop.Please Suggest. with regards R.sathiyanarayanan You could sort the array, and then do a binary search for 04_02_26AA0000 (lowest possible according to ASCII table) and 04_02_26zz9999 (highest possible according to ASCII table) which should represent the lower and upper r...