HI,
1: WHAT IS THE FUNCTION OF %KDS?WITH PROGRAMMING CODES
EXAMPLE
2: WHAT IS THE FUNCTION OF Z-ADD AND Z-SUB ? WITH
PROGRAMMING CODES EXAMPLE
1:
%KDS is allowed as the search argument for any keyed
Input/Output operation (CHAIN, DELETE, READE, READPE, SETGT,
SETLL) coded in a free-form group. The search argument is
specified by the subfields of the data structure name coded
as the first argument of the built-in function. The key data
structure may be (but is not limited to), an externally
described data structure with keyword EXTNAME(...:*KEY) or
LIKEREC(...:*KEY)..
Notes:
The first argument must be the name of a data structure.
This includes any subfield defined with keyword LIKEDS or
LIKEREC.
The second argument specifies how many of the subfields
to use as the search argument.
The individual key values in the compound key are taken
from the top level subfields of the data structure.
Subfields defined with LIKEDS are considered character data.
Subfields used to form the compound key must not be arrays.
The types of all subfields (up to the number specified
by "num-keys") must match the types of the actual keys.
Where lengths and formats differ, the value is converted to
the proper length and format.
If the data structure is defined as an array data
structure (using keyword DIM), an index must be supplied for
the data structure.
Opcode extenders H, M, or R specified on the keyed
Input/Output operations code affect the moving of the search
argument to the corresponding position in the key build area.
Example:
Figure 205. Example of Search on Keyed Input/Output Operations
A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++
A R CUSTR
A NAME 100A
A ZIP 10A
A ADDR 100A
A K NAME
A K ZIP
FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++
Fcustfile if e k disk rename(CUSTR:custRec)
DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++
D custRecKeys ds likerec(custRec : *key)
...
/free
// custRecKeys is a qualified data structure
custRecKeys.name = customer;
custRecKeys.zip = zipcode;
// the *KEY data structure is used as the search
argument for CHAIN
chain %kds(custRecKeys) custRec;
/end-free
Googled/ref :-
http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/com.ibm.etools.iseries.langref.doc/c0925086640.htm
2: Z-ADD and Z-SUB does the ADD/SUB resp. to a field of Zero.
Z-ADD 5 VAR
** (VAR now has 5)
ADD 10 VAR
** (Var now has 15)
Z-ADD 20 VAR
** (Var now has 20 and not 35)
*...1....+....2....+....3....+....4....+....5....+....6....+....7...
CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++*
C* Before the operations are processed, the field values are:
C* A = 1.00 G = 2.77
C* B = 10.0 H = 70
C* C = 32 J = .6
C* D = -20 K = 25
C* E = 6. L = 1.0, 1.7, -1.1 RESULTS
C* F = 10.0 -------
C ADD 1 A 30 002
C B ADD C V 52 042.00
C B ADD D V -10.00
C*
C Z-ADDC V 032.00
C*
C SUB 1 E 30 005
C C SUB B W 51 0022.0
C C SUB D W 0052.0
C*
C Z-SUBC W -0032.0
C*
C MULT E F 30 060
C B MULT G X 84
0027.7000
C B MULT D X
-200.0000
C*
C DIV B H 30 007
C C DIV J Y 62 0053.33
C*
C MVR Z 53 00.020
C*
C SQRT K Z 05.000
C*
C XFOOTL Z 01.600
Ref:-
http://publib.boulder.ibm.com/infocenter/iadthelp/v7r5/index.jsp?topic=/com.ibm.etools.iseries.langref.doc/evferlsh239.htm
Is This Answer Correct ? | 1 Yes | 0 No |
Are all these RPG/400 Interviewed Questions being asked recently? are current?
How do you call procedures in ILE?
what is overlay? how can we pass parameters in cl or rpg programing? how can we get data area value in cl or rpg programming?
How to code Page up and Page down in RPG for Single page subfile without using ROLLUP/ROLLDOWN in DSPF ?
WHERE DO WE USE COMIT KEYWORD IN AN RPG PROGRAM? YOU MADE SOME CHANGES TO DATABASE BUT YOU DON'T WANT TO SAVE THOSE CHANGES NOW? HOW DO YOU HANDLE THIS ONE?
in rpg could u please tell me errors types and meanings like 3030 that ....
Maximum how many files declare in rpgle
How to set on/off a group of indicators in a single statement?
if i have three programs progA,progB and progC .now i call progB from progA. but the progB does not exist . now i want to call progC instead of starting dump. how can we achieve this.
I have a Physical File name 'File1', which is present in two libraries named 'LIB1' & 'LIB2'. These 2 libraries are listed in the library list. Would like to access data from this file from these two libraries using RPG program. How to do this, any idea?
what is commitment control?explain about it?
How to update only a field of a PF in an RPG program. I don't want to update the record, only one field.