• No results found

RPG/400 QS10148 What is RPG ?

In document Master Question Bank AS400 Iseries (Page 53-60)

AS10148 Report Program Generator.

QL30149 What are the positive points of RPG Language ? AL30149 Contains opcodes which makes it flexible with OS/400

Can access the externally described file.

QL50150 Explain RPG Program Logic Cycle ? AL50150

START

Perform header, detail output

Read a record Set ON LR if EOF If change in control field, set ON control level indicators.

Perform total calculations Perform total output If LR is ON then END program Perform detail calculation

Move data from selected record into processing area

QS30151 When is it efficient to make use of RPG Cycle ?

AS30151 When the file is arranged in sequence and output is based on control break.

QS20152 Can you call a program in your RPG program, which is coded in some other language ?

AS20152 Yes, Any program object available on AS/400.

QL20153 What are the different types of specification available in RPG/400 ? AL20153 Control Spec.( H )

File Spec.( F ) Extension Spec.( E )

Line counter Spec.( L ) Input Spec.( I ) Calculation Spec.( C ) Output Spec.( O )

QO40154 Is it necessary to define all formats ? Which are mandatory and which are Optional ?

AO40154 No, all are Optional.

QS20155 What is the use of H spec. in RPG ?

AS20155 It identifies by H in column 6, Provides information about generating and running programs.

QS50156 When will DUMP and DEBUG opcodes be ignored ? AS50156 If blank is specified in position 15 of H specs.

QS20157 What are the valid file types ( position 15 ) in F specification ? AS20157 I (Input file).

O (Output file).

U (Update file).

C (Combined (I/O) file).

QL40158 Specify different indicators used in RPG ? AL40158 Overflow indicators.

Record Identifying Indicators.

Field Indicators.

Resulting Indicators.

Control Level Indicators.

QL40159 What are Control level indicators ?

AL40159 L1 to L9 used to identify certain fields on control fields and then used to condition which operations are to be processed at detail or total calculation or output time.

QS20160 What is the use of E specification in RPG ?

AS20160 Extension Specs describes all record address files, arrays and tables.

QS30161 What is the use of L specs in RPG ?

AS30161 Line counter specification can be used to describe printer file to indicate the length of the form and number of lines per page.

QS10162 In which specification can a report layout be defined ? AS10162 O Specification.

QO30163 How many files can be defined in F specs ? AO30163 A maximum of 50 files.

QO30164 How many printer files can be defined in F specs ? AO30164 A maximum of 8 files.

QS20165 Give three main purposes of File specification ?

AS20165 To define files, to describe the files, to assign the files to specified devices.

QS20166 How do you specify page overflow indicator for printer files in RPG ? AS20166 Specify an indicator in positions 33-34 of F specification.

QS20167 What is a Primary File ?

AS20167 It is used in RPG Program Cycle to automatically read records in a cycle.

QO30168 Can an indexed file be accessed in arrival sequence in RPG program ? AO30168 Yes.

QS20169 What is a program described file in RPG ?

AS20169 The field name and length of the fields are defined with in the RPG program.

QS20170 What is an externally described file ?

AS20170 All information about the fields is specified in DDS and the RPG program can use them with in the program.

QO30171 Can you specify a display file to be used in the following modes:

Input, Output or Combined modes?

AO30171 Yes.

QL40172 What are match fields indicators?

AL40172 Matching record indicator is seton when all the matching fields in the

record of a secondary file matches with all the matching fields of a record in a primary file.

QO20173 What is the length of a variable in RPG ? AO20173 6 Characters.

QS10174 What are the different arithmetic Opcodes ?

AS10174 ADD, SUB, MULT, DIV, MVR, SQRT, XFOOT, Z-ADD, Z-SUB.

QS10175 When is a TAG statement used in RPG ? AS10175 It is used as a Label.

QL30176 What are the different Opcodes available in RPG for Database access ?

AL30176 READ, CHAIN, WRITE, UPDAT, DELET, SETLL, SETGT, READE, READP, REDPE, OPEN, CLOSE, FORCE, NEXT, UNLCK.

QS10177 What is READP opcode ? AS10177 Read previous record.

QS10178 What is REDPE opcode ? AS10178 Read Prior equal record.

QO30179 How do you check if a division was whole division ? AO30179 Check the EQ indicator be set to '1'

QO30180 What opcode could be used to test an alphanumeric field for all numeric values?

AO30180 TESTN.

QO30181 What opcode will be used to test the zone of a character field ? AO30181 TESTZ.

QS40182 How do you specify Half Adjust ?

AS40182 It should be specified in the column 53 of C specs as 'H' to indicate half adjust.

It will be effective only if the resultant value is having more decimals than the result field.

QL30183 Explain the difference between READ, CHAIN and SETLL ? AL30183 READ operation reads the record currently pointed to, from a full

procedural file.

CHAIN operation retrieves a record from a full Procedural file, sets a record identifying indicator ON and places the data in the input fields.

SETLL operation position a file at the next record that has a key or relative record number that is greater than or equal to the search argument specified. The file must be fully procedural for all three opcodes.

