Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 205
Location: Bangalore

PostPosted: Sat Apr 12, 2008 9:45 pm    Post subject: Need to find the record no where i find my key value
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: 2150
Location: At my coffee table

PostPosted: Sat Apr 12, 2008 10:02 pm    Post subject:
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 Moderator


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

PostPosted: Sun Apr 13, 2008 4:50 am    Post subject:
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: 205
Location: Bangalore

PostPosted: Sun Apr 13, 2008 4:48 pm    Post subject: Reply to: Need to find the record no where i find my key val
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

Site Director


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

PostPosted: Sun Apr 13, 2008 5:02 pm    Post subject:
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 Moderator


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

PostPosted: Sun Apr 13, 2008 9:44 pm    Post subject:
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: 205
Location: Bangalore

PostPosted: Tue Apr 15, 2008 6:44 pm    Post subject: Reply to: Need to find the record no where i find my key val
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Find out a active PGM jpsager JCL & VSAM 10 Fri Oct 07, 2016 4:32 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us