An Intersystem Communications Function (ICF) file defines the layout of the data sent and received between two programs on different systems and links you to the configuration objects that are used to communicate with a remote system. The ICF Programming manual contains information about ICF files.
I/O Considerations for Intersystem Communication Function Files
Opening ICF Files as Binary Stream Files
To open an iSeries ICF file as a binary stream file for record-at-a-time processing, use the fopen() function with one of the following modes:
•rb •wb and ab •ab+
Note: The only way to create an ICF file is to use the CRTICFF command. If you use the fopen() function and the ICF file does not exist, a physical database file is created.
The valid keyword parameters are:
I/O Considerations for Binary Stream ICF Files
The fwrite() function returns the number of elements that are successfully written. When you use PDATA, the value returned by the fwrite() function does not take PDATA into consideration. When using PDATA, errno is set to ETRUNC even though all the data was successfully written.
Program Devices for Binary Stream ICF Files
The program device that is associated with ICF files is a communications session. You establish the default device by implicitly acquiring it using the fopen() function.
Binary Stream Functions for ICF Files
Use the following binary stream functions to process ICF files:
Opening ICF Files as Record Files
To open an iSeries ICF file as a record file, use the _Ropen() function with one of the following modes:
•rr •rr+ and wr+ ar+ •wr and ar
The valid keyword parameters are:
•indicators •riofb •secure
I/O Considerations for Record ICF Files
The _Rwrite() function returns the number of characters that are successfully transferred across a communication line. When you use PDATA, unlike the _fwrite() function, the value that is returned by the _Rwrite() function (num_bytes) includes PDATA.
Program Devices for Record ICF Files
The program device that is associated with ICF files is a communications session. You establish the default device by implicitly acquiring it using the _Ropen() function. The implicitly acquired program device is determined by the ACQPGMDEV parameter on the CRTICFF, OVRICFF, or CHGICFF commands. If the program device name is specified on the ACQPGMDEV parameter the program device must be defined to the device file before it is opened. This is done by specifying the name on the PGMDEV parameter of the ADDICFDEVE or OVRICFDEVE commands.
If *NONE is specified for the ACQPGMDEV parameter of the CRTICFF, OVRICFF, or CHGICFF commands, you must explicitly acquire the program device using the _Racquire() function.
You can change the default program device in the following ways:
To release a program device, use the _Rrelease() function (the program device must have been previously acquired). This detaches the device from an open file; I/O operations can no longer be performed for this device. If you wish to use the device after releasing it, it must be acquired again.
All program devices are implicitly released when you close the file. If the device file has a shared open data path, the last close operation releases the program device.
Record Functions for ICF Files
Use the following record functions to process ICF files:
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.
Note:To run this example the target program T1520TGT must exist on a remote system. A communications line between the source system with program T1520ICF and the target system with program T1520TGT must be active.You also need Advanced Program to Program Communications (APPC).
T1520DDA — DDS Source for Password and User ID
T1520DDB — DDS Source to Send Password and User ID
T1520DDC — DDS Source to Receive Password and Userid
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.
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.
The output is as follows:
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.
IBM-ILE Related Interview Questions
|IBM - RPG Interview Questions||IBM DB2 Interview Questions|
|DB2 Using SQL Interview Questions||IBM Mainframe Interview Questions|
|IBM AIX 7 Administration Interview Questions||AS400 Interview Questions|
|Automatic Storage Management (ASM) Interview Questions||Mainframe DB2 Interview Questions|
|Rpgle Interview Questions|
Introduction To The Ile C/c++ Compiler
Creating A Program
Working With Exports From Service Programs
Example - Creating A Sample Ile C Application
Running A Program
Debugging A Program
Using Stream And Record I/o Functions With Iseries Data
Using Ile C/c++ Stream Functions With The Iseries Integrated File System
Using Externally Described Files In Your Programs
Using Database Files And Distributed Data Management Files In Your Programs
Using Device Files In Your Programs
Handling Exceptions In Your Program
Using Iseries Pointers In Your Program
Using Packed Decimal Data In Your C Programs
Internationalizing Your Program
International Locale Support
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.