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

SORT using set of substrings present in a PS


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jan 24, 2012 6:04 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Jan 24, 2012 6:11 pm
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 Developer


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

PostPosted: Wed Jan 25, 2012 12:08 am
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
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
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
Reply with quote

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

Global Moderator


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

PostPosted: Wed Jan 25, 2012 10:27 pm
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 Developer


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

PostPosted: Thu Jan 26, 2012 12:10 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
Search our Forums:

Back to Top