× 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.



Thanks Chuck.

In my environment, I won't be allowed to "create" a new command.

But using the idea I wrote a small program:

PGM PARM(&MBR &FLG)

DCL VAR(&MBR) TYPE(*CHAR) LEN(10)
DCL VAR(&FLG) TYPE(*CHAR) LEN(1)

CHGVAR VAR(&FLG) VALUE('0')
DLTF FILE(QTEMP/@@WRK@@)
MONMSG MSGID(CPF0000)

CRTPF FILE(QTEMP/@@WRK@@) RCDLEN(10) MBR(*NONE)
ADDPFM FILE(QTEMP/@@WRK@@) MBR(&MBR)
MONMSG MSGID(CPF0000 CPD0000) EXEC(DO)
CHGVAR VAR(&FLG) VALUE('1')
ENDDO

DLTF FILE(QTEMP/@@WRK@@)
MONMSG MSGID(CPF0000)
EXIT: ENDPGM


Assuming @@WRK@@ in QTEMP is not a file I will have normally, this seems to
work.

Any comments?

Vinay
On Fri, Sep 9, 2011 at 10:09 AM, CRPence <CRPbottle@xxxxxxxxx> wrote:

On 09-Sep-2011 06:55 , Vinay Gavankar wrote:

What would be the most efficient way of validating that an input
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.


Very possible. The Check Command Syntax (QCMDCHK) API suffices.

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 CPF0001 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.

Regards, Chuck
--
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 thread ...

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.