|
Hi Fellow List Members
I know this isn't an RPG problem, but in the absence of any other more relevant
list I hope you don't mind if I post it here.
I have a program that I've written which does nothing but accept an IFS
path/document and a library name, and then attempts to copy the IFS document to
a file in the library. I've coded the program so that if the value *DEFAULT is
passed then it uses a hard-coded path and file based on the system name:
0001.00 PGM PARM(&STMF &LIB)
0002.00
0003.00 DCL VAR(&STMF) TYPE(*CHAR) LEN(127)
0003.01 DCL VAR(&LIB) TYPE(*CHAR) LEN(10)
0003.02 DCL VAR(&SYSNAME) TYPE(*CHAR) LEN(8)
0004.00
0007.01 /* If *DEFAULT specified for the stream file then base it on the system
that */
0007.02 /* is being used...
*/
0007.03
0007.04 IF COND(&STMF *EQ '*DEFAULT') THEN(DO)
0008.00 RTVNETA SYSNAME(&SYSNAME)
0009.00 CHGVAR VAR(&STMF) VALUE('/masonj02/libsuk02.csv')
0010.00 IF COND(&SYSNAME *EQ 'PFIZUK01') THEN(DO)
0010.01 CHGVAR VAR(&STMF) +
0010.02 VALUE('/effs_interface/libsuk01.csv')
0011.00 ENDDO
0012.01 ENDDO
0013.00
0014.00 /* Copy the stream file to the physical file...
*/
0015.00
0015.01 CPYFRMIMPF FROMSTMF(&STMF) TOFILE(&LIB/HWKP100A) +
0015.02 MBROPT(*REPLACE) RCDDLM(*LF) STRDLM(*NONE)
0017.00
0018.00 ENDPGM
When I call the program using:
CALL program PARM('*DEFAULT' 'MASONJ04')
The program falls over with the error message CPD0186 "Path name cannot begin
with *." When I debug the program and look at the contents of the path name
variable, debug shows:
*...+....1....+....2....+....3....+....4....+....5
'*DEFAULT MASONJ04 '
' sonj04ØE*DEFAULTE'
'MASONJ04» '
and the library is shown as MASONJ04 as expected.
First question is: Why is the &STMF variable showing all of the garbage? The
parameter passed is enclosed in single quotes which (I have always believed)
should cause it to be padded with blanks.
As a work around I changed the *DEFAULT test to use a substring:
0007.04 IF COND(%SST(&STMF 1 8) *EQ '*DEFAULT') THEN(DO)
When I run the program now using the same parameters, the condition is met and
the default path is set. The only trouble here (and this is the second
question) is that the &LIB field ends up as blank by the time the program gets
to the CPYFRMIMPF statement.
Does anybody have any ideas on why this would happen? I've never known CL
parameters to overlay each other before and have never had to pass padding
blanks in parameters. If I swap the parameters around then it works, but only
if I use *DEFAULT. If I pass an actual path then the garbage is included in
the path name and the program fails.
We're running v5r2m0 of the operating system and the program is a standard CLP
source type.
Thanks
Jonathan
www.astradyne-uk.com
Jonathan Mason
www.astradyne-uk.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.