External Files In Programs

  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View External Files In Programs as PDF for free.

More details

  • Words: 2,699
  • Pages: 10
Answers & descriptions

Questions 1 Given the following code excerpt: FREPORT

O

E

PRINTER USROPN OFLIND(*INOA)

What is the error in the above File specification description? 1. USROPN cannot be specified for an output file 2. The OFLIND keyword is not a file level keyword. 3. The parameter *INOA for the overflow indicator OFLIND is not valid for externally described files. 4. There is no error.

Option – 4 As indicators *INOA to *INOG and *INOV can be used only in case of Program described files.

Option – 4 2 Given the following code excerpt: FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords FQPRINTS O F 132 PRINTER OFLIND(*IN80) OQPRINTS E 10 O TITLE 10 O AUTH 20 O E 1 O CONT 30 O E HDG 2 O UDATE 10 O PAGE 20 O E DETAIL 1 O AUTH 20 O VERSNO 30 O CONT 40 O E HDG 2 O UDATE 10 O PAGE 20

As EXCEPT is not having factor2 it will write all record formats with name as blanks.

In the above example,which exception records are written when an EXCEPT operation with no entry in factor 2 is processed? C

EXCEPT 1. Since no factor 2 entry has been specified for EXCEPT, all exception records are printed. 2. Only CONT will be printed 3. If indicator 10 is off,TITLE and AUTH would be printed. CONT will also be printed. 4. If indicator 10 is on,TITLE and AUTH would be printed. CONT will also be printed 5. Since factor 2 entry has not been specified it will not be complied

3 What will be the result for the following Code?

Option – 2

As the type of record format is H (‘HEADER’) it will print the o/p.

FQSYSPRT O F 80 PRINTER C Eval *INLR = *ON OQSYSPRT H NLR O 'Output' 1. 2. 3. 4.

The string 'Output' will be printed twice The string 'Output' will be printed Once The program ends without printing anything The program cannot be compiled as LR is not a valid indicator for Header Lines

4 If spacing and skipping are specified for the same line in a printer file, in what sequence the spacing and skipping operations are processed? a. 1. Space before Skip after b. 1. Space before Space after c. 1. Skip before Skip after d. 1. Skip before Space after

2. Skip before 5. Space after 2. Skip before 5. Skip after 2. Space before 5. Space after 2. Space before 5. Skip after

3. Print a line

4.

3. Print a line

4.

3. Print a line

4.

3. Print a line

4.

5 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? 1. 2. 3. 4.

Option – C SKIP has higher priority than SPACE. If SKIP is specified, it will skip the page first then it will skip lines before or after printing it.

Option - 4

They will be blank and/or zero. They will be null. They will equal the values of the first record in the file. They will equal the values of the last record read.

6 Consider the following scenario: Program A calls program B and program C. Program B has files under commitment control, and program C does not. Will a ROLBK operation in program C affect the files changed by program B? 1. Yes 2. No

Option – 1 As the COMMIT and ROLBK are JOB levels or Activation group level. Please refer page 707 of ILE RPG Ref.PDF in share.

7 The CHAIN operation is equivalent to which of the following? 1. 2. 3. 4.

Option - 4

SETGT and READ SETGT and READE SETLL and READ SETLL and READE

8 When is the NR indicator (position 71-72) for the SETLL operation set on?

Option - 1

1. When the search argument is greater than the highest key or relative record number in the file. 2. when a record is present whose key or relative record number is equal to the search argument 3. When the SETLL operation results in an error. 4. When a BOF condition occurs. 9 Given the following RPG IV code excerpt: FFILEA IF A E DSTRUCT DS DFLD1 1 DFLD2 6

DISK 5 9

The file FILEA is read and subsequently a WRITE is performed as shown below, where RECA is the record format of FILEA. C

WRITE

RECA

Option – 1 Result field can be specified in case of Program described files only with file name in factor2.

STRUCT

What is the error in the above code? 1. The result column should be blank for a WRITE operation, since the file to be written into is an externally described file. 2. The factor 2 operand should be the file name and not record name since the file to be written into is an externally described file. 3. The result column should always be blank for a WRITE operation. 4. No error in the code 10 Which of the following statements regarding the READPE opcode is true? (i) A READPE, with the search-arg operand specified, that immediately follows an OPEN operation or a Beginning of File condition, returns Beginning of File. (ii) A READPE, with no search-arg specified, that immediately follows an OPEN operation or a Begining of File condition,results in an error condition.

Option – 1 As READPE is issued with argument in factor 1 after opening the file without pointing to any position, it will return beginning of file.

(iii) A READPE, with the search-arg operand specified, that immediately follows an OPEN operation or a Beginning of File condition, results in an error condition. (iv) A READPE, with no search-arg specified, that immediately follows an OPEN operation or a Beginning of File condition, returns Beginning of File.

