as400 interview questions and answers-Part 18


1. What is EXTNAME keyword in RPGLE? Explain with example EXTNAME keyword.

Ans:

o   EXTNAME(file-name{:format-name}{:*ALL| *INPUT|*OUTPUT|*KEY})

 

The EXTNAME keyword is used to specify the name of the file which contains the field descriptions used as the subfield description for the data structure being defined.

 

The file-name parameter is required. Optionally a format name may be specified to direct the compiler to a specific format within a file.

 

The last parameter specifies which fields in the external record to extract:

·         *ALL extracts all fields.

·         *INPUT extracts just input capable fields.

·         *OUTPUT extracts just output capable fields.

·         *KEY extracts just key fields.

 

D  Fileds1       E DS                  Export                    
D                                     EXTNAME(file1)    

 

Structure of the externally described data structure:

 

·         Subfield name : Same as the external file’s fields name, unless it id renamed by keyword EXTFLD

                            or the PREFIX keyword on a definition specification is used to apply a prefix).

·         Subfield length

·         Subfield internal data type

 

 

All data structure keywords except LIKEDS and LIKEREC are allowed with the EXTNAME keyword.

 

D  D0220NEW     E DS                  PREFIX(D21:3)              
D                                     EXTNAME(CZGD02H0:CZTD02H2) 
D  D0220OLD     E DS                  PREFIX(D@@:3)              
D                                     EXTNAME(CZGD02H0:CZTD02H2) 

 

 

2. Explain CALL opcode in rpgle.

Ans:

 

CALL(E) (Call a Program)                        

·         This op-code passes control to the program specified in factor 2. It’s a dynamic call operation.

·         Program name should be in quotes.

·         If there is any error in this call operation then the error can be traced with operator extender ‘E’ and LO level indicator which turns on in case of any error.

·         If we don’t want to use error indicator with operator extender ‘E’ even then we can trace the error by using the built-in function %ERROR and %STATUS. For more information see chapter File and Program exception.

·         If the called program returns with LR indicator on, the calling program can trace that will EQ indicator.

>

Factor 1

Op-code

Factor 2

Result Field

Resulting Indicators

HI                    LO                EQ                     

 

CALL(E)

‘program name’

[parameter list]

 

[error]

[LR}

 

Example


Columns . . . :    6  80              Browse                                  AMINEM/QRPGLESRC
SEU==>                                                                                OP_CALL
FMT C  CL0N01Factor1+++++++Opcode&ExtFactor2+++++++Result++++++++Len++D+HiLoEq....
*************** Beginning of data ****************************************************
0001.00 C     PLST1         PLIST                                                       130125
0002.00 C                   PARM                    a                 2 0               130125
0003.00 C                   PARM                    b                 2 0               130125
0004.00 C                   PARM                    c                 2 0               130125
0005.00  *                                                                              130125
0006.00 C                   Z-ADD     11            a                                   130125
0007.00 C                   Z-ADD     22            b                                   130125
0008.00 C                   Z-ADD     *zeros        c                                   130125
0009.00 C                   CALL      'OP_CALL1'    PLST1                               130125
0010.00 C     c             DSPLY                                                       130125
0011.00 C                   SETON                                        LR             130125
****************** End of data *******************************************************

 

 


Columns . . . :    6  80                 Browse                               AMINEM/QRPGLESRC
SEU==>                                                                               OP_CALL1
FMT C  CL0N01Factor1+++++++Opcode&ExtFactor2+++++++Result++++++++Len++D+HiLoEq....
*************** Beginning of data ****************************************************
0001.00 C     *ENTRY        PLIST                                                       130125
0002.00 C                   PARM                    p                 2 0               130125
0003.00 C                   PARM                    q                 2 0               130125
0004.00 C                   PARM                    r                 2 0               130125
0005.00 C                   EVAL      r=p+q                                             130125
0006.00 C                   RETURN                                                      130125
****************** End of data *******************************************************

 

Output

DSPLY  33   

 



 

 







User Comments:



Subscribe

.  


Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy