File identifier (FILEID)
Specifies the file identifier that was used on a previous Open File using CLF (OPNFCLF) command in the application.
This parameter is used by CLF commands to identify the file to be processed by the command.
This is a required parameter.
- simple-name
- Specify a name that matches the FILEID parameter value of a previous OPNFCLF command.
Error found (ERR)
Specifies a CL logical variable to receive general error status. If the variable value is equal to '1' (true) then an error was found when performing the command. If the variable value is equal to '0' (false) then no error was found when performing the command.
This CL variable can be declared by the Declare Indicators using CLF (DCLINDCLF) command, the Generate Indicators using CLF (GENINDCLF) command, or by you using the Declare CL Variable (DCL) command. The two CLF commands would have specified CLFIND(*YES). When using the CLF commands the name of the CL variable is &ERR.
If no CL variable is specified and an error condition is encountered the application program will be sent an escape message.
- logical-value
- Specify the name of a CL variable declared as TYPE(*LGL).
Program opening file (OPNPGM)
The same FILEID value can be in use across multiple programs within a job. Each instance of a file open is uniquely identifed by the OPNPGM parameter. This parameter specifes the application program that initially opened the file using the Open File using CLF (OPNFCLF) command.
All CLF commands that reference the same FILEID and OPNPGM combination share the same view of the file. If one program causes the position within the file to change all programs see that change. If one program closes the file then the file is closed to all programs.
The combination of FILEID and OPNPGM must be unique within the activation group the application program is running in.
If the program name is *CURPGM then the library qualifier for this parameter is ignored. The library of the current program will be used.
Single values: Program opening file
- *CURPGM
- The current program opened the file associated with FILEID. It is this file open instance that is to be used.
Qualifier 1: Program opening file
- name
- Specify the name of the program that initially opened the file identified by FILEID. It is this file open instance that is to be used.
Qualifier 2: Library
- *CURLIB
- The current library for the thread is used. If there is no current library for the thread then library QGPL is used.
- name
- Specify the name of the library where the program that initially opened the file is located.
Examples for RLSDEVCLF
Example 1: Releasing a Display Device
RlsDevCLF FileID(VC2EMPDSP1) Dev(&Device)
This example releases the device identifed by the &DEVICE variable from the VC2EMPDSP1 file.
Example 2: Switching Between Two Display Devices for Employee Master Maintenance
This example switches a display file back and forth between two display devices. One display device is used to enter an employee number. The second display device is used to maintain the employee record.
The RLSDEVCLF command is run when F12 is used from the acquired device.
Pgm
/******************************************************/
/* Declare variables for device names: */
/* &ME - the device associated with the */
/* interactive job calling this program */
/* &DEVICE - the device to be acquired. This device */
/* is named 'D' and must be at the Signon */
/* screen */
/******************************************************/
Dcl Var(&Me) Type(*Char) Len(10)
Dcl Var(&Device) Type(*Char) Len(10) Value('D')
/******************************************************/
/* Declare the Employee master file VC2EMP and the */
/* display file VC2EMPDSP1. Note that VC2EMPDSP2 is */
/* created with MAXDEV(2). CLF indicators are also */
/* declared using the DCLINDCLF command. */
/******************************************************/
DclFCLF FileID(VC2EMP)
DclFCLF FileID(VC2EMPDSP1)
DclIndCLF CLFInd(*Yes)
/******************************************************/
/* Open the two files. VC2EMP is opened for both */
/* input and output as the program can delete an */
/* employee record. VC2EMP is opened for keyed access */
/******************************************************/
OpnFCLF FileID(VC2EMP) Usage(*Both) AccMth(*Key)
OpnFCLF FileID(VC2EMPDSP1) Usage(*Both)
/******************************************************/
/* Use the RTVJOBA command to get our display device */
/* name. */
/******************************************************/
RtvJobA Job(&Me)
/******************************************************/
/* Acquire the display device named 'D'. By default */
/* 'D' becomes the current/active device for the */
/* VC2EMPDSP1 display file */
/******************************************************/
AcqDevCLF FileID(VC2EMPDSP1) Dev(&Device)
/******************************************************/
/* While F3 not used loop on the following: */
/* */
/* 1 Set the current device for VC2EMPDSP1 to the */
/* display device identified by &ME */
/* 2 Write and wait for input from &ME using record */
/* format PROMPT. PROMPT prompts for an employee */
/* number */
/* 3 If F3 ias pressed, exit the loop */
/* 4 Read the requested employee record */
/* 5 If no record is found display an appropriate */
/* message and restart the loop */
/* 6 If an employee record is found: */
/* A. Set the current device to device 'D' */
/* B. Write and wait for input from 'D' using */
/* record format CHANGE */
/* From CHANGE: */
/* If F3 Release 'D' from the program and */
/* assign &ME as the device for future */
/* employee changes maintenance */
/* If F12 Release the employee record */
/* currently locked for update and */
/* restart the loop */
/* If F23 Delete the employee record */
/* If ENTER Update the employee record */
/* 7 Restart the loop, prompting at &ME for the next */
/* employee number */
/******************************************************/
DoWhile Cond(*Not &IN03)
SetDevCLF FileID(VC2EMPDSP1) Dev(&Me)
WrtReadCLF RcdFmt(PROMPT)
If Cond(&IN03) Then(Leave)
ReadRcdCLF FileID(VC2EMP) Type(*Key) +
RcdNotFnd(&RNF) KeyRel(*EQ) +
KeyList(&EmpNbr)
If Cond(&RNF) Then(Do)
ChgVar Var(&IN50) Value('1')
Iterate
EndDo
SetDevCLF FileID(VC2EMPDSP1) Dev(&Device)
WrtReadCLF RcdFmt(CHANGE)
Select
When Cond(&IN03) Then(Do)
If Cond(&Device *NE &Me) Then(Do)
RlsDevCLF VC2EMPDSP1 &Device
ChgVar &Device &Me
ChgVar &IN03 '0'
EndDo
Iterate
EndDo
When Cond(&IN12) Then(Do)
RlsRcdCLF VC2EMP
Iterate
EndDo
When Cond(&IN23) Then(DltRcdCLF VC2EMP)
OtherWise Cmd(UpdRcdCLF FileID(VC2EMP))
EndSelect
EndDo
/******************************************************/
/* When F3 is pressed from the device &ME close the */
/* files and return */
/******************************************************/
CloFCLF FileID(VC2EMP)
CloFCLF FileID(VC2EMPDSP1)
EndPgm
The source for this example can be found in member DEV_DEVD of source file VC2CLSRC in library VC2CLF. The source for physical file VC2EMP can be found in member VC2EMP of source file QDDSSRC in library VC2CLF. The source for display file VC2EMPDSP1 can be found in member VC2EMPDSP1 of source file QDDSSRC in library VC2CLF.
All of the objects referenced by DEV_DEVD should currently exist is library VC2CLF. To create DEV_DEVD into QTEMP you can use the commands
AddLibLE Lib(VC2CLF)
CrtBndCLF Pgm(QTEMP/DEV_DEVD) SrcFile(VC2CLSRC)
To run DEV_DEVD you need to be signed on to one workstation and a workstation named 'D' must be varied on and at the Sign On panel. Using the command
Call Pgm(QTEMP/DEV_DEVD)
From your workstation you will see a prompt for an employee number. At this time the screen for workstation 'D' will be blank. Enter an employee number such as 1. Your workstation will now be input inhibited and the CHANGE record format shown on workstation 'D'. The employee record shown will be for the employee number you entered previously. From 'D' the user can change the record and press ENTER in order to update the record, use F12 to not update the record, use F23 to delete the record, or F3 to exit the application. When any of these actions are done, control is returned to your workstation for the next employee number (or F3 to exit).
If you, at your workstation, enter an invalid employee number you will receive an error message and need to enter a valid employee number. During this time workstation 'D' will be input inhibited.
Multiple workstations can be entering data concurrently (as opposed to one always being input inhibited as with this example) by using INVITE and READRCDCLF TYPE(*INV).