ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

how to define a 16mb field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to define a 16mb field

    I have a parameter bigger than the maximum allowed size 64375a, I have read that variables can be declared with a maximum of 16mb, what is the correct way to declare it?

    is it correct to do so?

    PHP Code:
    D                                 a   varying len(16773100
    Thanks!

  • #2
    If you want to use fixed format, I think you have to put the length in the correct columns. I've been using free so long I can't say for sure. I think you can prompt the line in RDi and that will show you where the length goes.

    Comment


    • CLSCoyote
      CLSCoyote commented
      Editing a comment
      Thank you very much, by customer standard, I cannot use full free.

  • #3
    It should work but why not use free-form?
    Code:
           dcl-s  bigOne varchar(16000000);
    It is possible that in fixed form you may need to specify varying(4) to indicate the need for a longer length portion - but the compiler should know that from the field length.

    Comment


    • CLSCoyote
      CLSCoyote commented
      Editing a comment
      Thank you!

  • #4
    Originally posted by JonBoy View Post
    It should work but why not use free-form?
    It is possible that in fixed form you may need to specify varying(4) to indicate the need for a longer length portion - but the compiler should know that from the field length.
    Yep, you'll find an example in IBM's "ILE RPG Reference" (Version 7.3)

    Code:
    D max_len_a       S               A   VARYING LEN(16773100)

    and this statement:

    If you specify VARCHAR, VARGRAPH, or VARUCS2
    without a second parameter, or VARYING without a parameter, a size of 2 is assumed if the specified
    length is between 1 and 65535; otherwise, a size of 4 is assumed.

    Comment


    • #5
      Are you getting an error on the fixed-format declare? If so, is the system current on OS & PTFs?

      Comment


      • #6
        The syntax of coding just the type A and using the LEN keyword has been supported since 6.1, before there was such a thing as free-form definitions. 6.1 was when 16 MB variables were first supported; the LEN keyword was needed because the length column only allows 7 digits.

        CLSCoyote's code is correct:
        Code:
        [COLOR=#000000][COLOR=#0000BB]D                                 a   varying len[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]16773100[/COLOR][COLOR=#007700])[/COLOR][/COLOR]

        Comment


        • #7
          Originally posted by Barbara Morris View Post
          The syntax of coding just the type A and using the LEN keyword has been supported since 6.1, before there was such a thing as free-form definitions. 6.1 was when 16 MB variables were first supported; the LEN keyword was needed because the length column only allows 7 digits.

          CLSCoyote's code is correct:
          Code:
          [COLOR=#000000][COLOR=#0000BB]D a varying len[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]16773100[/COLOR][COLOR=#007700])[/COLOR][/COLOR]
          Thanks Barbara,

          From what you say, I cannot declare this type of variables in a DS?

          Thank you

          Comment


          • #8
            You could - but there wouldn't be any point because the DS has to fit within the 16Mb range. No point in a DS with just one field.

            Comment


            • #9
              But you can define a subfield using the LEN keyword. Even if the length isn't bigger than 9,999,999.
              Code:
                   D ds              ds                           
                   D   subf                          a   len(100)

              Comment

              Working...
              X