|
Chuck,
When I first read your original response, I thought it needed a command to
be created, which was not an option for me. A second reading opened my eyes.
Also, my lack of experience in using API's did not help.
I agree with you that my effort was poorly executed. I changed the program
as follows, and it seems to work:
PGM PARM(&MBR&FLG)
DCL VAR(&MBR) TYPE(*CHAR) LEN(10)
DCL VAR(&FLG) TYPE(*CHAR) LEN(1)
DCL VAR(&CMD) TYPE(*CHAR) LEN(42)
CHGVAR VAR(&FLG) VALUE('0')
CHGVAR VAR(&CMD) VALUE('*nlvlibl/addpfm literal' +
|| '/literal ' ||&MBR)
CALL PGM(QCMDCHK) PARM(&CMD 42)
MONMSG MSGID(CPF0000 CPD0000) EXEC(DO)
CHGVAR VAR(&FLG) VALUE('1')
ENDDO
EXIT: ENDPGM
Thanks a lot.
On Fri, Sep 9, 2011 at 3:31 PM, CRPence<CRPbottle@xxxxxxxxx> wrote:
Was the plan to perform "efficiently" dismissed as a requirement?
That CLP would perform significantly worse plus waste significantly more
resources than even the RTVMBRD someone else suggested. A very poor
implementation IMO, and seems completely to miss the intent of using the
syntax checker versus actually invoking any commands.
Since the QCMDCHK API was apparently ignored, I do not suppose there
is much benefit in suggesting another.? There is also the Verify Name
(QCAVFYNM, QCAVERIFYNAME) API for which CPF019D is sent for an invalid
name; use the format VFYN0100 and the *NAME for "basic name" as alluded
on the example *CMD CHKNAM.
Verify "an input value to determine if it is a valid system name"
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/apis/qcaverifyname.htm
FWiW I did not suggest the above API in my first reply, because
although I was convinced such an API existed, I could not recall the
name, nor have I ever coded to that API; I have used QCMDCHK for that
effect however. And I did not see the doc link in the InfoCenter search
results in an earlier search on _validate name API_ but a new search
omitting the token API was as good as when searching on the _verify name
API_
Regards, Chuck
On 09-Sep-2011 12:41 , Vinay Gavankar wrote:
In my environment, I won't be allowed to "create" a new command.> On Fri, Sep 9, 2011 at 10:09 AM, CRPence wrote:
But using the idea I wrote a small program:
<<SNIP "ugly" CLP source>>
Assuming @@WRK@@ in QTEMP is not a file I will have normally, this
seems to work.
Any comments?
*/On 09-Sep-2011 06:55 , Vinay Gavankar wrote:
What would be the most efficient way of validating that an inputVery possible. The Check Command Syntax (QCMDCHK) API suffices.
provided on Screen is a value that can be used to add as a Physical
File Member later in the job stream (i.e. it starts with alphabet or
specific special characters, no embedded blanks, etc.)
I feel that it should be possible using some system commands and
MONSG etc. instead of writing RPG code to check, but cannot figure
out what it should be.
The most obvious though perhaps not generally the most efficient
would be to use the command that will eventually be utilized. For
example, if the value will be used in ADDPFM, then generate and
pass a valid command string with the MBR() parm value concatenated.
For an idea of how, some command-line examples:
/* .........+.........+.........+.........+.. */
call qcmdchk ('*nlvlibl/addpfm literal/literal tenbytenam' 42)
call qcmdchk ('*nlvlibl/addpfm literal/literal 9bbadname ' 42)
Value '9BBADNAME ' for parameter MBR not a valid name.
Errors occurred in command.
Somewhat more efficient since the command is minimalist... Using
the same means above but with a simpler user-created command such
as CHKNAM:
//data /* mbr(chknam) */ endchar('//')
PARM KWD(MBR) TYPE(*NAME) LEN(10) MIN(1) MAX(1)
//
crtcmd chknam
call qcmdchk ('chknam validname ' 25) /* no errors logged
--call qcmdchk ('chknam *errname ' 25)
Value '*ERRNAME ' for parameter MBR not a valid name.
Errors occurred in command.
In the error cases, validation for CPF0006 as the *ESCAPE and then
thee preceding diagnostic being CPD0078 giving the invalid value
in replacement text variable&3. When no errors, the value in the
string can be assumed to be correct when concatenated to the
eventual complete ADDPFM command string.
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.
As an Amazon Associate we earn from qualifying purchases.
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.