Sie sind auf Seite 1von 12

RPG Questions :

1. What is needed in an RPG program to receive parameters? An *ENTRY parameter list.

2. What is KLIST used for? To define a composite key.

3. What is CASxx used for? To execute subroutines based upon the result of a logical comparison.

4. What is the advantage of using *LIKE DEFN? It automatically updates attributes of the work field, when attributes of the base field change and the program is recompiled.

5. What is the difference between just exiting a program with RETRN or by setting on indicator LR, first? Open files are closed when exiting with LR equal to ON. Open files remain open when using RETRN with LR equal to OFF, and the program is still resident (potentially active.)

6. What RPG operation codes are associated with data areas? IN, OUT, UNLCK and DEFN.

7. How are the following RPG operation codes used? a.) CAT To concatenate fields and /or constants. b.) SCAN To search fields/arrays/data structures for the occurrence and start position of a string. c.) CLEAR To initialize fields, record arrays, data structures to blanks or zeros.

8. What operation code should be used to check for the existence of a specific record in a keyed file? SETLL should be used. CHAIN should be used only if data from the file is needed.

9. How are parameters accepted in an RPG program?

*ENTRY

PLIST

10. How are parameters passed in RPG? CALL ‘----‘ PARM xxx

11. How do you define a subfile in RPG? IPFC(prompt) ---- RRN KSFILE rcdfmt-name.

12. What is a compile-time table?

A table whose information is hard coded in the program source.

13. What is a pre-execution table?

A table whose data comes from an external file.

14. How is data accessed from a table?

A LOKUP operation.

15. How can a subroutine be executed?

EXSR

16. How can indenting be utilized to make it easier to read a compiled RPG program? By overriding the indent parameter in the CRTRPGPGM command with a character.

17. What is the use of the MOVEA operation? To transfer data to an array or transfer an array to another storage location.

18. What is the difference between the MOVE and the MOVEL? MOVE transfer is a right justified move, MOVEL is a left justified move.

19. How does the READP work? It reads data from a physical file in reverse order.

20. What is the operation SELEC used for? For CASE structure handling.

21. What is an externally described file? Any DDS file that has its’ layout automatically defined as part of the RPG program.

22. What is a level checking error? When a HLL object isn’t linked with the current DDS object.

23. What does the phrase “subscript out of range” mean? It means you are trying to access an area outside of the defined table range.

24. What is an Output queue (such as *OUTQ?) An area, which stores all spooled files waiting to be printed.

25. What is an Job queue (such as *JOBQ?) An area that stores all jobs waiting to be compiled.

26. What does IPL stand for? Initial Program Load, which is used for start-up.

27. What is PWRDWNSYS? The command to power down the AS/400.

28. What is the purpose of the EDTOBJAUT command? To permit or exclude user access to specific objects.

Subfiles Questions :

29. What DDS keywords are required when defining a control record format? SFLCTL, SFLDSPCTL, SFLPAG, SFLSIZ.

30. What operation codes can be used to retrieve subfile record? READC and CHAIN.

31. Explain 2 ways of handling the roll-up/roll-down keys in an RPG subfile program. If SFLSIZ > SFLPAG, OS/400 will handle scrolling. If SFLSIZ = SFLPAG, the programmer must handle scrolling by checking roll-up or roll-down indicators and filling subfile appropriately.

32. Explain the following DDS keywords:

a.) SFLEND Controls the display of “plus sign.” b.) SFLNXTCHG Controls “modified data tag” on subfile records. c.) SFLRCDNBR Controls what subfile page is displayed and where cursor goes. d.) SFLDROP Controls when a subfile fold area is displayed.

33. How do you clear a subfile? Set the indicator associated with the SFLCLR keyword to ON and WRITE the subfile control format.

34. What are the 3 types of subfiles? Single page, expandable and load-all.

35. Which type of subfile has the better performance? Single page.

36. What is a subfile control record? The record that controls the display of the record format and text information.

37. What is a subfile record number? The internal value associated with the each subfile record.

38. How are roll keys handled by the program and in the system? a.) Using ROLLUP and ROLLDOWN keyword indicators, or b.) Automatically, if SFLSIZ > SFLPAG.

39. What is a subfile record format? The record that contains the displayable data.

40. What must follow the SFLCTL keyword in the subfile control record? The name of the Subfile Record Format.

41. What does the SFLNXTCHG keyword mean? To activate the READC operation and allow all records to be modified as changed records.

