Example: forn know a user from a cl program , I use
DCL VAR(&MIUSER) TYPE(*CHAR) LEN(10)
RTVJOBA USER(&MIUSER)
and for Know a name of cl program???
DCL VAR(&clname1) TYPE(*char) LEN(10)
RTV???? ????
THANKS
P.D. (My english is very poor)
DCL VAR(&SENDER) TYPE(*CHAR) LEN(80)
DCL VAR(&CLNAME1) TYPE(*CHAR) LEN(10)
SNDPGMMSG MSG('WHO AM I?') TOPGMQ(*SAME (*))
RCVMSG MSGTYPE(*LAST) SENDER(&SENDER) SENDERFMT(*SHORT)
CHGVAR VAR(&CLNAME1) VALUE(%SST(&SENDER 56 10))
The help text for the SENDERFMT parameter describes the format of the SENDER
variable.
Xisco <xisc...@teleline.es> wrote in message
news:8k2bk7$9e0$1...@talia.mad.ttd.net...
If you only need to know the *name* of the current CL program, you
can do:
SNDPGMMSG MSG('Ping') TOPGMQ(*SAME *)
RCVMSGvMSGTYPE(*LAST) SENDER(&SENDER)
CHGVAR &CLNAME1 %SST(&SENDER 56 10)
If you also need to know the name if the library that it's in, you
need the rather unpleasant:
/* Retrieve program name & library
*/
OVRDBF FILE(QPPGMDMP) TOFILE(QTEMP/NOSUCHFILE)
OVRSCOPE(*JOB)
DMPCLPGM
MONMSG MSGID(CPF0570) EXEC(DO)
RCVMSG MSGTYPE(*DIAG)
RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA)
CHGVAR VAR(&PGM) VALUE(%SST(&MSGDTA 1 10))
CHGVAR VAR(&PGMLIB) VALUE(%SST(&MSGDTA 11 10))
ENDDO
DLTOVR FILE(QPPGMDMP) LVL(*JOB)
Cheers,
Simon Brunning
TriSystems Ltd.
sbru...@trisystems.co.uk
The opinions expressed are mine, and are not necessarily those of my
employer. All comments provided "as is" with no warranties of any
kind whatsoever.