View previous topic :: View next topic
|
Author |
Message |
surbhi jain
New User
Joined: 10 Feb 2012 Posts: 7 Location: INDIA
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
do not piggyback on an inactive and unrelated topic.
what sort product are You using...
DFSORT ICE... messages
SYNCSORT WER... messages ? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
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 |
|
|
elango_K
New User
Joined: 18 Aug 2011 Posts: 44 Location: India
|
|
|
|
surbhi jain,
I believe your requirement is to create dynamic sort cards based on your input.
Is that correct??? |
|
Back to top |
|
|
surbhi jain
New User
Joined: 10 Feb 2012 Posts: 7 Location: INDIA
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
then why in heaven, in Your initial post, You described the requirement in a completely different way ?
and why did You not tell Your <SORT> product when asked? |
|
Back to top |
|
|
surbhi jain
New User
Joined: 10 Feb 2012 Posts: 7 Location: INDIA
|
|
|
|
i am extremly sorry for that.. actually this was what i wanted....
please can you help me out....
thanks a lot... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
Back to top |
|
|
surbhi jain
New User
Joined: 10 Feb 2012 Posts: 7 Location: INDIA
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
surbhi jain
New User
Joined: 10 Feb 2012 Posts: 7 Location: INDIA
|
|
|
|
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.. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
|