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
 

 

SORT using set of substrings present in a PS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sureshmurali
Warnings : 1

New User


Joined: 25 Nov 2010
Posts: 70
Location: Sivakasi, India

PostPosted: Tue Jan 24, 2012 5:15 pm    Post subject: SORT using set of substrings present in a PS
Reply with quote

I have few strings "XXXXXX" in a PS from column 1 to 6, say it is in 'AAAAAA.BBBBBB.CCCCCC.DDDDDD' .
I want to copy records of input file to output file based on the strings present in the above PS.
I know INCLUDE COND=(1,6,SS,EQ,C'substring should be here')....
How can i link each substring in the above ps to this INCLUDE CARD ? can anyone help me on this ?

Thanks in advance...
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Jan 24, 2012 6:04 pm    Post subject: Reply to: SORT using set of substrings present in a PS
Reply with quote

From the almost-no-information-you-have-given-us, isn't it one for a JOINKEYS application?

You seem to want those from one input dataset, 1, 6, which match against what is in another dataset, 1, 6. You have simply confused yourself by calling them "strings" and looking for some function which has the word "string" in its description.

Code:
"strings" (really, keys)
11111
22222
44444
55555

file
11111 x
22222 x
33333 x
44444 x
55555 x
66666 x

output after JOIN
11111 x
22222 x
44444 x
55555 x


If it is something else you are describing, you'll have to do better at it.
Back to top
View user's profile Send private message
sureshmurali
Warnings : 1

New User


Joined: 25 Nov 2010
Posts: 70
Location: Sivakasi, India

PostPosted: Tue Jan 24, 2012 6:06 pm    Post subject:
Reply with quote

My Bad. Sorry for the wrong SORT card posted. Let me clearly explain my requirement.

I have a PS 'AAAAAA.BBBBBB.CCCCCC.DDDDDD' and there are 60 strings are there-each of 6 bytes in length(from Column 1 to 6) of a FB record length 80. Say the records in PS are like -

SURESH
RAMESH
RAJESH
GANESH
MUKESH
.....
.....
etc

I have an SORT input PS file, say it is 'XXXXXX.YYYYYY.ZZZZZZ' which has 3000 records. I want to move/copy only the records that are having any of the above strings as a substring in the reocrds of SORT input file to the output file. This is my requirement. How the SORT CARD would be for this ?

Thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Jan 24, 2012 6:11 pm    Post subject: Reply to: SORT using set of substrings present in a PS
Reply with quote

why do You complicate things by telling irrelevant details ...
nobody cares about the dataset names FULL STOP icon_evil.gif
just describe the requirement in the simplest possible way
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: Wed Jan 25, 2012 12:08 am    Post subject:
Reply with quote

Suresh K,

You still haven't described your requirement clearly.

Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
sureshmurali
Warnings : 1

New User


Joined: 25 Nov 2010
Posts: 70
Location: Sivakasi, India

PostPosted: Wed Jan 25, 2012 2:19 pm    Post subject:
Reply with quote

Ok. I have a PS which has 'N' number of records each with the length of 6 bytes only and no duplicates. I have another PS which has 3000 records and out of them i need only the records which should have any of those 6 bytes record as a substring in it.

First PS -

SURESH
RAMESH
RAJESH

Second PS -

SURESH READS A BOOK.
FRANK HELPS OTHERS.
RAJESH IS A GOOD BOY.
IBM MAINFRAMES.
REXX TOOLS MAKE EASY OUR TASKS.

EXPECTED OUTPUT -
SURESH READS A BOOK.
RAJESH IS A GOOD BOY.

The output have the records of first PS as one of the substrings in its record.
Back to top
View user's profile Send private message
elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Wed Jan 25, 2012 5:11 pm    Post subject:
Reply with quote

Hi suresh,

If the string is going to appear exactly in same position as file 1 then we can use Joinkeys.(As stated in your example).

Have you given it a try?
Back to top
View user's profile Send private message
sureshmurali
Warnings : 1

New User


Joined: 25 Nov 2010
Posts: 70
Location: Sivakasi, India

PostPosted: Wed Jan 25, 2012 8:05 pm    Post subject:
Reply with quote

No. The string may appear at anywhere.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jan 25, 2012 10:27 pm    Post subject:
Reply with quote

I have a suggestion whuch is to create the cards dynamically and execute the program

or if you sort input file is not too large and if you know basic rexx programming you can achieve it by some logic

or if there is a program creating the string file create it as a sort card

This really may not be the best of solution
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: Thu Jan 26, 2012 12:10 am    Post subject:
Reply with quote

Suresh,

You can use a DFSORT/ICETOOL job like the following to do what you asked for. It will build the INCLUDE statement dynamically from the input file1 records. Since you didn't tell me the RECFM and LRECL of each input file as I requested, I assumed FB/80. The job can be changed appropriately for other attributes. I added an extra input file2 record with RAMESH not starting in position 1 for a better test.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD *
SURESH
RAMESH
RAJESH
//IN2 DD *
SURESH READS A BOOK.
FRANK HELPS OTHERS.
RAJESH IS A GOOD BOY.
IBM MAINFRAMES.
REXX TOOLS MAKE EASY OUR TASKS.
WHO IS RAMESH?
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(CTL2CNTL) USING(CTL1)
COPY FROM(IN2) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
   OUTFIL REMOVECC,
     HEADER1=('  INCLUDE COND=(1,1,CH,NE,1,1,CH,OR,'),
     BUILD=(C'   1,80,SS,EQ,C''',1,6,C''',OR,',80:X),
     TRAILER1=('  1,1,CH,NE,1,1,CH)')
/*
//CTL2CNTL DD DSN=&&C2,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)



For this example, OUT will have:

Code:

SURESH READS A BOOK.       
RAJESH IS A GOOD BOY.       
WHO IS RAMESH?             
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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