Traagen
Traagen

Reputation: 41

In what ways can I use the DUP keyword in DDS for the IBMi?

TLDR

In what ways can I define DUP in a DDS file that I haven't tried?

Note: I don't care about the RPG to hook it up. I'm only looking at the Display File definition.

In a perfect world, someone out there knows exactly what I need to get the 0x06 keyword on a field when reading in the results of calling the QDFRTVFD api.

I'll take any suggestions for DDS to try, particularly unusual ones. At this point, I'm not sure if the api is bugged or the documentation is wrong, or if I'm just missing something.

Background:

I'm working on fixing a bug in a C++ class that calls the QDFRTVFD api ([https://www.ibm.com/docs/en/i/7.3?topic=ssw_ibm_i_73/apis/qdfrtvfd.html) from IBM and parses the returned buffer. The bug was in a method that handles a particular category of keywords. Basically, we misunderstood the api documentation (or it is just plain wrong), and cast some of the keywords to the wrong size data structure, throwing off our pointer arithmetic. I am now manually testing each keyword in the affected category to make sure that we're using the correct data structure for each. Here's the list:

Category 22 (Miscellaneous Field-Level Keywords)

The following table shows the keyword ID that corresponds to miscellaneous field-level keywords. Not all keywords require a structure. There are no structures for keyword IDs X'01', X'02', X'03', X'04', X'05', X'06' and X'07'.

ID Keyword ID Keyword
0x01 PUTRETAIN 0x10 MSGID
0x02 OVRDTA 0x15 ERRMSG
0x03 OVRATR 0x16 ERRMSGID
0x04 BLANKS 0x17 DSPATR(PFLD)
0x05 CHANGE 0x18 DATTIMFMT
0x06 DUP 0x19 DATTIMSEP
0x07 DUP 0x1A DATE
0x1B MAPVAL

I have been able to generate all of the above keywords except for 0x06 DUP. The documentation does not make it clear what the difference between 0x06 and 0x07 is. I can generate a 0x07 by defining the DUP keyword with a Response Indicator. For example, this field definition gives me 3 category 22 keywords, 0x04, 0x05, and 0x07:

     A            FLD4           5A  B  4 30BLANKS(12) 
     A                                      DUP(04) 
     A                                      CHANGE(06) 

I thought that since some keywords take response indicators and some don't, and because DUP can be defined with and without an indicator, that 0x07 must be DUP with an indicator and 0x06 must be DUP without an indicator. However, when I tried to define a field with DUP with no indicator, the result was no category 22 keyword at all. For example, if I remove the (04) from the above example, I only get 2 category 22 keywords, not 3.

