Try changing *key to *keyae and also build the key using CHGVAR.
CHGVAR &BIGKEY VALUE('USER')
CHGVAR VAR(%SST(&BIGKEY 11 10)) VALUE('XXXLIB')
CHGVAR VAR(%SST(&BIGKEY 21 10)) VALUE('XXX001C')
OVRDBF FILE(PGMSEC) POSITION(*KEYAE 3 *N &BIGKEY)
Note that you can only do this once per job (up to v5r4). I think in V6 you can close the file and repeat.
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Cyndi Bradberry
Sent: Friday, September 13, 2013 1:34 PM
To: Midrange Systems Technical Discussion
Subject: Help with OvrDbf/Rcvf Positioning
I have a file with 3 - 10 position character fields. I am building the key string and using it in the OVRDBF statement. I have 3 variables which I *cat with the quote variable then *Bcat the three into the FileKey variable.
DCL "E *CHAR 1 VALUE('''')
Dcl &FileKey Type(*Char) Len(38)
OvrDbF PGMSEC Position(*Key 3 *N &FileKey)
From the Job Log:
4500 - OVRDBF FILE(PGMSEC) POSITION(*KEY 3 *N '''USER '' ''XXXLIB '' ''XXX001C ''')
4600 - RCVF DEV(*FILE) RCDFMT(@PGMSEC) WAIT(*YES) OPNID(*NONE)
/* File name is xxxLIB/PGMSEC. */
Position option for member PGMSEC not valid.
Function check. CPF4137 unmonitored by CKD001C at statement 0000004600,
CPF4137 received by procedure CKD001C. (C D I R)
Display Formatted Message Text
Message ID . . . . . . . . . : CPF4137
Message file . . . . . . . . : QCPFMSG
Library . . . . . . . . . : QSYS
Message . . . . : Position option for member &4 not valid.
Cause . . . . . : The position option for member &4 file &2 in library &3 is
not valid. The conditions that can cause this error include:
-- The relative record number or key specified with the OVRDBF command
does not exist in the file.
-- A key position was specified with the OVRDBF command for a file that is
either not keyed or is being opened for an arrival sequence.
-- A relative record number position for a keyed file was specified with
the OVRDBF command.
-- A relative record number position for a distributed file was specified
with the OVRDBF command.
-- An error occurred while the operation to set the position in the file
was being done.
Recovery . . . : Do one of the following and try your request again:
-- Use the OVRDBF command to specify a record that exists in member &4.
-- If the file is keyed, do not open the file for an arrival sequence.
-- If the file is not keyed, specify the position by relative record
-- If you need to set the initial record position by relative record
number, open the file for arrival sequence.
-- If the file is a keyed distributed file, set the initial record
position by key rather than by relative record number. If you need to set
the initial record position by relative record number, then change the file
so it is not a distributed file.
-- Display the low-level messages and correct any errors.
I see the multiple quotes around the 3 components of the key, but I can't see how to make them go away.
My file is keyed on the three fields, User, Library, Program in that order. There is a record in the file for the above user/library/program combination.
I am having a senior Friday moment. Can someone please point me at the explanation ?