Wednesday, March 5, 2008

Fun Series with iSeries - 05 Mar 2008 - Maheedar

1. What are the maximum no of Monmsgs that a CL can handle?
100
2. How can we display a window with out having a window record format in the display file?
QUILNGTXT
3. If all the indicators (1 - 99) are used in a program, how do we set the display file field attributes with out reusing the already used indicators.
DSPATR(&Attr) and Program to System fields (P-Fields)
4. How many files can be declared in a CL program?
5
5. How to refer to the fields of a file when multiple files are declared in CL?
&OPNID_Field Name
6. How to put a file in commitment control dynamically in a RPGLE program?
COMMIT(Variable)
7. How can we send multiple attachments at a time through email using AS400 program?
QtmmSendMail
8. What difference between '+' sign and '-' in the end of the line of CL program?
The difference is that all the blanks in the next record that precede the first non-blank character are ignored when a plus sign is coded and included when a minus sign is coded.

9. If I change the text for a source, is there any other way to reflect that change in the text of the object other than compilation?
Yes. Use CHGPGM command to change the object text of a CL program without recompiling the program. The CHGPGM command automatically recompiles the program with the changed text. However, the attribute FRCCRT should be (*YES) on CHGPGM command for automatic compilation.
10. The maximum number of sub files that can be active at a time?
12
11. What is the default value for the number of increments for the physical file?
3
12. How to include copy books while debugging the RPG program?
Compile the program with *COPY compiler option
13. What happens if a file is created with expiry date less than current date?
If a file is created with EXPDATE less than current date the file gets created but member is not added on creation. An error message is sent at the time of creation saying that the EXPDATE is invalid

14. How to send a break message from RPG program?
You can use the API QEZSNDMSG. Break messages can be sent to work station queues only. This API will derive all the work station IDs to which a given user is signed on and a break message is sent to all those work stations.

Wednesday, February 6, 2008

Fun Series with iSeries - 06 Feb - Swetha

1.How can I retrieve an IP address of a session AS400?
a. (QDCRDEVD API)


2. Which is the better option to write a transaction (order header and detail transaction) using two physical files or one join logical file(on those two physical files) in a program and why ?
a. Using two physical files is the better option because records can't be written through join logical file.



3. What is the disadvantage of using Global variable?
a. We can not trace out at which point the value of variable is changed.



4. How many triggers can be associated with a file?
a. 6(Maximum)


5. How many types of objects are there on As/400?
"
a. 80


6.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

a. *NEW


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

Dname+++++++++++ETDsFrom+++To/L+++Idc.Functions. . . . . .
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

a.2months




8.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.

a. D





9. 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

a. A,E,G



10. In a program using the control level indicators L1, L2, and L3, in
what sequence are control level calculations processed at LR time?

A. L1, L2, L3, LR
B. LR, L3, L2, L1
C. Only LR calculations are processed.
a. A


11.Which of the following contains only invalid operation code extender?

a. H, M, P
b. N, P, Z
c. H, N, P
d. H, L, N

a. D


12. Which of the following contains only valid File Specification keywords?

a. IGNORE, MAXDEV, SFLLIN
b. SFILE, CALLP, INCLUDE
c. INDSP, INFDS, PREFIX
d. PGMNAME, PLIST, RECNO
e. none of the above
a. E


13. What is the maximum width we can give to report ?
a. 378


14. What is use of Keyword FROMFILE ?
a. The FROMFILE keyword specifies the file that contains the input data for the prerun-time array or table being defined.
The FROMFILE keyword must be specified for every prerun-time array or table used in the



15. In what year was the AS/400 renamed the eServer iSeries?
a. (2000)



a. 1998
b. 1999
c. 2000
d. 2001

Wednesday, January 2, 2008

Fun Series with iSeries - 02 Jan 2008 - Bodhi

1. What is dimension of the 2nd and 3rd fields of the API QCMDEXC
Ans: Length of command string Input Packed (15,5)
Optional Parameter: IGC process control INPUT Char(3)

2. I have a date variable, which I have initialised as
D myDate s d inz(d'2007-03-31')
myDate = myDate + %Months(1) ;
What will be the value in MYDATE
Ans: MYDATE = '2007-04-30'

3. How can we execute a CL command from RPG apart from API QCDEXC
Ans: D GoCmd PR 10I 0 Extproc('system')
D CmdString * Value
D Options(*String)

4. If the command that gets executed gets a CPF message, this message is stored in a global variable. This variable you can import in your program
Can any one tell me what is that variable and what is the dimension
Ans: D ExceptionMsg S 7A Import('_EXCP_MSGID')

5. In the SNDDST command we can send messages to the distribution list. Can you tell me how many characters
we can send thru the parameter MSG And LONGMSG. And how can you mention New Line and New Paragraph in your message.
Ans: MSG - 256
LONGMSG - 5000
New Line - /N
New Paragraph- /P

6. I have a packed variable of length 11P2 And the other 12P2.
Now, if I use the %Size to get the number of bytes.... how much will it show
Ans: 11P2 - 6
12P2 - 7 N/2 + 1

7. What is the length of the Timestamp field.
Ans: For the timestamp (Z) data type, the field length is 26. The format of a timestamp field is
yyyy-mm-dd-hh.mm.ss.mmmmmm


7B. Define a Char field in the Physical file which allocates a length of 5 and Max Length of 20
Fld1 20A VARLEN(5)
CREATE TABLE MyTable
(Varying VARCHAR (20),
Allocate5 VARCHAR (20) ALLOCATE(5))

8. If we write a syntax like numeric variable div by Zero will it compile....(RPG And CL)???
No... RPG Yes CL

9. Message Ids for
1. Attempt made to divide by zero for fixed point operation. - what is the error no?
A: MCH1211

2. Pointer not set for location referenced. - what is the error no?
A: MCH3601

3. If I say I am getting MCH0603, can you tell me what error I am reffreing to...
Range of subscript value or character string error

10. Max Record Length for a file - 99999