Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

search multiple strings in a record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: search multiple strings in a record
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Feb 15, 2012 10:16 pm    Post subject: Reply to: search multiple strings in a record
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Wed Feb 15, 2012 10:24 pm    Post subject: Reply to: search multiple strings in a record
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    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Feb 16, 2012 8:08 pm    Post subject: Reply to: search multiple strings in a record
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    Post subject: enrico
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Feb 16, 2012 8:14 pm    Post subject: Reply to: search multiple strings in a record
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: 1738
Location: Bloomington, IL

PostPosted: Thu Feb 16, 2012 8:34 pm    Post subject: Re: enrico
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    Post subject:
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 Moderator


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

PostPosted: Fri Feb 17, 2012 12:46 am    Post subject:
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:

http://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    Post subject: Reply to: search multiple strings in a record
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 Moderator


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

PostPosted: Sat Feb 18, 2012 12:39 am    Post subject:
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    Post subject:
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: 1713
Location: UK

PostPosted: Sat Feb 18, 2012 10:35 am    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Sat Feb 18, 2012 8:57 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us