DATAAREA

20 pts.
Tags:
AS 400
Data Area
RPGLE
I have a variable that contains the name of a data area How can I access the data area? Without using CL

Software/Hardware used:
AS400
ASKED: May 22, 2013  9:03 AM
UPDATED: May 22, 2013  10:11 AM

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: 9  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
  • CharlieBrowne
    You can use RPG to retrieve and/or up[date the contents of a *DTAARA If you have not done this before, look in the RPG reference manual and scan for DTAARA
    39,815 pointsBadges:
    report
  • TomLiotta
    Why no CL? It makes for a perfectly valid module that you can bind to your RPG.
    .
    But if you must, you can call the Retrieve Data Area (QWCRDTAA) API to retrieve the value.
    .
    Tom
    125,585 pointsBadges:
    report
  • ravula
    you can achive this using a simple rpg program Dmyda s 4s 0 dtaara(myda) C *lock in myda C myda dsply C eval myda=myda+1 C out myda C eval *inlr=*on C return
    690 pointsBadges:
    report
  • TomLiotta
    Technically, this could be an interview question, and the answers given most likely do not satisfy the intent of the question. CharlieBrowne's response is probably appropriate, i.e., "Look it up." . The latest response won't work because it doesn't reference a variable for the data area name. And my earlier response almost certainly would not be expected by the interviewer even though it could work. . The most likely correct answer can be found simply by reading it in the manual, including the on-line HTML version for the oldest supported version. . Tom
    125,585 pointsBadges:
    report
  • Splat
    WRKDTAARA works too.
    6,255 pointsBadges:
    report
  • TomLiotta
    WRKDTAARA works too.
    .
    How would RPG use WRKDTAARA to access a data area value when the data area name is in a RPG variable?
    .
    Tom
    125,585 pointsBadges:
    report
  • Splat
    QCMDEXC or QCAPCMD.
    6,255 pointsBadges:
    report
  • TomLiotta
    Using WRKDTAARA in RPG via QCMDCHK or QCAPCMD can allow an interactive program to display a *DTAARA for the user to access. However, it doesn't provide access to the program. If direct access by the user is desired, then WRKDTAARA can be used. The OP didn't say what kind of "access" was needed. . Tom
    125,585 pointsBadges:
    report
  • MDratwa
    Create a CL program (which can be called from multiple programs, if needed). 1. Pass 2 parm (function, variable) 2. ALCOBJ *excl (to lock it) 3. if function = "R" (to retreive it) use "RTVDTAARA" in variable 4. if function = 'U" (to update it) using "CHGDTAARA using variable 5. DLCOBJ (to unlock it) 5. return Note: If this CL program is used in multiple programs, the retrieved value may not be the value if you want to update it later (so you may want to modify the "update" to retrieve first and then update the current value)..
    785 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