QL30184 What does LO and EQ indicators signify in READ, WRITE and CHAIN operations ?

AL30184 LO indicator specifies the error status on the above operations.

EQ indicator specifies the EOF, Record not found.

QS30185 How can database records be read without lock ? AS30185 Put 'N' in position 53 of C specs.

QL20186 What is the difference between MOVE and MOVEL ?

AL20186 MOVE operation will transfer characters from the factor 2 to the result field, the move starts from rightmost character of factor 2.

MOVEL operation will transfer characters from factor 2 to the result field, the move starts from leftmost character of factor 2.

QS20187 How do you concatenate two string variables in RPG ? AS20187 Using CAT opcode or with MOVE followed by MOVEL.

QL30188 What are the string operations possible in RPG/400 ? AL30188 CHECK, CHEKR, SUBST, CAT, XLATE, SCAN.

QS10189 What does SUBST do ?

AS10189 Extracts a specified character string from a base character string.

QS20190 What does CHECK opcode do ?

AS20190 The check operation verifies that each character in the base string (factor 2) is among the character indicated in the comparator string(factor 1).

QS10191 In conjunction with which statements can ORxx and ANDxx conditions be used ? AS10191 DOUxx, DOWxx, IFxx, and WHxx.

QS10192 What is the difference between DOU and DOW ?

AS10192 DOU checks after entering into the loop, it is performed atleast once.

DOW check before entering into the loop.

QL20193 What is ITER and LEAVE opcodes do ?

AL20193 ITER transfers control from within a DO group to the ENDDO

statement of the DO group. It causes the next iteration of the loop to be executed immediately

LEAVE operation transfers control from within a DO group to the statement following the ENDDO operation.

QL20194 Which instructions support structured programming in RPG ? AL20194 ANDxx, CASxx, DO group, ELSE, ENDyy, IFxx, ITER, LEAVE,

ORxx, OTHER, SELEC, WHxx.

QS10195 What does 'SR' in columns 7-8 of C specs mean ? AS10195 Calculation operation is a part of RPG subroutine.

QL20196 Explain CASxx, and CABxx statements ?

AL20196 CASxx operation allows you to conditionally select a subroutine for

processing. The condition is based on the relationship between factor 1 and factor 2 as specified by xx.If the relationship is true the subroutine specified in the result field is processed.

CABxx operation compares factor 1 with factor 2 , if the condition specified by xx is true, the program branches to the TAG operation associates with the label specified in the result field.

QL30197 What is CLEAR and RESET ?

AL30197 CLEAR operation sets the elements in a structure (record format, array/table, data structure) or a variable (field, subfield or indicator) to zero , blank or '0' depending on the field type (numeric, character, indicator)

RESET operation sets the elements in a structure (record format, array/ table, data structure) or a variable (field, subfield or indicator) to its initial value.

QL40198 What is SCAN and XLATE ?

AL40198 SCAN operation scans a character string (base string) contained in factor 2 for a substring (compare string) contained in factor 1.

XLATE operation translates characters in source string (factor 2) to the from and to strings(factor 1) and put into the result field.

QL40199 How do you use commitment control in RPG program ? AL40199 Using COMIT operation.

Makes all changes to the files that have been specified in output operation since the previous COMIT or the beginning of operations under commitment control(if there has been no previous COMIT or ROLBK operation).

QS30200 How do you use exceptional write in C specs ? AS30200 Using EXCPT opcode.

QL30201 What does the opcode FREE do ?

AL30201 The FREE operation removes a program from the list of activated

programs, frees static storage and ensures program initialization (first cycle processing) the next time program is called. It does not close file or unlock data area.

QS30202 What does opcode POST do?

AS30202 Puts information in INFDS.

QS20203 What is the difference between WRITE and EXFMT of a display file ? AS20203 WRITE displays a record format on workstation,

EXFMT displays and accepts from the workstation.

QS20204 What is the difference between PLIST and KLIST ?

AS20204 PLIST operation defines a unique symbolic name for a parameter list to be specified in a CALL operation.

KLIST is a declarative operation that gives a name to a list of key fields.

QO30205 Can you have multiple key lists for a single file ? AO30205 Yes.

QS40206 What are the different types of arrays available in RPG ? AS40206 Pre-run time array.

Compile time array.

Run time array.

QL40207 How do you specify data for a compile time array ?

AL40207 You can specify in E specs about the no of entries per record, no of elements, length of each element with the corresponding data entered at the end of the RPG program starting with **.

QO30208 What is the maximum number of elements in an array ? AO30208 9999.

QO30209 Can we define Multi-dimensional arrays in RPG ? AO30209 No.

QS20210 What is XFOOT opcode ?

AS20210 Adds all the elements in a numeric array, and places the sum in the result field.

QS20211 How can we sort an array ? AS20211 By using SORTA opcode.

QS20212 What is MOVEA opcode do ?

AS20212 Transfer character to numeric values from factor 2 to result field.

MOVEA can be possible to ARRAY-ARRAY, ARRAY-FIELD, or FIELD-ARRAY.

QS20213 How to initialize an array ?

AS20213 CLEAR or MOVEA *blanks to array.