1. 2. 3. 4.

(i) and (ii) are true. (iii) and (iv) are true. Only (i) is true Only (iii) is true. Option – 2

11 Given the following RPG IV code excerpt: C

For READPE with blank argument program will through runtime error. (I/O Error )

FieldA

READPE

RecA

8899

Here

When will the indicators 88 and 99 be set on?

88 – Error indicator

(i) Indicator 88 is set on if the operation is not completed successfully. (ii) Indicator 88 is set on if the record key does not match FieldA. (iii) Indicator 99 is set on if the operation is not completed successfully. (iv) Indicator 99 is set on if the record key does not match FieldA.

99 – Not found indicator Or BOF indicator

1. 2. 3. 4.

(i) and (iii) are true (i) and (iv) are true (ii) and (iv) are true (ii) and (iii) are true

12 Consider the following scenario: A valid input operation with lock (READ, READC, READE, READP, READPE or CHAIN) is successfully issued to a particular record format. then an intervening unsuccessful input operation is issued to the same record format before issuing an UPDATE. Will the UPDATE be successful? 1. The UPDATE will be unsuccessful for both disk files and subfiles. 2. The UPDATE will be successful for subfiles but will update the locked record retrieved from the first input

In program 88 is the LOW and 99 is the Equal indicators at positions 73-74 and 75-76 respectively. Hi indicator (71-72) is not allowed for this operation.

Option - 2

operation. The UPDATE will fail for disk files. 3. The UPDATE will be successful for disk files but will update the locked record retrieved from the first input operation. The UPDATE will fail for subfiles. 4. The UPDATE will be successful for both disk files and subfiles and will update the locked record retrieved from the first input operation

13 Which of the following I/O operations make up the EXFMT operation? 1. 2. 3. 4.

Option - 4

READ followed by a WRITE READ followed by an UPDATE READC followed by an UPDATE WRITE followed by a READ

14 Given the following RPG IV code excerpt: FSCREEN C C C

Option - 2

CF E WORKSTN EVAL OUTFLD=12 EVAL INPFLD=1 EXFMT SCRREC

What will be the values of the following fields on the screen? (i) input field INPFLD (ii) output field OUTFLD 1. 2. 3. 4.

15

1 and blanks blanks and 12. 1 and 12 both fields will be blanks.

In the DDS for a display-device file, if a function key is described as a command function key (CF), then which of the following is returned to the program? 1. Only the response indicator 2. Only the data record. 3. The response indicator and the data record (with any modifications entered on the screen) 4. The response indicator and the data record (without any modifications entered on the screen)

Option – 3 For Command Attention key answer will be 1.

16 Which of the following are valid record types for a display file?

Option - 4

(i) PDNSFL (II) PULDWN (III) USRDFN (IV) MNUBAR 1. 2. 3. 4.

(I) and (iv) (i) and (ii) (i),(iii) and (iv) (i), (ii) ,(iii) and (iv)

17 Given a full procedural, externally-described input file named ORDER with a record length of 41 bytes, which of the following is a valid format for the File specification for the ORDER file? 1. FFilename++IPEASF.....L.....A.Device+.Keywords FORDER IF E DISK 2. FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords FORDER IPE F 41 DISK 3. FFilename++IPEASF.....L.....A.Device+.Keywords FORDER IF E 41 DISK 4. FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords FORDER IF F DISK 18 Given the following RPG IV code excerpt:

Option – 1 Record length must not be specified for externally described files.

Option - 2

FFilename++IPEASF.....L.....A.Device+.Keywords FORDERS IF E K DISK USROPN Which of the following options describes the result of using the USROPN keyword 1. This file will be opened immediately when this program is called. 2. This file must be opened with an explicit OPEN operation prior to accessing this file. 3. This file must be opened with the CL command OPNDBF prior to the call to this program. 4. This file will be opened when the program reaches a C specification that issues a READ or CHAIN to this file. 19 In an RPG program, where is the information available to determine which member of a multiple-member physical file is currently being processed? 1. 2. 3. 4.

Option – 4 At position 129 to 138

in the initialization subroutine in the program status subroutine in the program status data structure in the file information data structure

20 Which of the following is the result of using PREFIX(XX:2) on a File

Option - 2

Definition specification line for a file FILE01 that has one field named FIELD1 ? 1. 2. 3. 4.

file FILE01 is renamed to XXLE01 field FIELD1 is renamed to XXELD1 field FIELD1 is renamed to XXFIELD1 field FIELD1 is renamed to FXXIELD1

21 What is the maximum number of record formats in a printer file and maximum number of fields in any one record format in a printer file? 1. 2. 3. 4.

