You can change the default device for a device file.
The following example illustrates how to change the default program device using the _Rpgmdev() function.
Note: To run this example you must use two display devices that are defined on your system in place of DEVICE1 and DEVICE2.
T1520DDE — DDS Source for Name and Password Display
T1520CDV — ILE C Source to Change the Default Device
The ILE C program T1520CDV uses the _Racquire() function to explicitly acquire another device that is named DEVICE1. DEVICE1 becomes the current program device.The _Rpgmdev() function changes the current device that is named DEVICE1 to DEVICE2. The _Rreadindv() function reads records from DEVICE1. The _Release() function releases DEVICE1 and DEVICE2.
The output is as follows:
When the application is run, a different display appears on each device. Data may be entered on both displays, but the data that is first entered is returned to the program. The output from the program is in QPRINT. For example, if the name SMITH and the address 10 MAIN ST is entered on DEVICE1 before any data is entered on DEVICE2, then the file QPRINT contains:
Data displayed on DEVICE1 is SMITH 10 MAIN ST
Note: There are two record formats that are created in the above example. One has a size of 45 characters (fmt1), and the other a size of 18 characters (fmt2). The union buf contains two record format declarations.
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.