× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 25-Mar-2015 13:20 -0500, tim wrote:
I wrote a program that will create user profiles. I have a "copy"
function that first does a RTVUSRPRF, then fills in the values for
the CRTUSRPRF.

RTVUSRPRF USRPRF(&U) +
INLPGM(&INLPGM) +
INLPGMLIB(&INLPGMLIB) +
TEXT(&TEXT) +
INLMNU(&INLMNU) +
INLMNULIB(&INLMNULIB) +
ATNPGM(&ATNPGM) +
ATNPGMLIB(&ATNPGMLIB)

? crtUSRPRF +
??TEXT(&TEXT) +
??INLPGM(&inlpgmlib/&inlpgm) +
??INLMNU(&INLmnulib/&inlmnu) +
??ATNPGM(&atnpgmlib/&ATNPGM)

One problem I am having is when the initial program is *NONE. I get
the following:

Initial program to call . . > *NONE Name, *NONE
Library . . . . . . . . . > ' ' Name, *LIBL, *CURLIB

Value '*NONE ' for parameter INLPGM not a valid name.


The error msg CPD0078 F/QCAFLD was issued because "INLPGM( /*NONE)" _unfortunately_ is not recognized as the same as, having specified the lone single-value INLPGM(*NONE); i.e. as the Cause-text suggests, the specification was inappropriate per being "a _single value_ that was specified as part of a qualifier."

So the initial program field has embedded blanks at the end of the
field and the library value has 2 single quotes.

It almost seems I can't use the retrieved values to initialize the
CRTUSRPRF command.

Is there a way to make this work?

One possible solution when using that technique would be to conditionally construct those parameters with [effective] single-values so as to eliminate both the slash (/) character and the library-qualifier; construct each parameter specification as a character string to be successively concatenated to the command name to build a complete request command-string that is finally passed to a command interpreter such as QCAPCMD [or QCMDEXC]. The biggest problem with that however, and often overlooked, is the requirement to escape the apostrophe as a string delimiter; IIRC, I had written a procedure that used the SQL REPLACE scalar to do that to the command-string, and that likely is also available on the web. Anyhow, in that case, something like:

chgvar &TEXT_p ('??TEXT(' *tcat &TEXT *tcat ')')
if (&inlpgm *eq '*NONE') then(+
chgvar &INLPGM_p ('??INLPGM(*NONE)') )
else (+
chgvar &INLPGM_p ('??INLPGM(' *tcat &inlpgmlib *tcat '/' +
*tcat &inlpgm *tcat ')' ) )
[...]
chgvar &cmd_str +
( '?qsys/CRTUSRPRF' +
*bcat &TEXT_p +
*bcat &INLPGM_p +
*bcat [...]
[...]
callprc escape_str (&cmd_str) /* Escape apostrophes */
call qcmdexc (&cmd_str &cmd_len)

Note: Some parameters are not available via that Retrieve command interface; at least one might not be available using the Retrieve Prompt Override (QPTRTVPO) API.

FWiW the Display User Profile (DSPUSRPRF) output to a database file for the *BASIC Type Of Information (TYPE) gives much the same as the RTVUSRPRF interface, and a VIEW that encapsulates the building of the command string is an alternate way for a CLP to obtain a Create User Profile (CRTUSRPRF) command string from the retrieved data.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.