ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Variable Length Fields

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

  • Variable Length Fields

    I have acquired the responsibility of updating an existing program that needs to write records to a new file that has two variable length fields to the file.
    Everything works to the point of writing the actual data to the file. It runs the write statement and does not throw an error but no data is in the file. I know it has to have something to do with variable length fields in the file but have no idea what needs to be done differently. Can anyone give me some direction?
    File Name - BATCHWORK RECORD FORMAT is RBATCHWRK
    ID - Identifier 5.0
    BATDATE - Date of Batch 8.0
    BATCHNO - Batch Number 5.0
    BATCHSEQ - Batch Sequence # 5.0
    TXAMOUNT - Tx Amount 11.2
    TXCODE - TX CODE 2 A
    CID - CID 50 Variable allocate 10
    TXNOTE - TXNOTE 50 Variable allocate 10


  • #2
    There is nothing "extra" needed for varying length fields normally. Unless you are talking RPG400.

    When you say " but no data is in the file." do you mean that zero records are written - or that the varlen fields are empty?
    If the latter then is it possible that these fields are null capable and you have not set an appropriate value for the ALWNULL keyword and/or are not setting the null flags appropriately.

    Comment


    • #3
      Are you setting both the the data and length parts of the variable-length fields? TXNOTE-DATA and TXNOTE-LENGTH? If you only set TXNOTE-DATA and left TXNOTE-LENGTH at zero, then it would only use zero characters from TXNOTE-DATA when the record got written out to the file.

      Comment

      Working...
      X