as400 interview questions and answers-Part 15

1. When do we use *NODEBUGIO in AS400?


*{NO}DEBUGIO:  If you use the interactive source debugger to step through a program, you'll notice that the debugger will break many times on every I/O statement.  This is because a separate breakpoint is inserted for every field returned from the I/O buffer.  This is not a major problem, and very inconvenient.  Coding *NODEBUGIO will break only once for each I/O statement.


2. What is the use of IGNORE keyword in RPGLE?



The IGNORE keyword allows a record format from an externally described file to be ignored. The external name of the record format to be ignored is specified as the parameter recformat. One or more record formats can be specified, separated by colons (:).


FACCLG01  IF   E           K DISK    IGNORE(Rec_format_2: Rec_format_3)

Suppose ACCLG01 has 3 record formats Rec_format_1, Rec_format_2 and Rec_format_3.

Now if we need only Rec_format_1 in our program, then we can IGNORE rest of the two record formats Rec_format_2 and Rec_format_3.


3. What is the use of PREFIX keyword in RPGLE?



The PREFIX keyword is used to partially rename the fields in an externally described file. PREFIX(YE:3) would change the field name 'YTDTOTAL' to 'YETOTAL'.


FACCLG01  UF A E           K Disk
F                                     Prefix(A01:3)
FACCLG02  UF A E           K Disk
F                                     Prefix(A02:3)

Here above logical files ACCLOG1 and ACCLOG2 both are based on same physical file and only difference is their key fields. But they do have same field names. If we are using both file at the same time, we cannot distinguish the field name of the two. Hence, to overcome this problem we use PREFIX that partially renames the fields of the file.

Here ACCLG01 file will have its field’s first 3 character replaced with A01 and ACCLG02 file will have its field’s first 3 character replaced with A02.


4. What is the use of RENAME keyword in RPGLE?



The RENAME keyword allows you to rename record formats in an externally described file.


FACCLG01  UF A E           K Disk
F                                     Rename(format1:format_xxx)
FACCLG02  UF A E           K Disk
F                                     Rename(format1:format_yyy)

Suppose we are using two files ACCLG01 and ACCLG02 both having the same record format name format1, In such a case to distinguish the two files on the basis of their record format name, we can use the RENAME keyword to rename the record format of one file to make it different than the other one.

Here the new record format name for the two file will be format_xxx and format_yyy.


5. What is the use of USROPN keyword in RPGLE?



    Specify this keyword to indicate that the file must be explicitly opened with the OPEN operation and should be closed with CLOSE operation.


* The printer file is opened in the calculation specifications
FFILE1   O    F  132        DISK USROPN
    // Open the file if it is not already open
    if not %open (FILE1);
       open FILE1;


6. When do we use EXTMBR keyword in rpgle? Give example of EXTMBR.


  EXTMBR('member name') EXTMBR('*ALL')

