----- Original Message -----
From: "BirgittaHauser" <Hauser@xxxxxxxxxxxxxxx>
Sent: Friday, February 15, 2008 10:27 AM
Subject: AW: Encapsulation - Service Programs, Procedures, SQL, LDA, etc.
You could always use host variables locally.
We are at V5R4, all recent PTFs, and I cannot compile due to the 'Host Name
Not Unique' error. I have a data structure setup in a global D-spec, and my
local procedures use LikeDs() to create a local copy. Both procedures in
the example below use the exact same name and declaration.
Am I missing something?
Thanks,
JD
HNOMAIN OPTION(*NODEBUGIO : *SRCSTMT)
D l_QAOKP01A e ds extname(QAOKP01A) qualified
D l_TDNOTES e ds extname(TDNOTES) qualified
Dl_DirEDs ds qualified inz
D DirE like(l_QAOKP01A.WOS1DDEN)
D DirGrp like(l_QAOKP01A.WOS1DDGN)
DGetUsrDirE pr like(l_DirEDs)
D UserID like(l_QAOKP01A.WOS1USRP) const
D options(*nopass)
DTskAddLog pr n
D NteTyp const like(l_TDNOTES.NteTyp)
D NteId const like(l_TDNOTES.NteId)
D NteTxt const like(l_TDNOTES.NteTxt)
//--------------------------------------------------------------------
// PROGRAM NO: GetUsrDirE
//--------------------------------------------------------------------
PGetUsrDirE b export
DGetUsrDirE pi like(l_DirEDs)
D UserID like(l_QAOKP01A.WOS1USRP) const
D options(*nopass)
D DirEDs ds likeds(l_DirEDs) inz
/free
// If User passed, use it
if %parms() = 1;
exec sql
Select
WOS1DDEN, WOS1DDGN
Into
:DirEDs.DirE, :DirEDs.DirGrp
From
QUSRSYS/QAOKP01A
Where
WOS1USRP = :UserID;
else;
exec sql
Select
WOS1DDEN, WOS1DDGN
Into
:DirEDs.DirE, :DirEDs.DirGrp
From
QUSRSYS/QAOKP01A
Where
WOS1USRP = USER;
endif;
// Return result
return DirEDs;
/end-free
PGetUsrDirE e
//--------------------------------------------------------------------
// PROGRAM NO: TskAddLog
//--------------------------------------------------------------------
PTskAddLog b export
DTskAddLog pi n
D NteTyp const like(l_TDNOTES.NteTyp)
D NteId const like(l_TDNOTES.NteId)
D NteTxt const like(l_TDNOTES.NteTxt)
D DirEDs ds likeds(l_DirEDs) inz
/free
// Get User
DirEDs = GetUsrDirE();
// Insert Note record
exec sql
Insert Into
TDNOTES
(NteTyp, NteId, NteDT, NteUsr, NteLin, NteTxt)
Values(
:NteTyp, :NteId, CURRENT TIMESTAMP,
:DirEDs.DirE, 1, :NteTxt);
Return (SQLCOD = *zero);
/end-free
PTskAddLog e
As an Amazon Associate we earn from qualifying purchases.