42. How do you utilize the subfile message control? By using SFLMSG and MSGLOC keywords.

43. How does a subfile handle displaying multiple lines of subfile data?

Use the SFLDROP keyword at record level in the control record and assign a command key to the keyword. Ex: SFLDROP(CF11).

44. Define the following keywords: SFLPAG and SFLSIZ? a.) Number of records displayed per page. b.) Number of total records displayable in the subfile.

CL Questions:

45. If the field is defined in DDS, how is it referenced in a CL program? By declaring the field(DCL) and placing an ampersand in front of the variable name.

46. What is the main use of MONMSG? Error trapping.

47. What is the purpose of the DCL statement in a CL program? To define variables.

48. How do you read a specific record in a keyed database file in a CL program?

OVRDRF FILE(filename)

POSITION(*KEYx a b c) and RCVF

49. How do you access the local data area in a CL program? RTVDTAARA DTAARA (*LDA) RTNVAR (&var)

50. What CL command is used to read a file? RCVF - Receive File

51. What CL command is equivalent to write a display file in RPG? SNDF - Send File

52. What CL command is equivalent to write/read a display file in RPG? SNDRCVF - Send/Recieve File

53. What CL command is used to determine the logical files associated with a particular physical file? DSPDBR - Display Database Relations

54. Explain the use of DSPFFD. To display a physical files record layout structure.

55. Why would a programmer use the OVRDBF command? To override default values set for the physical file; i.e., to utilize a specific member in a physical file.

56. What CL command is used to debug a program on-line? STRISDB - Start Interactive Debugger

57. What is the CPYF command used for? a.) To print all records in a physical file, b.) To transfer records from one PF object to another PF object.

58. What is the purpose of the *MAP and *NOCHK in the CPYF command? a.) To transfer data byte by byte. b.) To transfer data field by field regardless of field names.

59. What is the purpose of the CHGVAR command? To change the value associated with a CL variable.

60. How does a programmer create a new variable within a CL program? By using the DCL command.

61. What is a command label? An area of transfer within a CL program from which to continue processing directed by a GOTO command.

62. Explain parameter passing. To pass variables from a CL or RPG program to another CL or RPG program.

63. How can a programmer exit out of a CL program? By using a RETURN command.

64. Why would the PGM line contain a PARM? The CL program is using a value passed from another processing program.

65. How can a programmer send a message from a CL program? Using the SNDPGMMSG command - Send Program Message.

66. What does the DSPPFM command do? Displays a list of records on the CRT from the physical file.

67. What is the purpose of the DSPLIBL command? Displays a list of all libraries whose objects are available to the interactive job.

68. Explain the STRSEU command. To create a new program or put the last used program in edit mode

DDS Questions:

69. In the DDS keyword WINDOW(

),

what belongs inside of the parentheses?

Either the coordinates of the window or the name of the record format.

70. What is the difference between CA and CF command keys? CA means that screen validity checking is bypassed and no screen data is passed to the program. CF means that screen validity checking is performed and screen data is passed to the program.

71. What is the DDS keyword UNIQUE used for? To prohibit duplicate keys in a keyed database file.

72. Does a logical file contain data? No, it contains access path information only.

73. Name three types of access path maintenance. Immediate delayed and rebuild.

74. What are two methods of creating a record that consists of fields from two or more files? Join, LF and OPNQRYF.

75. What keyword is used to reference the same field in another file? REF - Reference

76. What keyword is used to join several physical files into one logical file? JFILE - Join File

77. What does DDS stand for? Data Description Specifications.

78. What command can be used to clear a physical file? CLRPFM - Clear Physical File Member

79. What is the difference between a physical file and a logical file? Physical files contain the data, a logical file us an access path to the physical data.

80. Can you copy data from a physical file to a logical file? No.

81. What is a display file?

A displayable screen file.

82. What is a printer file?

A print layout for a report that can be used by any program.

83. Can a physical file contain more than one member, and how is it accessed?

Yes, by using OVRDBF(

)

MBR(

)

84. What does the Open Query file do? Creates an open data path to physical file data.

85. When a PF is compiled and default values used how many members does it have?

1

86. What is the keyword VALUES used for? To set records from a PF based on field values in storage.

87. What is the keyword COMP used for? To set records from a PF using a comparison between two field values.

88. What is the keyword RANGE used for? To set records from a PF based on a min/max value of a field.

