Switch multiple indicatos On/Off using RPG IV

195 pts.
Tags:
AS/400
RPG
RPG Code
I have to switch on/off multiple indicators . I have a code like this DdSTestind Ds Qualified Based(Indptr) D dVInd01 N D dVInd02 N D dVInd03 N D dVInd04 N D dVInd05 N D dVInd06 N D dVInd07 N D dVInd08 N D dVInd09 N D dVInd10 N DdSTestin Ds Qualified D dVInd01 N D dVInd03 N D dVInd05 N D dVInd07 N D dVInd09 N C Eval dsTestind= *On C Eval dsTestin = *Off C Eval *Inlr = *On But when i debug i got like this. > EVAL dsTestind DSTESTIND.DVIND01 = '0' DSTESTIND.DVIND02 = '0' DSTESTIND.DVIND03 = '0' DSTESTIND.DVIND04 = '0' DSTESTIND.DVIND05 = '0' DSTESTIND.DVIND06 = '1' DSTESTIND.DVIND07 = '1' DSTESTIND.DVIND08 = '1' DSTESTIND.DVIND09 = '1' DSTESTIND.DVIND10 = '1' > EVAL dsTestin DSTESTIN.DVIND01 = '0' DSTESTIN.DVIND03 = '0' DSTESTIN.DVIND05 = '0' DSTESTIN.DVIND07 = '0' DSTESTIN.DVIND09 = '0' But i need : DSTESTIND.DVIND01 = '1' DSTESTIND.DVIND02 = '1' DSTESTIND.DVIND03 = '1' DSTESTIND.DVIND04 = '1' DSTESTIND.DVIND05 = '1' Can anybody help me regarding this issue.

Software/Hardware used:
RPG IV

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    When you debug, what statement did you stop on? What does the rest of the program look like? There's no way to predict results if we can't see what runs and how everything is defined. . Tom
    125,585 pointsBadges:
    report
  • Sasikumarr
    I have written the following code: DIndptr S * Inz(%Addr(dSTestin)) DdSTestind Ds Qualified Based(Indptr) D dVInd01 N D dVInd02 N D dVInd03 N D dVInd04 N D dVInd05 N D dVInd06 N D dVInd07 N D dVInd08 N D dVInd09 N D dVInd10 N D dVInd01 N D dVInd03 N D dVInd05 N D dVInd07 N D dVInd09 N C Eval dsTestind= *On C Eval dsTestin = *Off C Eval dSTestin.dVInd07 = *On C Eval *Inlr = *On after debugging this following line C Eval dsTestind= *On I got like this > EVAL dsTestind DSTESTIND.DVIND01 = '1' DSTESTIND.DVIND02 = '1' DSTESTIND.DVIND03 = '1' DSTESTIND.DVIND04 = '1' DSTESTIND.DVIND05 = '1' DSTESTIND.DVIND06 = '1' DSTESTIND.DVIND07 = '1' DSTESTIND.DVIND08 = '1' DSTESTIND.DVIND09 = '1' DSTESTIND.DVIND10 = '1' in the next line.... C Eval dsTestin = *Off EVAL dsTestin DSTESTIN.DVIND01 = '0' DSTESTIN.DVIND03 = '0' DSTESTIN.DVIND05 = '0' DSTESTIN.DVIND07 = '0' DSTESTIN.DVIND09 = '0' and then in the next line C Eval dSTestin.dVInd07 = *On I got output like this. DSTESTIN.DVIND07 = '1' > EVAL dsTestin DSTESTIN.DVIND01 = '0' DSTESTIN.DVIND03 = '0' DSTESTIN.DVIND05 = '0' DSTESTIN.DVIND07 = '1' DSTESTIN.DVIND09 = '0' EVAL dsTestind DSTESTIND.DVIND01 = '0' DSTESTIND.DVIND02 = '0' DSTESTIND.DVIND03 = '0' DSTESTIND.DVIND04 = '1' DSTESTIND.DVIND05 = '0' DSTESTIND.DVIND06 = '1' DSTESTIND.DVIND07 = '1' DSTESTIND.DVIND08 = '1' DSTESTIND.DVIND09 = '1' DSTESTIND.DVIND10 = '1' Can you explain why DsTestind changed when I am trying to change dsTestin only?
    195 pointsBadges:
    report
  • Sasikumarr
    Sorry I missed the code. dsTestin is also a Qualified data structure DdSTestin Ds Qualified D dVInd01 N D dVInd03 N D dVInd05 N D dVInd07 N D dVInd09 N
    195 pointsBadges:
    report
  • TomLiotta
    dSTestind looks to be declared as ten bytes of memory. And dSTestin is declared over only five bytes. . You show that dSTestind overlays the same memory as dSTestin (because it shares the address) plus five bytes after dSTestin (because it's five bytes longer). . But you don't show what those last five bytes of dSTestind are overlaying. There is no way to predict what might happen after your first statement alters dSTestind. It's lucky you didn't crash the program. . Everything in debug looks exactly right to me. . The values change in both variables because you declared them over the same memory. . Tom
    125,585 pointsBadges:
    report
  • Sasikumarr
    thank u for your explanation Tom.
    195 pointsBadges:
    report

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following