Use the following record functions to process ICF files:
Example:
The following example gets a user ID and password from a source program and sends it to a target program. The target program checks the user ID and password for errors and sends a response to the source program.
CRTPF FILE(MYLIB/T1520DDA) SRCFILE(QCPPLE/QADDSSRC)
Figure 149. T1520DDA -- DDS Source for Password and User ID
|
CRTICFF FILE(MYLIB/T1520DDB) SRCFILE(QCPPLE/QADDSSRC)
ACQPGMDEV(CAPPC2)
Figure 150. T1520DDB -- DDS Source to Send Password and User ID
|
CRTICFF FILE(MYLIB/T1520DDC) SRCFILE(QCPPLE/QADDSSRC) ACQPGMDEV(CAPPC1)
Figure 151. T1520DDC -- DDS Source to Receive Password and User ID
|
CRTDEVINTR DEVD(INTRAC) RMTLOCNAME(INTRAC) ONLINE(*NO)
VRYCFG CFGOBJ(INTRAC) CFGTYPE(*DEV) STATUS(*ON) RANGE(*OBJ)
ADDICFDEVE FILE(MYLIB/T1520DDB) PGMDEV(CAPPC2) RMTLOCNAME( CAPPC1)
MODE(CAPPCMOD)
ADDICFDEVE FILE(MYLIB/T1520DDC) PGMDEV(CAPPC1) RMTLOCNAME(*REQUESTER)
MODE(CAPPCMOD)
CRTBNDC PGM(MYLIB/T1520ICF) SRCFILE(QCPPLE/QACSRC)
Figure 152. T1520ICF -- ILE C Source to Send and Receive Data
|
The _Ropen() function opens the record file T1520DDB. The _Rformat() function accesses the record format EVOKPGM in the file T1520DDB. The EVOKE statement in T1520DDB calls the target program T1520TGT. The _Rformat() function accesses the record format SNDPASS in the file T1520DDB. The user ID and password is sent to the target program T1520TGT. The _Rformat() function accesses the record format CHKPASS in the file T1520DDB. The received password and user ID is then verified.
CRTBNDC PGM(MYLIB/T1520TGT) SRCFILE(QCPPLE/QACSRC)
Figure 153. T1520TGT -- ILE C Source to Check Data is Sent and Returned
|
The _Ropen() function opens the file T1520DDC. The _Ropen() function opens the password file T1520DDA. The _Rformat() function accesses the record format RCVPASS in the file T1520DDC. The _Rreadn() function reads the password and user ID from the source program T1520ICF. Errors are checked, and a response is sent to the source program T1520ICF.
CALL PGM(MYLIB/T1520ICF)
After calling the program, you may enter a user ID and password. If the password is correct, Password valid appears on the display; if it is incorrect, Password invalid appears.
The output is as follows:
+--------------------------------------------------------------------------------+ | Password valid | | Press ENTER to end terminal session. | +--------------------------------------------------------------------------------+
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.