Input capable fields in AS/400 database file

765 pts.
This inquiry is regarding 'Usage' clause for physical and logical files (position 38). IBM manual says options in this position are: Blank, B, I and N. Here is a snippet of what I experimented unsuccessfully
R RZ0101R1

     F0 5A I
     F1 5P 2O
notice I and O in pos(38)
This gives me an error "Characters in indicated field not allowed" and doesn't allow both I & O. If I read the msg literally, my wild guess is: the issue is not I or O, the issue is some combination of usage and field type. Here is a list of my ignorance. I1: How to declare a field in PF as input or output only. Clearing this doubt would automatically clear another doubt in using the KW 'likerec' used in RPGLE.
dcl-ds rec likeRec(PFname: *input|*output|*all|*key).
I2. I assume unique key fields are implicitly input only, but not sure I'm right about that. Besides, some sensitive non-key fields can be declared as input, agreed. But why output only, why would someone push a data into O filed but never can read that, beats me. I am fairly conversant with DSPF, my ignorance is in DBF only. Would appreciate clearing the doubts

Software/Hardware used:
IBM i-series, OS/400, DB2

Answer Wiki

Thanks. We'll let you know when a new response is added.
In my 35+ years working with RPG I have never put a value in that position for any file I have defined. It has always been left blank which is the same as using a B for input & output.  If you prompt the line of code and move to that USE filed and do a help (F1) the definition states
Type B or leave the field blank to indicate a field used for both input
and output.                                                           

Discuss This Question: 5  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • azohawk

    I only use those fields in a display file. Using them in a physical file does not make sense. I suppose you could use B (Both input and output) instead of the way the example is, but why go to the extra work?

    Just thinking through this for a PF, if the field is input only, you can add data to the field, but never retrieve it. If it is output only, you can retrieve the data from the field, but never put data into the field. Either way the field is useless.

    Also note, you quote the manual as saying that acceptable characters are blank, I, B, and N. But your example shows an O which was not in the list. I am not sure where you found this, but when I look at the help file for this field for a physical file, it only shows me that blank and B are acceptable options.

    4,055 pointsBadges:
  • Splat
    If you define a field in a data file as output only how are you ever going to load data into it? All fields in a data file are implicitly available for input and/or output.
    12,915 pointsBadges:
  • deepu9321
    I/O never supposed to be with PF or LF, even SEU wont support it.

    Having '*INPUT/*OUTPUT on LikeRec also limited to Display file record formats? 
    4,980 pointsBadges:
  • anandx
    First, thanks Michael and azohawk for replying
    I am aware of what you have indicated.
    I am referring to IBM Manual'DDS reference:Physical and Logical files' pg 26 says for a PF only Blank and B are allowed. rollup to pg 27 - LF can have I which I put into test as follows:
    R RecX            PFILE(FILEX)
      FLD0     5A   I
    It doesn't cry when 'usage' is 'I' in LF
    so far so good.
    Issue comes up later. See the following code that I have used without an error, blissfully ignorant of the implication.
    dcl-ds pf_rec  likerec ( PF1: *input) dim(50) based(ptrx);
    PF1 is a PF, not a LF. This supposedly mean pick up ONLY input capable fields from PF1 and assign it to pf_rec. My nagging doubt is: If PF's DDS can have neither I not O, but LF can have I (but not O exclusively, anyway), then (a) why does the above code accepts *input for a PF and (b) why *output option in likeRec when both PF and LF cannot have exclusive O (output capable field like dspf). Please don't treat this as a mere academic question. I feel I'm missing something here, may be significat may be not.
    Thanks again
    765 pointsBadges:
  • anandx
    I saw the two other replies later. So, my extended belated comments
    (a) likeRec, I reckon, is basically for DBF, I am not sure why we wd use it for a dspf 
    (b) 'I' can be used for LF and it disallows changes to that field
    (c) there seems to be a crazy option called 'neither' which can be used in a JLF in JFLD and that field cannot be even read.
    Anyway, my qn is focused on likeRec which incidentally relates to DDS of DBF
    765 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: