From: Willie Moore To: All
I am having trouble getting the user ID into an RPG/400 program. I have the CL setup like this:
DCL VAR(&USER) + TYPE(*CHAR) + LEN(10) RTVJOBA USER(&USER)
The RPG program shows:
I UDS I 1 10 USER
I think I like the S/36 RPG better!
From: David Knittle To: Willie Moore
You are forgetting one step. First you retrieve the user ID into a CL variable, then try to access the user ID from the LDA. You must place the user ID intro into the LDA in order to retrieve it from the LDA. Your CL should look more like this:
DCL VAR(&USER) + TYPE(*CHAR) + LEN(10) RTVJOBA USER(&USER) CHGDTARA DTAARA(*LDA) + VALUE(&USER)
At this point the user ID will be in the LDA where your RPG should have no trouble finding it.
From: Ernie Malaga To: Willie Moore
In RPG/400 there's a much easier method which doesn't involve the RTVJOBA command or passing parameters/LDA to the RPG program. Use the Program Status Data Structure in your RPG program, as follows:
I SDS I 254 263 USRPRF
Field USRPRF will contain the name of the user profile under which the job is running. The PSDS contains other information that you may find useful. I recommend you read pages 2-44 and 2-45 of the RPG Reference Guide (V2R1, SC09- 1349).
LATEST COMMENTS
MC Press Online