89. Why would a DSPF program use a DSPSIZ keyword? To select the screen display size used.

90. What is the INDARA keyword used for? To store all program indicators into a useable array.

91. What is the purpose of the OVERLAY keyword? To allow multiple screen records to display at one time.

92. How can a programmer control how data on a screen will display? By using the DSPATR keyword.

Miscellaneous:

93. What is QTEMP?

A unique temporary library associated with each job. It is deleted at the end of a job.

94. What is the purpose of level checking?

To ensure that the version of a file used by a program has not changed since the program was compiled.

95. What two CL commands are usually used to debug a program? STRDBG and ADDBKP - Start Debug and Add Breakpoint.

96. What is QCMDEXC? A program that can be called from an RPG program to execute most CL commands.

97. What is the purpose of the CHKOBJ command? To test for the existence of and object and to check for object authorization for the user.

SAMPLE TEST QUESTIONS:

1. In addition to the CHGCURLIB command, which of the following commands allows you to set your

current library in an interactive job?

A.

ADDLIBLE

B.

RPLLIBL

C.

EDTLIBL

D.

CHGLIBL

2.

Which of the following CL commands can be used to determine which logical files are dependent on a

specific physical file?

A.

DSPPFM

B.

DSPDBR

C.

DSPOBJD

D.

DSPPFREL

3.

Which of the following CL commands can be used at program execution to redirect the file named in

an RPG program?

A.

OVRDBF

B.

ALCOBJ

C.

OPNDBF

D.

OPQNRYF

4.

Which of the following CL commands is used to trap error messages during program execution?

A.

RCVMSG

B.

RMVM

C.

MONMSG

D.

RTVMSG

5.

Which of the following types of activation groups is automatically deleted when the last program in the

call stack ends?

A.

QILE

B.

*CALLER

C.

*NEW

D.

named

6.

In which of the following examples would the use of a "compile-time" array be appropriate?

A.

a database file contains the array data

B.

the array data is created during program execution

C.

the array data changes frequently

D.

the array data does not change frequently

7.

In the code segment below, what would be the value of field Y after the second statement has executed? * ARR=NUMBER OF ELEMENTS= 7 ELEMENT LENGTH = 1

* X = 7, ARR = '5374269'

CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++

C

Z-ADD1

Y

C

X

LOKUPARR,Y

90

A. 1

B. 3

C. 5

D. 7

8.

In the following code, %SUBST is a(n)

 

CL0N01Factor1+++++++Opcode(E)+Extended-factor2+++++++++++++++++++

C

EVAL

Result = %SUBST(Flda : Str : Len)

A.

built-in function.

B.

free form expression.

C.

procedure.

D.

initializer.

9.

Which of the following lines correctly initializes a date variable when the default date format of the

program is *ISO?

A.

D Date_Fld S D DATFMT(*USA) INZ('D'19970712)

B.

D Date_Fld S D DATFMT(*USA) INZ(D'1997-07-12')

C.

D Date_Fld S D DATFMT(*USA) INZ(D'07/12/1997')

D.

D Date_Fld S D DATFMT(*USA) INZ('D'071297)

10.

In an RPG program, where is the information available to determine which member of a multiple-

member physical file is currently being processed?

A.

in the initialization subroutine

 

B.

in the program status subroutine

C.

in the program status data structure

D.

in the file information data structure

11.

Based on the following example, the value of Result is how many months?

 

D

Date_A

S

D

INZ(D'1997-01-31')

D

Date_B

S

D

INZ(D'1997-04-30')

D

Result

S

3P 0

 

*

 

CL0N01Factor1+++Opcode(E)+Factor2+++Result++++Len++D+HiLoEq.

 

C

Date_B

SubDur

Date_A

Result:*Months

12.

Given the following code, what is the value of RESULT?

DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++

D RESULT

S

5

0

CL0N01Factor1+++++++Opcode&ExtExtended-factor2+++++++++++++++++

C

EVAL

RESULT = (2 + 3 * 2) ** 2 / 2

A. 8

B. 10

C. 32

13. What ILE RPG/400 code produces the same results as the RPG/400 code shown below?

CL0N01N02N03Factor1++OpcdeFactor2++ResultLenDHHiLoEqComments+

C

A

ADD B

SUM1

C

SUM1

MULT X

RSLT

C

RSLT

DIV TOT

ANSW

