Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Alternatives to a Work File?

Alternatives to a Work File?

Alternatives to a Work File?

Hey everyone.  I'm trying to think of ways to simulate a workfile without actually creating a physical file on the system.  I've used arrays and data structures in the past, but that was for small amounts of data; the file I am processing now will most likely have 10s of thousands of records, if not 100s of thousands.  The reason I need this "workfile" is because I have a file that needs to be sorted by company division, and this field is not included in the file that I am processing.  So I need to use the facility number in the file and look up the division it is under, and have the whole file sorted by division so that I can create a report.  One option that comes to mind is embedded SQL; I'm not entirely familiar with it, but I would like to learn more about it.  Do you guys know of any other options?  And if embedded SQL is the best option here, is there any good online documentation for it?


RE: Alternatives to a Work File?

Try using a data queue

RE: Alternatives to a Work File?

I'm not so sure that a data queue would work.  I need to have this file sorted by several more fields, not just the division.  Sorry for not specifying that earlier.

RE: Alternatives to a Work File?

If this is something that will run a lot, how about creating a join logical over the two physical files in question? (You can do the same thing with OPNQRYF, but the program will take longer to run because it will have to build its own access path every time).

Tibi gratias agimus quod nihil fumas.

RE: Alternatives to a Work File?

That actually sounds like a good idea if it will work.  I've never made a join logical before.  Basically what I have is one file that is my main data file that is going to used on the report.  This file only contains the region number and facility number, and not the division number.  So what I have to do is go out to another file, and chain (or join) based on the facility number to retrieve the division number.  But if I can do this all in one fowl swoop then that would be perfect.

RE: Alternatives to a Work File?

If you do it very often, a join LF is prob the best.  If you do it less often (such a a few times each day), you may be btter off with a SQL view.

CREATE VIEW file1j  as (select a.region, a.facility as facility, b.division from file1 A
left out join file2 B on a.facility = b.facility)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close