Build An Enquiry With A Nofile
Build An Enquiry With A Nofile
wikibanking.info/2012/08/build-an-enquiry-with-a-nofile/
When you can’t use standard conversion / calculation functions to get what you need in
an Enquiry, you still have a programming solution. It occurs typically when you need data
spread in multiple tables, because ENQUIRY tool is single-table driven. You can use links
to other tables when you have foreign keys in the requested table, but no more.
Using a subroutine and a NOFILE, you have no limitations to get data among multiple
tables.
1. Target enquiry to a virtual table e.g. “a NOFILE” and named NOFILE.xxx depending
on the business context.
2. Declare a call of a subroutine in a field of this NOFILE.xxx, through its dictionary (in
STANDARD.SELECTION).
3. The subroutine will select all needed data and fill a dynamic array returned , including a
delimiter of your choice.
4. In the ENQUIRY, you get all needed data by extracting values between each delimiter.
Example :
1. STANDARD SELECTION
FILE.NAME......... NOFILE.DX.CLOSEOUT
2. SUBROUTINE E.NOFILE.DX.CLOSEOUT(RETURN.ARRAY)
1/2
(...)
TEMP.DATA = POS.KEY : "*" : POS.DATE : "*" : POS.CONTRACT : "*" : POS.MATURITY
: "*" : POS.CURR : "*" etc...
RETURN.ARRAY<-1> = TEMP.DATA
(...)
3. ENQUIRY
ENQUIRY........... DX.CLOSEOUT.FINAL.FUT.HIS
---------------------------------------------------
1 PAGE.SIZE ........ 4,19
2 FILE.NAME......... NOFILE.DX.CLOSEOUT
3. 1 FIXED.SELECTION RTN.CALL NE NULL
2/2