Using EXTFLD to code Externally Described DS in RPG AS400 |
Example2: Using EXTFLD to code Externally Described DS in RPG
In this example, the Externally described data structure DS1 is defined on a file named RPGLE14PF using the EXTNAME keyword, and individual file fields are renamed using the EXTFLD keyword.
RPG Code in Fixed format for Externally Described Data Structure
D ds1 E DS EXTNAME(RPGLE14PF:RCDFMT14) D a1IDN E EXTFLD(IDN) D b1Name E EXTFLD(NAME) D c1Addr1 E EXTFLD(ADDR1) D d1Addr2 E EXTFLD(ADDR2) C EVAL a1IDN = 2 C EVAL b1Name = 'DUMMY' C EVAL c1Addr1 = 'Address1' C EVAL d1Addr2 = 'Address2' C SETON LR C RETURN
RPG Code in /Free format for Externally Described Data Structure
D ds1 E DS EXTNAME(RPGLE14PF:RCDFMT14) D a1IDN E EXTFLD(IDN) D b1Name E EXTFLD(NAME) D c1Addr1 E EXTFLD(ADDR1) D d1Addr2 E EXTFLD(ADDR2) /Free a1IDN = 2; b1Name = 'DUMMY'; c1Addr1 = 'Address1'; d1Addr2 = 'Address2'; *inlr = *on; return; /End-Free
RPG Code in fully Free format for Externally Described Data Structure
**FREE DCL-DS DS1 EXTNAME('RPGLE14PF') ; a1IDN EXTFLD('IDN'); b1Name EXTFLD('NAME'); c1Addr1 EXTFLD('ADDR1'); d1Addr2 EXTFLD('ADDR2'); END-DS; a1IDN = 2; b1Name = 'DUMMY'; c1Addr1 = 'Address1'; d1Addr2 = 'Address2'; *inlr = *on; return;
Program Output
> EVAL DS1 A1IDN OF DS1 = 02. B1NAME OF DS1 = 'DUMMY ' C1ADDR1 OF DS1 = 'Address1 ' D1ADDR2 OF DS1 = 'Address2 '
Related Post
Read also :
- Data Structure and Types of DS in RPG AS400
- Using a Data Structure to subdivide the field in RPG AS400
- Using a Data Structure to group fields in RPG AS400
- Externally Described Data Structure in RPG AS400
- Using PREFIX to rename all fields in an external data structure in RPG AS400
- Define an externally-described data structure using the LIKEREC keyword in RPG AS400
- Difference between LIKEREC and EXTNAME keyword in RPG AS400
- Multiple Occurrence Data Structure in RPG AS400
- Data Area Data Structure in RPG AS400
- *LDA Local data area data structure in RPG AS400
- File information data structures (INFDS) in RPG AS400
- Indicator data structure in RPG AS400
- Program Status Data Structure in RPG AS400
- Using keywords QUALIFIED, LIKEDS, and DIM with data structures
- Array Data Structures in RPG AS400
- Defining Data Structure Parameters in a Prototype or Procedure Interface