as400 interview questions and answers-Part 12
1. Give example of EDTWRD keyword in AS400.
Ans:
EDTWRD
· Sometimes we are not able to get the desire editing result
by EDTCDE. In that case it is better to go for EDTWRD.
· In the EDTWRD parameter we specify the format matching the
required data.
· This keyword is valid only for numeric field (Specified
with ‘Y’ data type).
Example - I
A R DETAIL
A FLD1 10Y 0B 3 12EDTWRD(' - - - - ')
A COLOR(RED)
A 3 2'FIELD-1: '
OUTPUT
FIELD-1: 11-22-33-44-55
Example - II
A R DETAIL
A FLD1 10Y 3B 3 12EDTWRD('$ . ')
A COLOR(RED)
A 3 2'FIELD-1: '
OUTPUT
FIELD-1: $1122334.455
Here, currency
symbol used is not part of the data length displayed on the screen.
Example - III
A S_FLD001 10Y 3O 2 10EDTWRD(' . ')
OUTPUT
S_OFRMAMT =
9999999.999
Example - IV
A C_FLD001 10 2O 08 38
A EDTWRD(' 0. ')
OUTPUT
Before EDTWRD,
Value of C_FLD001= .12
After EDTWRD,
Value of C_FLD001=0.12
Example - V
A STIME56 6Y 0O 13 13
A EDTWRD('0 : : ')
OUTPUT
Before EDTWRD,
Value of STIME= 1:12:12
After EDTWRD,
Value of STIME=01:12:12
A zero stops zero
suppression.
We place it in
the farthest right position where zero suppression is to stop. That’s why here
the time is not suppressed at the leftmost position.
**Note: We have
given 2 blank spaces after ‘0’ in EDTWRD.
2. Explain FLDCSRPRG with example.
Ans:
FLDCSRPRG
· This field-level keyword is used to define the field to
which the cursor moves when exiting this field.
Example
In the example
below the cursor will be at the initial field S_ORG and then after field
exiting will progress to the next field S_ACC and then S_CCY and S_PARTY after
that.
0004.00 A R HEADER
0005.00 A 1 30'ACCOUNT ENTRY DISPLAY'
0006.00 A DSPATR(HI)
0007.00 A COLOR(BLU)
0008.00 A 4 25'ORG'
0009.00 A DSPATR(HI)
0010.00 A COLOR(BLU)
0011.00 A S_ORG 3S 0B 4 35
0011.01 A FLDCSRPRG(S_ACC)
0012.00 A 50 DSPATR(RI)
0013.00 A 5 25'ACC'
0014.00 A DSPATR(HI)
0015.00 A COLOR(BLU)
0016.00 A S_ACC 12A B 5 35
0016.01 A FLDCSRPRG(S_CCY)
0017.00 A 51 DSPATR(RI)
0018.00 A 6 25'CCY'
0019.00 A DSPATR(HI)
0020.00 A COLOR(BLU)
0021.00 A S_CCY 3A B 6 35
0021.01 A FLDCSRPRG(S_PARTY)
0022.00 A 52 DSPATR(RI)
0023.00 A 7 25'PARTY'
0024.00 A DSPATR(HI)
0025.00 A COLOR(BLU)
0026.00 A S_PARTY 12A B 7 35
0027.00 A 53 DSPATR(RI)