Here is my current test DDS source. It just defines a bunch of fields with various combinations of keywords. Most are from the above list, but there are some others there as well as I was testing other categories too.

     A                                      REF(SUBFILE3) 
     A                                      DSPSIZ(24 80 *DS3) 
     A                                      PRINT 
     A                                      INDARA 
     A                                      CA03(03 'F3=EXIT') 
     A          R SCRN                      OVERLAY 
     A            FLD1           5   B  3  2CHANGE(41) 
     A                                      PUTRETAIN 
     A  48                                  DSPATR(HI) 
     A                                  2 20'SOMETHING SOMETHING SOMETHING' 
     A                                      PUTRETAIN 
     A            FLD2          15   B  3 50 
     A                                      CHANGE(25) 
     A            FLD3           5Y 0B  4 10BLANKS(10) 
     A  49                                  DSPATR(RI) 
     A                                      CHANGE(15) 
     A                                      PUTRETAIN 
     A            FLD4           5A  B  4 30BLANKS(12) 
     A                                      DUP(04) 
     A                                      CHANGE(06) 
     A            FLD5           5   B  4 50COLOR(BLU) 
     A  50                                  DSPATR(RI) 
     A  51                                  DSPATR(PC) 
     A          R SCRN2                     PUTOVR 
     A            FLD6           6   B  5  2DFT('FOOBAR') 
     A                                      OVRDTA 
     A                                      CHANGE(03) 
     A                                      DUP(09 'comment') 
     A  20        FLD7           5   B  5 20DSPATR(BL) 
     A  21                                  DSPATR(RI) 
     A                                      OVRATR 
     A                                      OVRDTA 
     A                                      DFT('MEH!!') 
     A            FLD8          25   O  5 50MSGID(*NONE) 
     A            FLD9          25   B  6  2CHANGE(47) 
     A  60                                  ERRMSG('TEST1' 60) 
     A  66                                  ERRMSG('TEST2' 66) 
     A  63                                  ERRMSGID(MSG2000 TEST 63) 
     A            FLD10           L  B  7  2DATFMT(*JOB) 
     A                                      CHANGE(72) 
     A            FLD11           T  B  7 20TIMFMT(*EUR) 
     A                                      CHANGE(73) 
     A            FLD12           T  B  7 40TIMFMT(*HMS) TIMSEP('.') 
     A                                      CHANGE(81) 
     A            FLD13           L  B  7 60DATFMT(*DMY) DATSEP('-') 
     A                                      CHANGE(82) 
     A                                  8  2DATE(*SYS) 
     A                                  8 12DATE(*Y) 
     A            FLD14           L     8 24DATFMT(*MDY) DATSEP('/') 
     A                                      MAPVAL(('06/17/95' *BLANK)) 
     A            FLD15         10   B  9  5COLOR(BLU) 
     A  70                                  DSPATR(RI) 
     A  71                                  DSPATR(PC) 
     A                                      OVRDTA 
     A                                      DFT('My value') 
     A            FLD16          5Y 0B  9 25 
     A  65                                  DSPATR(HI) 
     A                                      DSPATR(&PFLD1) 
     A            PFLD1          1A  P 
     A            FLD17          3A  I 10  5DUP 

Some variations I have tried for defining DUP:

  1. As in FLD4 above, no option indicator but with a response indicator (result: 0x07)
  2. As in FLD17 above, no option indicator and no response indicator (result: no keyword)
  3. With an option indicator and a response indicator (result: 0x07)
  4. With an option indicator and no response indicator (result: no keyword)
  5. On a field in a subfile record with response indicator (result: 0x07)
  6. On a field in a subfile record, no response indicator (result: no keyword)
  7. The above fields are character fields. I also tried a numeric, which requires the response indicator (result: 0x07)
  8. Tried setting the USRDSPMGT file-level keyword for System/36 functionality and retrying the above variations again. (result: no change)
  9. Tried the CLRL record level keyword with USRDSPMGT. (result: no change)
  10. Tried setting CHANGE, COMP, RANGE, and VALUE validation keywords with the DUP keyword. (result: no change)
  11. Tried all field data types defined here: https://www.ibm.com/docs/en/i/7.4?topic=35-valid-entries-display-files with response indicator. (result: 0x07)
  12. Tried all field data types without response indicator. (result: no keyword)

Upvotes: 4

Views: 105

Answers (3)

stenag
stenag

Reputation: 114

If you are doing SHIFT-Insert for DUP, can you try SHIFT-Insert on the numpad?

keyboard map

Upvotes: 0

Charles
Charles

Reputation: 23813

This is just a WAG after a brief perusal of the API docs ...

But I noticed a lot of

DUP keyword ... on a numeric field

Have you tried the DUP keyword on a numeric field with and without the indicator?

Upvotes: 1

Barbara Morris
Barbara Morris

Reputation: 3674

Just a wild guess ... the doc says "See System/36 environment considerations for display files for special considerations when specifying the DUP keyword in files that are used in the System/36 environment."

https://www.ibm.com/docs/pt/i/7.4?topic=files-system36-environment-considerations-display

That page says "The User Display Management (USRDSPMGT) keyword causes the record formats in the display file to function similarly to System/36 SFGR display formats."

Maybe you'll get a different ID for the DUP keyword if you add USRDSPMGT to the keywords.

BTW, kudos on what is probably the best-written stackoverflow post I have ever seen :-)

Upvotes: 2

Related Questions