IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

search multiple strings in a record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
surbhi jain

New User


Joined: 10 Feb 2012
Posts: 7
Location: INDIA

PostPosted: Wed Feb 15, 2012 10:09 pm
Reply with quote

hi ,

i want to search multiple strings in a record in the PS based on the key positions , for example :

if i have a records like :

Code:
kelvin 26 INDIA
Paul   29 USA


i want to serch for record whos name starts with k and age is greater than 25

so as per the requirement the output should be :

kevin 26 INDIA

which should be saved in an output PS file.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Feb 15, 2012 10:16 pm
Reply with quote

do not piggyback on an inactive and unrelated topic.
what sort product are You using...
DFSORT ICE... messages
SYNCSORT WER... messages ?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Feb 15, 2012 10:24 pm
Reply with quote

unless something was hidden/not told when describing the requirement
Code:

 000004 //ICE     EXEC PGM=SORT                                                 
 000005 //SYSOUT    DD SYSOUT=*                                                 
 000006 //SYSPRINT  DD SYSOUT=*                                                 
 000007 //SORTIN    DD *                                                       
 000008 KEVIN    25   USA                                                       
 000009 PAUL     29   INDIA                                                     
 000010 KEVIN2   18   USA                                                       
 000011 KLAUS    29   GERMANY                                                   
 000012 //SORTOUT   DD SYSOUT=*,                                               
 000013 //             DCB=(RECFM=FB,LRECL=80)                                 
 000014 //SYSIN     DD *                                                       
 000015   SORT FIELDS=COPY                                                     
 000016   INCLUDE COND=(1,1,CH,EQ,C'K',AND,10,2,ZD,GE,25)                       


should give the expected result
( fix the positions and lengths accordingly 1,1 10,2 )
Back to top
View user's profile Send private message
elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Thu Feb 16, 2012 3:59 pm
Reply with quote

surbhi jain,

I believe your requirement is to create dynamic sort cards based on your input.

Is that correct???
Back to top
View user's profile Send private message
surbhi jain

New User


Joined: 10 Feb 2012
Posts: 7
Location: INDIA

PostPosted: Thu Feb 16, 2012 8:05 pm
Reply with quote

yes Elango you are right ,
i am using dfsort for the first time and i want to create a small rexx program which will take min 1 and max 5 strings as input from the user as well as the key positions of those strings to be searched in a ps file. So for this purpose i want to use dfsort utility in rexx.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Feb 16, 2012 8:08 pm
Reply with quote

then why in heaven, in Your initial post, You described the requirement in a completely different way ? icon_evil.gif
and why did You not tell Your <SORT> product when asked?
Back to top
View user's profile Send private message
surbhi jain

New User


Joined: 10 Feb 2012
Posts: 7
Location: INDIA

PostPosted: Thu Feb 16, 2012 8:10 pm
Reply with quote

i am extremly sorry for that.. actually this was what i wanted....
please can you help me out....

thanks a lot...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Feb 16, 2012 8:14 pm
Reply with quote

Quote:
i am extremly sorry for that.. actually this was what i wanted....

then You will have to do a better job in describing it.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Feb 16, 2012 8:34 pm
Reply with quote

surbhi jain wrote:
please can you help me out....

enrico-sorichetti wrote:
why did You not tell Your <SORT> product when asked?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Feb 16, 2012 8:39 pm
Reply with quote

surbhi jain wrote:
i am using dfsort for the first time and i want to create a small rexx program which will take min 1 and max 5 strings as input from the user as well as the key positions of those strings to be searched in a ps file. So for this purpose i want to use dfsort utility in rexx.


If you are planning on doing multiple searches on a single run you will have to be careful about how you set up the searches with 'and's and 'or's.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 17, 2012 12:46 am
Reply with quote

surbhi jain,

You haven't explained clearly what you're trying to do. But if you want to use DFSORT from REXX, perhaps the following example will help:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA60/11.3?DT=20110608113434
Back to top
View user's profile Send private message
surbhi jain

New User


Joined: 10 Feb 2012
Posts: 7
Location: INDIA

PostPosted: Fri Feb 17, 2012 8:15 am
Reply with quote

Frank , actually i am taking input as strings and their key positions i.e. start key and end key position and these strings have to be searched in a ps file.

i will again try to explian with better example , suppose we have below ps which contains following records:

Ram 26 INDIA 302004
Sam 29 USA 3044558
Kelvin 30 CANADA 65464

so for the above file user will enter suppose :

string to be searched : INDIA
start key : 8 end key : 13

so as per the user input the program is required to search for the string india between the key positions i.e. between 8 and 13 and the matching record should be saved in an output ps file.

As per dfsort we need to mention that the comaprision will be with a charater or a numeric value , since in this case we wont be able to find whether the user has entered a charater or a numeric or an alphanumeric string like an address that has to be searched , so how will i make that option to be dynamic as per the input.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Feb 18, 2012 12:39 am
Reply with quote

Quote:
so for the above file user will enter suppose :

string to be searched : INDIA
start key : 8 end key : 13


Huh? DFSORT is a batch program, not an interactive program. The user can't enter data from the keyboard for DFSORT to use unless you wrap a program around that which will process the keyboard input and call DFSORT.

If you want to search for a string between positions 8 and 13, you can use an INCLUDE statement like:

Code:

   INCLUDE COND=(8,6,SS,EQ,C'string')


DFSORT does NOT care what's in the string - it can be anything. You can a hex string (X'hh...hh') if need be.

But if you want the string and positions entered dynamically, you'll need an interactive program to obtain that information from the keyboard, generate the appropriate control statements and call DFSORT.

Or are the string and postions in another file? If so, then you could obtain that information with DFSORT, have DFSORT generate the control statements and use them dynamically.
Back to top
View user's profile Send private message
surbhi jain

New User


Joined: 10 Feb 2012
Posts: 7
Location: INDIA

PostPosted: Sat Feb 18, 2012 9:05 am
Reply with quote

frank,
I am using panels designed in rexx to take the user input and i even tried using the link that you provided ' to call DFSORT from rexx' but in that i am getting some error saying dataset not freed so cannot be allocated.. icon_sad.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Sat Feb 18, 2012 10:35 am
Reply with quote

Quote:
panels designed in rexx
- never heard of this. I suspect that you mean ISPF panels accessed via Rexx (as opposed to cobol, pl?1 or other languages that can use ISPF panels).
Quote:
dataset not freed so cannot be allocated
- so how about freeing the datasets at the start of your Rexx exec? And making sure that they are freed at the end.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Sat Feb 18, 2012 8:57 pm
Reply with quote

surbhi jain wrote:
i am getting some error saying dataset not freed so cannot be allocated

Run your exec with TRACE I or TRACE R and find out from where the message comes. Really, are you sotfware engineers so scared to actually debug your code that you think it preferable to sit, helpless tears running down your cheeks, waiting to be fired?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top