Passing parameters thru LDA

1150 pts.
Tags:
LDA
Local Data Area
RPG
RPG/400
Hi i want to know how the parameters can be passed from one RPG program to another RPG program using LDA.Please give me an example code. thanks Ram

Answer Wiki

Thanks. We'll let you know when a new response is added.

Two ways
////////////////////////////////////
RPG pgrom can control when
lda is broght in with the In operation – loads datastructure
updated with the out operation – puts datastructure into LDA

D LDAOpt UDS 512 DTAARA(*LDA)
D LdaBch# 1 6 0
D LdaRest 7 512

In LDAOpt;
LdaBch# = NextBatch#;
Out LDAOpt;

OR———-
When the UDS datastructure is unnamed
The fields are loaded from the LDA at initialization and written to the LDA at end

D UDS
D LDAF1 278 279
D LDAF2 280 282
D LDAF3 283 283
D LDAF4 284 284

Phil
/////////////////////////
The *LDA is part of the job stream. If you put data into it in one RPG or CL program it can be accessed the same way by any subsequent RPG or CL programs in the same job.

So if pgm1 has a UDS data structure defined
D UDS
D LDAF1 278 279

and puts a value in LDAF1 then prm2 in the same job can contrain the same definition
D UDS
D LDAF1 278 279

and use the data in LDAF1 from pgm1.

Phil

Discuss This Question: 6  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
  • ten2008
    Hi Phil thanks for your reply. But you didn't tell me how the LDA can be passed to the other RPG program, please elaborate on this...thanks
    1,150 pointsBadges:
    report
  • Gilly400
    Hi, You can also access the *LDA from CL programs using CHGDTAARA and RTVDTAARA. You can display the *LDA using DSPDTAARA. Note that the *LDA is job specific (just like the QTEMP library). Regards, Martin Gilbert.
    23,730 pointsBadges:
    report
  • RonKoontz
    It would be better to generate your own data area.. (CRTDTAARA).. Then poplate it with what you want. This way other apps that you may purchase in the future can use LDA and not screw you up... Example RPG pgm. create the data area with CRTDTAARA..... D PassLocal UDS Dtaara(EDIPSW) D PASSDTA 1 10 Begsr *inzsr IN(E) PassLocal; Endsr:
    1,780 pointsBadges:
    report
  • Ci400
    I have an LDA defined as UDS. One of the fields is QS1 in position 285. There is no move to update the value of this field yet when LR is set on there is a value of 'Y'. How does the Y get there if it is not moved?
    30 pointsBadges:
    report
  • TomLiotta
    But you didn’t tell me how the LDA can be passed ... You don't need to "pass" the *LDA between programs. Every job has a *LDA that can be accessed by any program in the job. The *LDA is automatically "passed" in that sense. The only real question, then, is how does an RPG program access the *LDA. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    How does the Y get there if it is not moved? Hard to say. We'd probably need to see the value of the *LDA before the program is called, the source for the program in question, the source for any programs called by that program and the value of the *LDA after the program completes. I would suggest that this is better handled in a new question that you create. Tom
    125,585 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