Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
You want to know the particular "record number" of a selected record?
COPY operations.
INREC with WHEN=INIT, OVERLAY at end of record, for fixed, or BUILD at begining, for variable, a sequence number big enough for all the records on the file. Identify those records NOT the one you want (WHEN=(logexp), and OVERLAY the sequence number to zero.
OUTFIL OMIT those which are zero. The only one left is the record you want, with the its sequence number.
I've knocked that up quickly, and it is not tested, but around about what you are after. Gives you a chance to consult the manual and understand anything you don't already know how to use.
This is for a fixed-length 80-byte record. For a different fixed-length, change appropriately.
For variable, change first OVERLAY to BUILD=(1,4,SEQNUM,7,ZD,5) and change the 81's in the other OVERLAY and OMIT to 5.
The 7 in the SEQNUM allows for just under 10m records. Adjust appropriately to your file.
This is also easier if you need more flexibility, like more than one "key value" to search for.
Note you can use SS if you want to find a string somewhere.
You could also use it to exclude a selected record(s) from a file, with another OUTFIL with SAVE for all the other stuff on the original file, with a little reassurance of knowing the record number(s) dropped.