Using EXTMBR ('member name’), we can use the member that we want to access of the file mentioned here in F-Spec.

If instead of any member name, we mention EXTMBR ('*ALL'), then all the members are accessed one by one.


Example: To read all members of a PF


 Columns . . . :    1  71           Browse                       AMIT/QRPGLESRC
 SEU==>                                                                MBR_READ
 FMT FX .....FFilename++IPEASF.....L.....A.Device+.Keywords++++++++++++++++++++
        *************** Beginning of data *************************************
0001.00      FCUST      IF   E             DISK    EXTMBR('*ALL')              
0001.01      F                                     INFDS(FILEDS)               
0001.02       *                                                                
0001.03      DFILEDS           DS                                              
0001.04      DRECORD             *RECORD                                       
0001.05      DMEMBER                 129    138                                
0001.06      DDB_RRN                 397    400I 0                             
0001.07       *                                                                 
0001.08       *                                                                
0001.09      DDATA1            DS                                              
0001.10      DFLD1                           10                                 
0001.11      DFILLER1                         2    INZ('--')                   
0001.12      DFLD2                           10                                
0001.13      DFILLER2                         2    INZ('--')                    
0001.14      DFLD3                            4  0                             
0001.15      DFILLER3                         2    INZ('--')    
0001.16       *                                                                
0001.17       *                                                                 
0001.18      DDATA2            DS                                              
0001.19      DFLD4                            6                                
0001.20      DFILLER4                         2    INZ('--')                   
0001.21      DFLD5                           10                                
0001.22      DFILLER5                         2    INZ('--')                   
0001.23      DFLD6                            5  0                             
0001.24      DFILLER6                         2    INZ('--')                   
0001.25      DFLD7                           10  0                             
0001.26       *                                                                 
0001.27       *                                                                
0001.28       *                                                                
0002.00      C                   READ      CUST                                 
0003.00      C                   DOW       NOT %EOF(CUST) AND *IN90=*OFF       
0003.02      C                   EVAL      FLD1=MEMBER                         
0003.03      C                   EVAL      FLD2=RECORD            
0003.04      C                   EVAL      FLD3=DB_RRN                         
0003.05      C                   EVAL      FLD4=CSNBR                          
0003.06      C                   EVAL      FLD5=CSNAME                         
0003.07      C                   EVAL      FLD6=CS#OPN                         
0003.08      C                   EVAL      FLD7=CS$OPN                         
0003.09      C     DATA1         DSPLY                                         
0003.10      C     DATA2         DSPLY                                         
0003.11      C                   READ      CUST                                
0004.00      C                   ENDDO                                         
0005.00      C                   SETON                                        LR
        ****************** End of data ****************************************




                           Work with Members Using PDM                 SYSTEM09
 File  . . . . . .   CUST                                                      
   Library . . . .     AMIT                 Position to  . . . . .             
 Type options, press Enter.                                                    
   3=Copy    4=Delete         5=Display   7=Rename    8=Display description    
   9=Save    13=Change text   18=Change using DFU     25=Find string ...       
 Opt  Member      Date        Text                                             
      CUST        07/27/12                                                      
      MBR2        07/23/12                                                     
      MBR3        07/23/12                                                     
 Parameters or command                                                          
 F3=Exit          F4=Prompt             F5=Refresh            F6=Create        
 F9=Retrieve      F10=Command entry     F23=More options      F24=More keys    


File’s member Data

CUST data                                                                             
       CSNBR   CSNAME      CS#OPN          CS$OPN
000001 000001  AMI              0             .00
000002 000002  upi              0             .00
000003 000003  KUM              0             .00
000004 000004  RAHIN       12,256      454,654.51
000005 000005  HARISH         980      798,789.00
MBR2 data                                                                             
        CSNBR   CSNAME      CS#OPN          CS$OPN                    
 000001 100002  upi              0             .00                    
 000002 100003  KUM              0             .00                    
MBR3 data                                                                              
CSNBR   CSNAME      CS#OPN          CS$OPN                  
100003  KUM              0             .00                  





                           Display Program Messages                            
 CUST      --CUSTR     --0001--                                         
 000001--AMI       --00000--0000000000                                  
 CUST      --CUSTR     --0002--                                         
 000002--upi       --00000--0000000000                                  
 CUST      --CUSTR     --0003--                                         
 000003--KUM       --00000--0000000000                                   
 CUST      --CUSTR     --0004--                                         
 000004--RAHIN     --12256--0000454654                                  
 CUST      --CUSTR     --0005--                                         
 000005--HARISH    --00980--0000798789                                  
 MBR2      --CUSTR     --0001--                                         
 100002--upi       --00000--0000000000                                  
 MBR2      --CUSTR     --0002--                                          
 100003--KUM       --00000--0000000000                                  
 MBR3      --CUSTR     --0001--                                         
 100003--KUM       --00000--0000000000            



7. What is VARYING keyword in AS400?





D varstr        s             50A   VARYING
C                   eval      varstr = 'Amit Jaiswal'


Here, the maximum length of the variable varstr will be 50, but the actual length can vary as per the value assigned to this variable. Here the current size of variable will be the size of string “Amit Jaiswal”.     

8. What is *VARSIZE keyword in AS400?


*VARSIZE has nothing to do with the data type of the variable. All it does is disable the compiler's validity checking of the length.





User Comments:



Copyright ©, 2013-2020. Copyright notice