Looks as if INCREL has a built-in effective length, since it is varying-length. Chuck's solution is the same, in any case, however - add trailing blanks.

Now I wonder if this works if the field tested is also varying and HAS no trailing blanks. :)


----- Original Message -----
RTVCMDSRC output:

5722WDS V5R4M0 060210 SEU SOURCE LISTING
05/08/13 22:55:34 XXXXXXX PAGE 1
SOURCE FILE . . . . . . . XXXXXX/RTVCMDSRCF
MEMBER . . . . . . . . . CPYF
SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6
...+... 7 ...+... 8 ...+... 9 ...+... 0

100 /* CRTCMD CMD(QSYS/CPYF) +
*/
200 /* PGM(QSYS/QCPEX0FL) +
*/
300 /* SRCFILE(MCUTIL/RTVCMDSRCF) +
*/
400 /* SRCMBR(CPYF) +
*/
500 /* THDSAFE(*COND) +
*/
600 /* MLTTHDACN(*RUN) +
*/
700 /* TEXT('Copy File') +
*/
800 /* VLDCKR(*NONE) +
*/
900 /* MODE( +
*/
1000 /* *ALL) +
*/
1100 /* ALLOW( +
*/
1200 /* *ALL) +
*/
1300 /* ALWLMTUSR(*NO) +
*/
1400 /* MAXPOS(6) +
*/
1500 /* PMTFILE(QDEVELOP/QCPFPMT) +
*/
1600 /* MSGF(*LIBL/QCPFMSG) +
*/
1700 /* HLPSHELF(*LIST) +
*/
1800 /* HLPPNLGRP(*LIBL/QHCPCMD1) +
*/
1900 /* HLPID(CPYF) +
*/
2000 /* HLPSCHIDX(*NONE) +
*/
2100 /* CURLIB(*NOCHG) +
*/
2200 /* PRDLIB(*NOCHG) +
*/
2300 /* PMTOVRPGM(*NONE) +
*/
2400 /* AUT(*USE) +
*/
2500 /* REPLACE(*YES) +
*/
2600 /* ENBGUI(*YES)
*/
2700
2800 /* Internal info
*/
2900 /* PGM call state: *SYSTEM
*/
3000 /* CCSID: 37
*/
3100
3200 CMD PROMPT('Copy File')
3300 PARM KWD(CMDNBR) +
3400 TYPE(*INT2) +
3500 CONSTANT(1) +
3600 MIN(1)
3700 PARM KWD(FROMFILE) +
3800 TYPE(Q069C) +
3900 MIN(1) +
4000 FILE(*IN) +
4100 CHOICE(*NONE) +
4200 PROMPT('From file' 2)
4300 PARM KWD(TOFILE) +
4400 TYPE(Q069C) +
4500 SNGVAL( +
4600 (*PRINT *LIST)) +
4700 MIN(1) +
4800 FILE(*OUT) +
4900 PROMPT('To file' 3)
5000 PARM KWD(FROMMBR) +
5100 TYPE(*GENERIC) +
5200 LEN(10) +
5300 DFT(*FIRST) +
5400 SPCVAL( +
5500 (*FIRST '*N') +
5600 (*ALL )) +
5700 EXPR(*YES) +
5800 PROMPT('From member' 4)
5900 PARM KWD(TOMBR) +
6000 TYPE(*NAME) +
6100 LEN(10) +
6200 DFT(*FIRST) +
6300 SPCVAL( +
6400 (*FIRST '*N') +
6500 (*FROMMBR ) +
6600 (*ALL )) +
6700 EXPR(*YES) +
6800 PROMPT('To member or label' 5)
6900 PARM KWD(MBROPT) +
7000 TYPE(*CHAR) +
7100 LEN(1) +
7200 RSTD(*YES) +
7300 DFT(*NONE) +
7400 SPCVAL( +
7500 (*NONE N) +
7600 (*ADD A) +
7700 (*REPLACE R) +
7800 (*UPDADD U)) +
7900 EXPR(*YES) +
8000 PROMPT('Replace or add records' 6)
8100 PARM KWD(CRTFILE) +
8200 TYPE(*CHAR) +
8300 LEN(1) +
8400 RSTD(*YES) +
8500 DFT(*NO) +
8600 SPCVAL( +
8700 (*NO N) +
8800 (*YES Y)) +
8900 EXPR(*YES) +
9000 PROMPT('Create file' 7)
9100 PARM KWD(PRINT) +
9200 TYPE(*CHAR) +
9300 LEN(1) +
9400 RSTD(*YES) +
9500 DFT(*NONE) +
9600 SPCVAL( +
9700 (*EXCLD E) +
9800 (*COPIED C) +
9900 (*ERROR R)) +
10000 SNGVAL( +
10100 (*NONE N)) +
10200 MAX(3) +
10300 EXPR(*YES) +
10400 PMTCTL(*PMTRQS) +
10500 PROMPT('Which records to print' 9)
10600 PARM KWD(RCDFMT) +
10700 TYPE(*NAME) +
10800 LEN(10) +
10900 DFT(*ONLY) +
11000 SPCVAL( +
11100 (*ONLY ) +
11200 (*ALL )) +
11300 EXPR(*YES) +
11400 PMTCTL(*PMTRQS) +
11500 PROMPT('Record format of logical file' 10)
11600 PARM KWD(FROMRCD) +
11700 TYPE(*UINT4) +
11800 DFT(*START) +
11900 REL(*GT 0) +
12000 SPCVAL( +
12100 (*START 0)) +
12200 EXPR(*YES) +
12300 PMTCTL(*PMTRQS) +
12400 PROMPT('Copy from record number' 11)
12500 PARM KWD(TORCD) +
12600 TYPE(*UINT4) +
12700 DFT(*END) +
12800 REL(*GT 0) +
12900 SPCVAL( +
13000 (*END 0)) +
13100 EXPR(*YES) +
13200 PMTCTL(*PMTRQS) +
13300 PROMPT('Copy to record number' 12)
13400 PARM KWD(FROMKEY) +
13500 TYPE(E08C3) +
13600 DFT(*NONE) +
13700 SNGVAL( +
13800 (*NONE 0)) +
13900 PMTCTL(*PMTRQS) +
14000 PROMPT('Copy from record key' 13)
14100 PARM KWD(TOKEY) +
14200 TYPE(E08C3) +
14300 DFT(*NONE) +
14400 SNGVAL( +
14500 (*NONE 0)) +
14600 PMTCTL(*PMTRQS) +
14700 PROMPT('Copy to record key' 14)
14800 PARM KWD(NBRRCDS) +
14900 TYPE(*UINT4) +
15000 DFT(*END) +
15100 REL(*GT 0) +
15200 SPCVAL( +
15300 (*END 0)) +
15400 EXPR(*YES) +
15500 PMTCTL(*PMTRQS) +
15600 PROMPT('Number of records to copy' 15)
15700 PARM KWD(INCCHAR) +
15800 TYPE(E06FD) +
15900 DFT(*NONE) +
16000 SNGVAL( +
16100 (*NONE )) +
16200 PMTCTL(*PMTRQS) +
16300 PROMPT('Include records by char test' 16)
16400 PARM KWD(INCREL) +
16500 TYPE(E07DE) +
16600 DFT(*NONE) +
16700 SNGVAL( +
16800 (*NONE N)) +
16900 MAX(50) +
17000 PMTCTL(*PMTRQS) +
17100 PROMPT('Include records by field test' 17)
17200 PARM KWD(FMTOPT) +
17300 TYPE(*CHAR) +
17400 LEN(1) +
17500 RSTD(*YES) +
17600 DFT(*NONE) +
17700 SPCVAL( +
17800 (*MAP M) +
17900 (*DROP D) +
18000 (*CVTFLOAT F) +
18100 (*NULLFLAGS L)) +
18200 SNGVAL( +
18300 (*NONE N) +
18400 (*NOCHK X) +
18500 (*CVTSRC C)) +
18600 MAX(2) +
18700 EXPR(*YES) +
18800 PMTCTL(*PMTRQS) +
18900 PROMPT('Record format field mapping' 18)
19000 PARM KWD(SRCOPT) +
19100 TYPE(*CHAR) +
19200 LEN(1) +
19300 RSTD(*YES) +
19400 DFT(*SAME) +
19500 SPCVAL( +
19600 (*SEQNBR N) +
19700 (*DATE D)) +
19800 SNGVAL( +
19900 (*SAME S)) +
20000 MAX(2) +
20100 EXPR(*YES) +
20200 PMTCTL(*PMTRQS) +
20300 PROMPT('Source update options' 19)
20400 PARM KWD(SRCSEQ) +
20500 TYPE(E0921) +
20600 CHOICE(*NONE) +
20700 PMTCTL(*PMTRQS) +
20800 PROMPT('Source sequence numbering' 20)
20900 PARM KWD(OUTFMT) +
21000 TYPE(*CHAR) +
21100 LEN(1) +
21200 RSTD(*YES) +
21300 DFT(*CHAR) +
21400 SPCVAL( +
21500 (*CHAR C) +
21600 (*HEX H)) +
21700 EXPR(*YES) +
21800 PROMPT('Print format' 8)
21900 PARM KWD(ERRLVL) +
22000 TYPE(*UINT4) +
22100 DFT(0) +
22200 REL(*GE 0) +
22300 SPCVAL( +
22400 (*NOMAX X'FFFFFFFF')) +
22500 EXPR(*YES) +
22600 PMTCTL(*PMTRQS) +
22700 PROMPT('Errors allowed' 21)
22800 PARM KWD(COMPRESS) +
22900 TYPE(*CHAR) +
23000 LEN(1) +
23100 RSTD(*YES) +
23200 DFT(*YES) +
23300 SPCVAL( +
23400 (*YES Y) +
23500 (*NO N)) +
23600 EXPR(*YES) +
23700 PMTCTL(*PMTRQS) +
23800 PROMPT('Compress out deleted records' 22)
23900 Q069C: QUAL TYPE(*NAME) +
24000 LEN(10) +
24100 MIN(1) +
24200 EXPR(*YES)
24300 QUAL TYPE(*NAME) +
24400 LEN(10) +
24500 DFT(*LIBL) +
24600 SPCVAL( +
24700 (*LIBL ) +
24800 (*CURLIB '*CURLIB ')) +
24900 EXPR(*YES) +
25000 PROMPT('Library')
25100 E06FD: ELEM TYPE(*NAME) +
25200 LEN(10) +
25300 SPCVAL( +
25400 (*RCD ) +
25500 (*FLD *RCD)) +
25600 MIN(1) +
25700 EXPR(*YES) +
25800 PROMPT('Field')
25900 ELEM TYPE(*INT2) +
26000 REL(*GE 1) +
26100 MIN(1) +
26200 EXPR(*YES) +
26300 PROMPT('Character position')
26400 ELEM TYPE(*INT2) +
26500 RSTD(*YES) +
26600 SPCVAL( +
26700 (*EQ 2) +
26800 (*GT 1) +
26900 (*LT 4) +
27000 (*NE 5) +
27100 (*GE 3) +
27200 (*NL 3) +
27300 (*LE 6) +
27400 (*NG 6) +
27500 (*CT 7)) +
27600 MIN(1) +
27700 EXPR(*YES) +
27800 PROMPT('Relational operator')
27900 ELEM TYPE(*CHAR) +
28000 LEN(256) +
28100 MIN(1) +
28200 EXPR(*YES) +
28300 VARY(*YES) +
28400 PROMPT('Value')
28500 E07DE: ELEM TYPE(*CHAR) +
28600 LEN(1) +
28700 RSTD(*YES) +
28800 SPCVAL( +
28900 (*IF I) +
29000 (*AND A) +
29100 (*OR O)) +
29200 MIN(1) +
29300 EXPR(*YES) +
29400 PROMPT('Relationship')
29500 ELEM TYPE(*NAME) +
29600 LEN(10) +
29700 MIN(1) +
29800 EXPR(*YES) +
29900 PROMPT('Field')
30000 ELEM TYPE(*INT2) +
30100 RSTD(*YES) +
30200 SPCVAL( +
30300 (*EQ 2) +
30400 (*GT 1) +
30500 (*LT 4) +
30600 (*NE 5) +
30700 (*GE 3) +
30800 (*NL 3) +
30900 (*LE 6) +
31000 (*NG 6)) +
31100 MIN(1) +
31200 EXPR(*YES) +
31300 PROMPT('Relational operator')
31400 ELEM TYPE(*CHAR) +
31500 LEN(256) +
31600 SPCVAL( +
31700 (*NULL )) +
31800 MIN(1) +
31900 EXPR(*YES) +
32000 VARY(*YES) +
32100 PROMPT('Value')
32200 E08C3: ELEM TYPE(*INT2) +
32300 REL(*GE 1) +
32400 SPCVAL( +
32500 (*BLDKEY -1)) +
32600 MIN(1) +
32700 EXPR(*YES) +
32800 PROMPT('Number of key fields')
32900 ELEM TYPE(*CHAR) +
33000 LEN(256) +
33100 MIN(1) +
33200 MAX(50) +
33300 EXPR(*YES) +
33400 VARY(*YES) +
33500 PROMPT('Key value')
33600 E0921: ELEM TYPE(*DEC) +
33700 LEN(6 2) +
33800 DFT(1.00) +
33900 RANGE( +
34000 .01 +
34100 9999.99) +
34200 EXPR(*YES) +
34300 PROMPT('Starting sequence number')
34400 ELEM TYPE(*DEC) +
34500 LEN(6 2) +
34600 DFT(1.00) +
34700 RANGE( +
34800 .01 +
34900 9999.99) +
35000 EXPR(*YES) +
35100 PROMPT('Increment number')
35200 DEP CTL(&TOFILE *EQ *LIST) +
35300 PARM( +
35400 (&TOMBR *EQ '*N') +
35500 (&TOMBR *EQ *FROMMBR)) +
35600 NBRTRUE(*GT 0) +
35700 MSGID(CPD2834)
35800 DEP CTL(&FROMRCD *NE 0) +
35900 PARM( +
36000 (&FROMKEY *EQ 0) +
36100 (&TOKEY *EQ 0)) +
36200 MSGID(CPD2831)
36300 DEP CTL(&TORCD *NE 0) +
36400 PARM( +
36500 (&FROMKEY *EQ 0) +
36600 (&TOKEY *EQ 0)) +
36700 MSGID(CPD2832)
36800 DEP CTL(*ALWAYS) +
36900 PARM( +
37000 (&FROMRCD *EQ 0) +
37100 (&TORCD *EQ 0) +
37200 (&FROMRCD *LE &TORCD)) +
37300 NBRTRUE(*GT 0) +
37400 MSGID(CPD2830)
37500 DEP CTL(&NBRRCDS *NE 0) +
37600 PARM( +
37700 (&TORCD *EQ 0) +
37800 (&TOKEY *EQ 0)) +
37900 MSGID(CPD2833)
38000 DEP CTL(SRCSEQ) +
38100 PARM( +
38200 (SRCOPT)) +
38300 MSGID(CPD2824)
38400 DEP CTL(&COMPRESS *EQ 'N') +
38500 PARM( +
38600 (&TOFILE *NE *LIST) +
38700 (&INCCHAR *EQ *NONE) +
38800 (&INCREL *EQ 'N')) +
38900 MSGID(CPD2822)
* * * * E N D O F S O U R C E * * * *


