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

Need to find the record no where i find my key value


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Sat Apr 12, 2008 9:45 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat Apr 12, 2008 10:02 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Sun Apr 13, 2008 4:50 am
Reply with quote

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
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Sun Apr 13, 2008 4:48 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Apr 13, 2008 5:02 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Sun Apr 13, 2008 9:44 pm
Reply with quote

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
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 206
Location: Bangalore

PostPosted: Tue Apr 15, 2008 6:44 pm
Reply with quote

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
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 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top