View previous topic :: View next topic
|
Author |
Message |
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
My input file has 10 million records each of recsize 300. Only a particular record contains the key that i am looking for.
Using INCLUDE COD i can check whether that key exists in that file or not.
What i want is: I want the record no (position) which contains the desired key in my o/p:
for eg:
rec1 ................................
rec2 ................................
rec3 ...................xxxx......
rec4 ................................
rec5 ................................
rec3 is containg desired key value : XXXX
I want 00000003 in o/p
Hope it is clear.
Thanks,
Ajay |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Probably yes......
Is the key 'XXXX' in the same location (if present) in all records?
If so, just sort copy and add a sequence number to the record inrec and include in outfil and reformat to print the seqnum in output.
Remember, on input, the include/omit processing is done prior to the inrec formatting..... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Ajay,
You can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
rec1 ................................
rec2 ................................
rec3 ...................xxxx......
rec4 ................................
rec5 ................................
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(81:SEQNUM,8,ZD)
OUTFIL INCLUDE=(25,4,CH,EQ,C'xxxx'),
BUILD=(81,8)
/*
|
|
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
Thans Frank and CICS Guy.
When i went home, i had got the same idea that you have given.
For my current requirement, i am going to use it.
But, i have a curiosity. When i am using simple sort card like:
//sysin dd *
option copy
include cond=(condition is FIELD1=VALUE...)
/*
Since it is becoming true only in one case (for one record only.)
So, the desired input record in the file gets a hit only once. Is there any particular field in SYSOUT message that can tell we got this hit after reading these may records in the input file.
I mean for example, can EXCP count or other field in the SYSOUT mesage help me determine straight forwardly when we got this hit.
There are 10 million records in the file. and Writing sequence no to each record will increase processign time. Friends, i am just sharing my view.
-Ajay |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Ajay,
Quote: |
I mean for example, can EXCP count or other field in the SYSOUT mesage help me determine straight forwardly when we got this hit. |
I do not understand your question. The output from Frank's solution should give "when we got this hit". What additional info would you like to be able to find in the SYSOUT? Keep in mind that if the solution was not used, there couldn't be any info about "where" the value was found in the SYSOUT. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Since it is becoming true only in one case (for one record only.)
So, the desired input record in the file gets a hit only once. Is there any particular field in SYSOUT message that can tell we got this hit after reading this many records in the input file.
There are 10 million records in the file. and Writing sequence no to each record will increase processign time. |
Ajay,
I showed you a DFSORT copy job that will satisfy your request that
Quote: |
I want 00000003 in o/p. |
It might run fast enough to satisfy you or it might not.
If you want to identify the record number with less processing, you could use this less direct DFSORT job which tells DFSORT to stop when it finds the record that meets the condition:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION COPY,STOPAFT=1
INCLUDE COND=(25,4,CH,EQ,C'xxxx')
/*
|
You would get a message in //SYSOUT like this:
ICE054I 0 RECORDS - IN: 200000, OUT: 1
The IN value would be the number of the record that met the condition.
If you need that number in an output record, you could extract it from the ICE054I message using INCLUDE and PARSE processing against the message data set.
You could try both ways and see which satisfies your request better. |
|
Back to top |
|
|
Ajay Baghel
Active User
Joined: 25 Apr 2007 Posts: 206 Location: Bangalore
|
|
|
|
Thanks Frank. The 2nd answer suits more to my requirement since i don't want to continue searching file after i get a hit.
-Ajay |
|
Back to top |
|
|
|