"CRPence" wrote in message
news:mailman.3730.1367968523.7202.midrange-l@xxxxxxxxxxxx...

Working /correctly/ as coded; thus probably a .feeture. ;-) Whether
that is working-as-designed is moot, after having always functioned that
way... since the S/38, I believe. The value passed on the INCREL
parameter has an actual or effective length attribute [ELEM TYPE(*X) I
believe; someone could use their version of a RTVCMDSRC to validate
that], and the /field/ being compared against the specified /value/
elment is compared only up to the length of the literal value that was
specified. Thus the comparison is effectively the following predicate
[as expressed using SQL; e.g. as a predicate in a WHERE clause]:
left(LMLL, length('BR_T')) = 'BR_T'

At the command line [i.e. a command string without a CL variable for
the /value/ element of the Include Relationship], to copy just the one
row with the value 'BR_T', use the following specification:
INCREL((*IF LMLL *EQ 'BR_T '))

Or similarly, as I had explained here:
http://archive.midrange.com/midrange-l/201107/msg00408.html

Regards, Chuck

On 07 May 2013 15:05, Steve Landess wrote:

After working on this platform for 30 years, I can't believe that I
have not previously encountered this issue.

(tested on V5R4 and IBM i 7.1)

In an RUNSQLSTM script, do this:

CREATE TABLE QTEMP/XXXX
( LMLL CHAR (10 ) NOT NULL WITH DEFAULT
, LLNAME CHAR (30 ) NOT NULL WITH DEFAULT
)
;

Insert into qtemp/XXXX Values
('BR_T' ,'Brazil test')
,('BR_T1','Brazil test')
,('BR_T2','Brazil test')
,('BR_T3','Brazil test')
,('BR_T4','Brazil test')
,('BR_X' ,'Brazil test')
;

Now issue the following CPYF command:

CPYF FROMFILE(QTEMP/XXXX) TOFILE(QTEMP/XXXX1) MBROPT(*ADD)
CRTFILE(*YES) INCREL((*IF LMLL *EQ 'BR_T'))

<<SNIP what describes effect as copying all but the last row>>

So, Is this a feature or a bug?

(tested on V5R4 and IBM i 7.1)


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.