View previous topic :: View next topic
|
Author |
Message |
sureshmurali Warnings : 1 New User
Joined: 25 Nov 2010 Posts: 70 Location: Sivakasi, India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
sureshmurali Warnings : 1 New User
Joined: 25 Nov 2010 Posts: 70 Location: Sivakasi, India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
why do You complicate things by telling irrelevant details ...
nobody cares about the dataset names FULL STOP
just describe the requirement in the simplest possible way |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
sureshmurali Warnings : 1 New User
Joined: 25 Nov 2010 Posts: 70 Location: Sivakasi, India
|
|
|
|
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 |
|
|
elango_K
New User
Joined: 18 Aug 2011 Posts: 44 Location: India
|
|
|
|
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 |
|
|
sureshmurali Warnings : 1 New User
Joined: 25 Nov 2010 Posts: 70 Location: Sivakasi, India
|
|
|
|
No. The string may appear at anywhere. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|