简体   繁体   中英

Selection of records in RPGLE subfile program

I have a rather interesting problem at hand. There is a subfile program that displays certain Manufacturing order records and details stored in a file(say FILEA). The program uses RPG operations to read and display the data in the file.

A new requirement has come up to filter out the displayed MOs based on some criteria. The criteria is not straightforward and does not depend on direct field values of FILEA. Rather it depends on a complex set of rules that needs some calculations.

Now, there is another program(say PGMLOGIC) which filters out MOs based on these rules and puts them in an outfile.

What I have in mind is to come up with some sort of mechanism where I can utilise this existing program PGMLOGIC and to obtain the required MOs in the outfile as it usually does. Once this outfile is created with the required records, I want to make the subfile RPG to display only those MOs in the outfile created by PGMLOGIC and FILEA.

I know that this can be done by modifying the subfile program to do a condition check to see if the MO in FILEA is present in the outfile as well before displaying.

However I am interested to know as this is a matter of record selection, can this done in some other way like OPNQRYF etc?

The sequence of steps then would be:

1) Call PGMLOGIC to create outfile. 2) Do an override on FILEA to select only those MOs which are present in the outfile. 3) Call the subfile program.

Is something like this possible?

Thanks for all the replies. I do have a solid plan in mind which I think is suitable for this scenario. So the plan is to call the program which creates the outfile with the required mos. join it with FILEA to create a new temporary outfile. Override FILEA to the new temp file. Call the sub file program. This will now display only the required mos.

I think for what you are doing, it may look cleaner and be easier to understand if you instead make the program an SQLRPGLE and do an inner join between FILEA and the created outfile. Just a thought though, what you are planning on doing should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM