Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Example of use of *LDA in RPG program

Status
Not open for further replies.

francoisf

Programmer
Feb 11, 2004
30
0
0
FR
Hi,
i've heard about an object named *LDA
I've been told that it was a data area, and that it was used like a data area in CL programs.
How can i read, write or update data of *LDA from RPG400 program ?

Thanks in advance !

 
Yes there is, and it is a wonderful thing.. I am sure othere here will show you different ways to use the LDA (Local Data Area). but here is just one,, starting first with CL, and then going to RPG.

DCL VAR(&RFDAT) TYPE(*CHAR) LEN(6)
DCL VAR(&TFDAT) TYPE(*CHAR) LEN(6)
SNDUSRMSG MSG('ENTER MONTH BEGIN DATE - MMDDYY') +
TOMSGQ(*) MSGTYPE(*INQ) MSGRPY(&RFDAT)
SNDUSRMSG MSG('ENTER MONTH ENDING DATE - MMDDYY') +
TOMSGQ(*) MSGTYPE(*INQ) MSGRPY(&TFDAT)
CHGDTAARA DTAARA(*LDA (1 6)) VALUE(&RFDAT)
CHGDTAARA DTAARA(*LDA (7 6)) VALUE(&TFDAT)

OVRDBF FILE(LABORP) TOFILE(*LIBL/LABORP) SHARE(*YES)



I UDS
I 1 60FDATE
I 7 120TDATE


The above 2 fields are the date fields reference via the CL.




 
francoisf,

LDA has been used by AS400 since it was introduced. Actually now I remember this function was already in S/34, s/36 and a s/38 which was the forerunner of AS400. LDA is mostly used as common parametric(variables) repository in which several programs can share it's contents and update it. Sometimes we used it as run controls for batch processing. Even today's programming this function is still in use. the first time I used it was in conjunction with system variables. I created a program such that when electricity is cut off the standby generator's software will send a message to AS400(system variables) that electricity is down and needs to be IPLed accordingly. This also gets phone numbers of on-call personell(from LDA) and dial out an emergency notification.
This gives us time to call operators to do a controlled IPL or we do it if we can access AS400 from home.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top