CL0N01Factor1+++++++Opcode(E)+Extended-factor2+++++++++++++

A. C

EVAL

ANSW = (A + B) * X / TOT

B. C

EVAL

(( A + B ) * X) / TOT = ANSW

C. C

EVAL

(A + B) * X / TOT = ANSW

D. C

EVAL

ANSW = A + B * X / TOT

14. What is the value of FldA after the following code is executed? DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++

D FldA

CL0N01Factor1++Opcode&ExtFactor2+++++++Result++++Len++D+HiLoEq

S

2

0 INZ(0)

 

C

DO

2

C

SELECT

C

WHEN

FldA = 0

C

ADD

1

FldA

C

WHEN

FldA = 1

C

ADD

2

FldA

C

WHEN

FldA = 2

C

ADD

3

FldA

C

ENDSL

C

ENDDO

A.

1

B.

3

C.

5

D.

6

15.

What operation code must be used on statement 006 of the following code so that the value of TOTAL

will equal 35? FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords++++++++++

001

FCUSMAS

IF

E

K DISK

 

DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++

002

D TOTAL

S

3 0 INZ(0)

003

D CUSTNO

S

5

INZ('B')

 

CL0N01Factor1+++++++Opcode&ExtFactor2+++Result++Len++D+HiLoEq

005

C

CUSTNO

SETLL

CUSMAS

006

C

*IN30

007

C

READ

CUSMAS

30

 

008

C

IF

NOT *IN30

009

C

ADD

FLDA

TOTAL

010

C

END

011

C

END

CUSMAS file, keyed by CUSTNO, contains the following data:

CUSTNO FLDA

A101

A102

B100

10

20

05

C100

20

16. Which of the following file specifications will open the display file DSP01 with subfiles named SFL01

and SFL02?

FfilenameIPEAF

RlenLK1AIOvKlocEDevice+

KExit++Entry+A

U

A. FDSP01 CF E WORKSTN RRN01 KSUBFL SFL01 RRN02 KSUBFL SFL02

B. FDSP01 UF E WORKSTN RRN01 KSFILE SFL01 RRN02 KSFILE SFL02

C. FDSP01 UF F WORKSTN RRN01 KSUBFL SFL01 RRN02 KSUBFL SFL02

D. FDSP01 CF E WORKSTN RRN01 KSFILE SFL01 RRN02 KSFILE SFL02

17. If the last record of a file has been read, and the next operation on that file is a READ operation, what

will be the values of the input fields for that file?

A.

They will be blank and/or zero.

B.

They will be null.

C.

They will equal the values of the first record in the file.

D.

They will equal the values of the last record read.

18.

Given the DDS specifications below and the following information:

indicator 20 is on no records have been written to SFL1

What will be the result if the EXFMT operation code is performed on record format CTL1?

AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions+++++++

A

R SFL1

SFL

A

FLD01

10

I 6 10DFT('FLD01TEXT')

*

A

R CTL1

SFLCTL(SFL1)

A

SFLSIZ(0010)

A

SFLPAG(0005)

A

SFLDSPCTL

A 20

SFLDSP

A

FLD02

10

O

5 10

A.

Only FLD02 is displayed.

B.

SFL1 will be initialized with ten blank records.

C.

An I/O exception error will occur.

D.

The screen will display five records with "FLD01TEXT."

19.

The DATFMT Keyword allows you to specify which three of the following date formats?

A.

*USA

B.

*MDYC

C.

*ANSI

D.

*YDM

E.

*JUL

F.

*ILE

G.

*ISO

H.

*SAA

20.

Which three of the following reserved words can be used to define subfields in the program status

data structure?

A. *ROUTINE

B. *PARMS

C. *ERROR

D. *STATUS

E. *USER

F. *SOURCE

G. *FILE

21. Which of the following debug commands combines the functions of setting a breakpoint and displaying a program variable?

A. RSMBKP

B. ADDBKP

C. DSPBKPVAR

D. ADDBKPVAR

SAMPLE TEST ANSWERS:

1. D

2. B

3. A

4. C

5. C

6. D

7. B

8. A

9. B

10. D

11. 2

12. C

13. A

14. B

15. DOU

16. D

17. D

18. C

19. A,E,G (You must select all three correct answers to receive credit for this question.)

20. A,B,D (You will receive partial credit for selecting any of the three correct answers. The test engine will

accept only three correct answers.)

21. B