saru
New User
Joined: 17 Feb 2005 Posts: 4
|
|
|
|
hai!
can any body send me the solution of the following:
i have a Vsam KSDS file 'FILE1', with 10000 records, each having some fields, one of the field is 'FIELD1' of size 10 bytes.
and now i want to read that ksds file records and search for 'indic' string . (this 'indic' is located in last 5 bytes of the 'FIELD1' variable.)
so if u find that in any record then write that record in to other o/p file(gdg), else write in to empty file.
consider it as urgent
with thanks
saru |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use DFSORT to do this. DFSORT can always process a KSDS as TYPE V. DFSORT can process a KSDS as TYPE F if all of the records are the same length.
Let's assume the string you want to check starts in data position 21.
With TYPE V processing, the starting position would be 25 (21 + 4 for the RDW that DFSORT uses) and you could use this DFSORT job to write only the records with the given string to the output data set:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... VSAM input file
//SORTOUT DD DSN=... VB output file
//SYSIN DD *
OPTION COPY
RECORD TYPE=V
INCLUDE COND=(25,5,CH,EQ,C'indic')
|
With TYPE F processing, the starting position would be 21 and you could use this DFSORT job to write only the records with the given string to the output data set:
Code: |
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... VSAM input file
//SORTOUT DD DSN=... FB output file
//SYSIN DD *
OPTION COPY
RECORD TYPE=F
INCLUDE COND=(21,5,CH,EQ,C'indic')
|
For more information on processing VSAM data sets with DFSORT, see:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/1.8.3.4?SHELF=&DT=20050120082820&CASE=
I don't know what you mean by "else write in to empty file.". You need to explain what you mean by this if you want more help. Showing an example of your input recoreds and what you expect for output would be a good way to clarify what you need. |
|