sponsored links



No announcement yet.

LDA update question

  • Filter
  • Time
  • Show
Clear All
new posts

  • LDA update question

    I have defined the *LDA in my program such that I explicitly update it with the OUT opcode. I have defined several subfields in posns 101-120
       dcl-ds Local dtaara(*lda);
             dsLocn char(2) pos(101);
             dsOrgUser char(10) pos(103);
             dsCurUser char(10) pos(111);
    Prior to calling the program the *LDA has value '99' in posns 1-2, but those posns are not defined in the program. However, when I clear the subfields explicitly defined in the *LDA and execute the OUT opcode, it also clears posns 1-2 even though posns 1-2 are not defined in the program. I tried populating '99' in posns 201-202 and it does not clear those posns upon execution of the OUT opcode. So,it looks like when the OUT is executed that all posns prior to the last one defined in the program are updated regardless whether they are defined or not.

      Clear dsLocn;
           Clear dsOrgUser;
           Clear dsCurUser;
           Out Local;
    Am I understanding this correctly or am I overlooking something

  • #2
    The LDA - the spawn of Satan! Abandon hope all yee who use it!

    That said - have you looked at the value of the DS in debug before and after you do the Clears? I don't see an IN operation in your code - I assume that you did that or the Out would fail on a lock error.


    • #3
      Even though you haven't defined fields in positions 1-100 of the data structure, it is still part of the data structure. If the data structure has its initial values of all blanks and you write it, it'll write positions 1-100 as blanks.

      Try defining a field in positions 1-2. then use IN to get the current values, clear the fields you want cleared, and then do OUT with the field in positions 1-2 left as it was read.