You can use RTVOBJD on the object to get the asp device for it.

RTVOBJD OBJ(&INLIB/&INOBJ) OBJTYPE(&INTYPE) +
RTNLIB(&OBJLIB) OBJATR(&OBJATTR) OBJASPDEV(&ASPDEV)
MONMSG MSGID(CPF0000) EXEC(GOTO ENDPGM)

IF COND(&ASPDEV *NE '*SYSBAS' ) THEN(DO)
CHGVAR VAR(&P_PATH) VALUE('/' || %Trim(&ASPDEV) || +
'/QSYS.LIB/ALIB.LIB/OUT.FILE/OUT.MBR')
ENDDO
ELSE CMD(DO)
CHGVAR VAR(&P_PATH) +
VALUE('/QSYS.LIB/ALIB.LIB/OUT.FILE/OUT.MBR')
ENDDO


I use this code in a command that retrieves the object path for any object.
You could add this command to the programs that needed to set a QSYS.LIB path and then when the object moves to the IASP the command returns the proper path.

WOBJPATH OBJ(&SAVELIB/&SAVEFILE) MBR(*FIRST) PATH(&FILE)
CPYTOSTMF FROMMBR(&FILE) TOSTMF(...)

There would be no hard coding of specific libraries. The command just returns the path for any object.

/* command */
CMD PROMPT('Return QSYS Object Path')

PARM KWD(OBJ) TYPE(QUAL1) PROMPT('Object' 1) MIN(1)


QUAL1: QUAL TYPE(*NAME) LEN(10) EXPR(*YES) CHOICE('Name') +
INLPMTLEN(10)
QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) SPCVAL((*LIBL +
*LIBL) (*CURLIB *CURLIB)) EXPR(*YES) CHOICE('Name, +
*LIBL, *CURLIB') INLPMTLEN(10) PROMPT('Library')

PARM KWD(OBJTYPE) TYPE(*CHAR) LEN(7) DFT(*FILE) +
EXPR(*YES) PASSVAL(*DFT) PROMPT('Object type')

PARM KWD(MBR) TYPE(*NAME) LEN(10) DFT(*FIRST) +
SPCVAL((*FIRST *FIRST) (*ALL *ALL)) EXPR(*YES) +
CHOICE('Name, *FIRST, *ALL, *NONE') INLPMTLEN(10) +
PROMPT('File Member')

/* Program */
PGM PARM(&P#OBJQ &P#TYPE &P#MBR &P#PATH)

DCL VAR(&P#PATH) TYPE(*CHAR) LEN(4096)
DCL VAR(&P#OBJQ) TYPE(*CHAR) LEN(20)
DCL VAR(&P#MBR) TYPE(*CHAR) LEN(10)
DCL VAR(&P#TYPE) TYPE(*CHAR) LEN(7)

DCL VAR(&P_PATH) TYPE(*CHAR) LEN(4096)
DCL VAR(&INOBJ) TYPE(*CHAR) LEN(10)
DCL VAR(&INLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&INMBR) TYPE(*CHAR) LEN(10)
DCL VAR(&INTYPE) TYPE(*CHAR) LEN(7)
DCL VAR(&OBJLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&OBJMBR) TYPE(*CHAR) LEN(10)
DCL VAR(&ASPDEV) TYPE(*CHAR) LEN(10)
DCL VAR(&OBJATTR) TYPE(*CHAR) LEN(10)



/*----------------------------------------------------------------------------*/
/* Setup Completed. */
/*----------------------------------------------------------------------------*/
CHGVAR VAR(&P_PATH) VALUE(' ')

/* Break up qualified input file/library names to separate fields */
CHGVAR VAR(&INOBJ) VALUE(%SST(&P#OBJQ 1 10))
CHGVAR VAR(&INLIB) VALUE(%SST(&P#OBJQ 11 10))
CHGVAR VAR(&INMBR) VALUE(&P#MBR)
CHGVAR VAR(&INTYPE) VALUE(&P#TYPE)

IF COND(&INLIB *EQ ' ') THEN(CHGVAR VAR(&INLIB) +
VALUE('*LIBL'))
IF COND(&INMBR *EQ ' ') THEN(CHGVAR VAR(&INMBR) +
VALUE('*FIRST'))
IF COND(&INTYPE *EQ ' ') THEN(CHGVAR VAR(&INTYPE) +
VALUE('*FILE'))

RTVOBJD OBJ(&INLIB/&INOBJ) OBJTYPE(&INTYPE) +
RTNLIB(&OBJLIB) OBJATR(&OBJATTR) OBJASPDEV(&ASPDEV)
MONMSG MSGID(CPF0000) EXEC(GOTO ENDPGM)

IF COND(&ASPDEV *NE '*SYSBAS' ) THEN(DO)
CHGVAR VAR(&P_PATH) VALUE('/' || %Trim(&ASPDEV))
ENDDO


CHGVAR VAR(&P_PATH) VALUE(&P_PATH *TCAT '/QSYS.LIB')

CHGVAR VAR(&P_PATH) VALUE(&P_PATH *TCAT '/' *CAT &OBJLIB +
*TCAT '.LIB')

CHGVAR VAR(&P_PATH) VALUE(&P_PATH *TCAT '/' *CAT &INOBJ)

CHGVAR VAR(&P_PATH) VALUE(&P_PATH *TCAT '.' *CAT +
%SST(&INTYPE 2 6))

IF COND(&INTYPE *EQ '*FILE') THEN(DO)
RTVMBRD FILE(&INLIB/&INOBJ) MBR(&INMBR) RTNMBR(&OBJMBR)
MONMSG MSGID(CPF0000) EXEC(DO)
CHGVAR VAR(&P_PATH) VALUE(' ')
GOTO ENDPGM
ENDDO

CHGVAR VAR(&P_PATH) VALUE(&P_PATH *TCAT '/' *CAT +
&OBJMBR *TCAT '.MBR')

ENDDO

ENDPGM:
CHGVAR VAR(&P#PATH) VALUE(&P_PATH)
RETURN

ENDPGM

Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Dan
Sent: Monday, May 8, 2017 8:29 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: iASP causing commands to fail

In our team meeting this morning, the developer in charge of implementing our DR solution described a problem in testing the CPYTOSTMF command. When a library that is specified in the FROMMBR parameter is moved to an iASP, the command no longer works unless the existing FROMMBR parameter is prefaced with the name of the iASP. For example,
FROMMBR('/QSYS.LIB/ALIB.LIB/OUT.FILE/OUT.MBR')
must be changed to
FROMMBR('/MEDIASP/QSYS.LIB/ALIB.LIB/OUT.FILE/OUT.MBR')

Furthermore, he implied that there is no way to programmatically determine whether an object is in an iASP and/or the name of the iASP. Since I have no experience with iASPs, I can't vouch for the veracity of that, but it seems unlikely to me that IBM didn't give us a way to make that determination. From this implication, he believes that we won't be able to change the hundreds of our programs that use CPYTOSTMF until and immediately following moving the affected libraries to the iASP.

The help text is silent on this matter, other than sending me on a fishing
expedition: For more information on specifying path names, refer to "Object naming rules" in the CL topic collection ... <in Infocenter>", where I am led to the "Programming CL overview and concepts" manual and, specifically, the section labeled "Object naming rules". Nothing on iASPs.

Is there a simple way to determine whether an object is in an iASP and, if it is, the name that must be used in the FROMMBR parameter? Are there other commands that we will find this same issue?

- Dan
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.