Build an enquiry driven to 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.
The concept is:
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
15. 1 USR.FIELD.NAME. RET.ID
16. 1 USR.TYPE....... D
17. 1. 1 USR.FIELD.NO 0
20. 1 USR.DISPLAY.FMT 1000L
24. 1 USR.SINGLE.MULT S
25. 1 USR.LANG.FIELD. N
15. 2 USR.FIELD.NAME. RTN.CALL
16. 2 USR.TYPE....... R
17. 2. 1 USR.FIELD.NO E.NOFILE.DX.CLOSEOUT
20. 2 USR.DISPLAY.FMT 10L
24. 2 USR.SINGLE.MULT S
25. 2 USR.LANG.FIELD. N
2. SUBROUTINE E.NOFILE.DX.CLOSEOUT(RETURN.ARRAY)
(...)
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
11. 1 FIELD.NAME..... RET.ID
12. 1. 1 OPERATION... RET.ID
14. 1 LENGTH.MASK.... 1000L
32. 1 SINGLE.MULTI... S
11. 2 FIELD.NAME..... POS.KEY
12. 2. 1 OPERATION... F RET.ID
13. 2 COLUMN......... 1
15. 2. 1 CONVERSION.. F *,1,1
19. 2. 1 GB FIELD.LBL Key
32. 2 SINGLE.MULTI... S
11. 3 FIELD.NAME..... POS.DATE
12. 3. 1 OPERATION... F RET.ID
13. 3 COLUMN......... 2
15. 3. 1 CONVERSION.. F *,2,1
(...)