QS20214 What is LOKUP opcode do ?

AS20214 LOKUP opcode search for a particular element in an array / table.

QS20215 Can LOKUP operation be used for unsorted array ? AS20215 Yes.

QL20216 What is the difference between an array and a table ? AL20216 An array elements can be refered by array name.

Elements in array can be accessed by their position relative to other elements.

Table name does not refer to the entire set of table elements.

Elements in a table can not be accessed by their position relative to the other elements.

QO30217 What is the maximum length of a table name ? AO30217 6 characters.

QO20218 What is the syntax of a table name ? AO20218 Table name should start with TAB.

QS30219 How can the user implicitly open and close the files in RPG program ?

AS30219 Enter UC in position 71-72 of F specs.

Use OPEN and CLOSE opcodes in RPG program to open and close files.

QO20220 During input operation which indicator position is seton if there is a record lock?

AO20220 LO indicator position is seton.

QS20221 What is the significance of DEFN opcode on RPG ? AS20221 To define fields based on the attributes of another field.

To define a field as a data area.

QS20222 What are different ways by which you define working storage field ? AS20222 Explicitly define or use *Like DEFN.

QO30223 How many parameters can be defined in a RPG program?

AO30223 Max. 255.

QL40224 What are the different ways of ending an RPG program without a primary file ?

AL40224 SETON LR.

SETON H1 to H9 (halt indicators).

SETON RT.

RETRN.

By allowing an exception / error to end the program if . No exception / error subroutine is specified

. No return point is specified on an exception or error subroutine . The user's response is to cancel the program.

QL40225 Specify different ways by which RPG program can give error message to user?

AL40225 By calling the SUBR23R3 program as passing message id.

By defining the error message in DSPF.

QL50226 If you are trying to add a record in a file and an error is displayed, where do you look for error ?

AL50226 Check whether you have opened the file in Update mode.

Check whether you have specified 'A' in position 72 of F specs.

QL50227 What is a File Information Data Structure ?

AL50227 File Information Data structure (INFDS) can be defined for each file to make file exception/error information available to the program. A file

information data structure contains predefined subfields that identify:

. The name of the file for which the exception/error occurred

. The record being processed when the exception/error occurred or the record that caused the exception/error

. The last operation being processed when the exception/error occurred

. The status code

. The RPG routine in which the exception/error occurred.

QL50228 What is Program Status Data Structure ?

AL50228 A program status DS can defined to make program exception/error information available to an RPG program.

DS is defined as a program status DS by an S in position 18 of the DS statement.

*STATUS contains status code

*ROUTINE contains name of routine in which the exception/error occurred.

*PARMS contains the number parameters passed to this program from the calling program.

Specify heading information/TITLE.

Specify to begin on a fresh page/EJECT.

To control line spacing/SPACE.

Records to be inserted from other files at the point where it is specified/COPY.

QO30229 What is the maximum no. of times multiple occurrence DS can occur in a program ?

AO30229 9999.

QL30230 What is the difference between *LIKE and *NAMVAR ? AL30230 *LIKE defines the variables as in database.

*NAMVAR is used to define variables as data area.

QL30231 How is embedded SQL used in RPG ? AL30231 /EXEC SQL

+ SQL statements + --- + --- /END EXEC

QS30232 What are all the compiler directive statements ? AS30232 /TITLE, /EJECT, /SPACE, /COPY.

QS40233 How can RPG program send message to System Operator ?

AS40233 Use QCMDEXC as called program in the CALL statements, and use SNDPGMMSG to the operator.

QL50234 Where DBCS data will be used in RPG ? AL50234

 In any comment statement

 In comment field of E and C Specs

 In literals and constants

 As data in any character field, subfield, array or table.

QS40235 Where will control be passed after the execution of the *PSSR subroutine if the factor 2 of the ENDSR is blank ?

AS40235 Control will return to the next sequential instruction.

QS40236 How can the CPF error-id be retrieved when a program error occurs ? AS40236 CPF error codes are placed in the subfield location *STATUS for the

program status DS.

QS30237 How could indicators 50 to 99 be set to '0' in one instruction ? AS30237 Using 'MOVEA *ZEROS IN,50' .

QL30238 What are the figurative constants ?

AL30238 *BLANK/*BLANKS, *ZERO/*ZEROS, *HIVAL, *LOVAL, *ALL 'X..' are implied literals that can be supplied without a length, because the implied length and decimal positions of a figurative constant are

The same as those of the associated field.

QO30239 What is the maximum error severity for which the compilation of RPG program stops ?

AO30239 50, if LR is not seton.

Q6S2001 What are the earlier versions of RPG ? A6AS2001 RPG II & RPG III.

Q6L4002 Name the different ways by which RPG source program can be entered ? A6L4002 Interactively with SEU, In batch by using either OS/400 or Spooling functions.

Q6O3003 During input operation which indicator position is seton if the record is locked ? A6O3003 Position 56 - 57 (LO).

Q6O5004 What is the record lock status value ? A6O5004 Status value is 01218.

MISCELLANEOUS

In document Master Question Bank AS400 Iseries (Page 53-60)