2048 and 31,628 respectively 512 record formats and any number of fields. Only one record format and any number of fields. 1024 and 32,767 respectively

22 SKIPA can be performed at which of the following levels? 1. 2. 3. 4.

Option - 4

Option - 4

Record level only. File level and record level. Field level and record level Record level, file level and field level.

23 An RPG program uses an externally described printer file and an input file that it will read. If the printer file uses the same field names that are used in the input file, then which of the following statements is true?

Option - 1

(i) The field names should have the same length and type in both definitions. (ii) The most recently assigned value will be used for all occurrences of the field. (iii) Error occurs since RPG cannot handle two or more fields having the same name. (iv) The values in the fields defined in the printer file will override the values of all other fields having the same name. 1. 2. 3. 4.

(i) and (ii). (iii) only (ii) only (i) and (iv)

24 Which of the following is true regarding the EDTCDE (Edit code) keyword in printer files used to edit output-capable numeric fields? 1. You cannot specify EDTCDE and EDTWRD for the same field. 2. Edit codes 1 through 4 represent user defined edit codes. 3. The DFT keyword cannot be specified with the EDTCDE keyword. 4. Option indicators are not valid for this keyword.

Option - D

a. b. c. d.

1&2 1, 2, 3 & 4 1, 2 & 3 1, 3 & 4

25 Given the following RPG IV code excerpt:

Option - 4

FFILEA UF A E DISK EXTMBR(mbrname) Which of the following regarding the variable mbrname is NOT true? 1. The variable mbrname can be set by using the INZ on the D specification. 2. The variable mbrname can be set by passing the value in as an entry parameter 3. The variable mbrname can be set by using a programglobal variable that is set by another module 4. The variable mbrname can be set by using the EXTFLD keyword. Option - 3

26 Given the following code excerpt: FDBEMP

IF F 10

DISK

extfile(flname)

Also given that, the following commands are in effect. OVRDBF FILE(FILE1) TOFILE(OTHERLIB/FILE2) OVRDBF FILE(DBEMP) TOFILE(OTHERLIB/FILE1) If the variable flname has the value MYLIB/FILE1 at runtime and the current library is MYLIB, then which file will RPG open at runtime? 1. 2. 3. 4.

DBEMP MYLIB/FILE1 OTHERLIB/FILE2 OTHERLIB/FILE1

27 Given the following RPG IV code excerpt: FFilename++IPEASF.....L.....A.Device+.Keywords FFILEX IF E DISK C OPEN FILEX Since an OPEN operation is specified for a file that is already open, an error occurs. How can this error be avoided?

Option – 3 USROPN is not needed for OPEN & CLOSE opcodes.

A. By specifying the USROPN keyword on the file description specification. B. By explicitly closing the file using CLOSE opcode before opening it. 1. 2. 3. 4.

A only B only Using Either A or B Using Both A and B.

28 If you specify a file name without a library name as a parameter for the EXTFILE keyword, then which library name will be used? 1. 2. 3. 4.

QTEMP *LIBL System Value QUSRLIBL Error occurs, since library name is mandatory.

29 What will be the result for the following Code if the printer file TESTPRTF does not exists? FTESTPRTF O F 80 PRINTER C Eval *INLR = *ON OTESTPRTF H NLR O 'Header' O D NLR O 'Detial' 1. 2. 3. 4.

The string 'Header' and 'Detail' will be printed. The string 'Header' will be printed Once The program ends with ERROR. The program cannot be compiled as LR is not a valid indicator for Header Lines

30 SPACEA can be performed at which of the following levels? 1. 2. 3. 4.

Option -2

Option – 3 Program described files are never created by the program. This is basically used for formatting the file. The object for the file should exist in the libl to run the program. Compilation will not throw any error.

Option - 2

Record level only. File level and record level. Field level and record level Record level, file level and field level.

31 What is the maximum number of record formats allowed for Physical File? 1. 1 2. 512

Option - 1

3. 1024 4. *NOMAX 32 Which of the following we can get from File information Data Structure? a. Read count b. Write count c. Record format name d. Last Opcode processed on the file e. End Of file indication 1. 2. 3. 4.

Option - 1

All Only C & D A, B, C & E A, B & D

33 When is the indicator (position 75-76) for the SETLL operation set on? 1. When the search argument is greater than the highest key or relative record number in the file. 2. when a record is present whose key or relative record number is equal to the search argument 3. When the SETLL operation results in an error. 4. When a BOF condition occurs.

Option - 2

Related Documents

Cobol Files Programs
November 2019 13
External
November 2019 37
Programs Done In Nalco
November 2019 10
Programs
October 2019 61
Training Programs In Lcp
December 2019 35