How to read 2 positions at a time in a data area? I have
created a data area of length and i have to read the values
of the data area like 91-92,93-94 at a time up till 100
Answers were Sorted based on User's Feedback
Answer / chandrababu
Please see below code
Ex TESTDTA value: ABCDEFGHIJKL
0001.00 PGM
0002.00 DCL VAR(&AB) TYPE(*CHAR) LEN(2)
0002.01 DCL VAR(&I) TYPE(*DEC) LEN(2) VALUE(1)
0003.00 READ: IF COND(&I *LE 24) THEN(DO)
0004.00 RTVDTAARA DTAARA(DURGA4001/TESTDTA (&I 2)) RTNVAR(&AB)
0004.01 CHGVAR VAR(&I) VALUE(&I +2)
0004.02 IF COND(&AB *NE ' ') THEN(DO)
0004.03 SNDUSRMSG MSG(&AB)
0004.04 ENDDO
0004.05 ELSE CMD(GOTO CMDLBL(END))
0006.00 GOTO READ
0007.00 ENDDO
0008.00 END:
0009.00 ENDPGM
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / chandrababu
To read two digits from data area we co as below
TESTDTA data area value is ABCDEFGHIJKL
Program:
0001.00 PGM
0002.00 DCL VAR(&AB) TYPE(*CHAR) LEN(2)
0002.01 DCL VAR(&I) TYPE(*DEC) LEN(2) VALUE(1)
0003.00 READ: IF COND(&I *LE 24) THEN(DO)
0004.00 RTVDTAARA DTAARA(DURGA4001/TESTDTA (&I 2)) RTNVAR(&AB)
0004.01 CHGVAR VAR(&I) VALUE(&I +2)
0004.02 IF COND(&AB *NE ' ') THEN(DO)
0004.03 SNDUSRMSG MSG(&AB)
0004.04 ENDDO
0004.05 ELSE CMD(GOTO CMDLBL(END))
0006.00 GOTO READ
0007.00 ENDDO
0008.00 END:
0009.00 ENDPGM
Is This Answer Correct ? | 1 Yes | 0 No |
You can achieve the above by a CL Program. I'm writing a
sample program which is reading DATA AREA 'TESTDTA' of
length 6.
PGM
DCL VAR(&A) TYPE(*CHAR) STG(*AUTO) LEN(1)
DCL VAR(&B) TYPE(*CHAR) STG(*AUTO) LEN(1)
DCL VAR(&C) TYPE(*CHAR) STG(*AUTO) LEN(1)
DCL VAR(&D) TYPE(*CHAR) STG(*AUTO) LEN(1)
DCL VAR(&E) TYPE(*CHAR) STG(*AUTO) LEN(1)
DCL VAR(&F) TYPE(*CHAR) STG(*AUTO) LEN(1)
RTVDTAARA DTAARA(ICIWRKPUS/TESTDTA (1 1)) RTNVAR(&A)
RTVDTAARA DTAARA(ICIWRKPUS/TESTDTA (2 1)) RTNVAR(&B)
RTVDTAARA DTAARA(ICIWRKPUS/TESTDTA (3 1)) RTNVAR(&C)
RTVDTAARA DTAARA(ICIWRKPUS/TESTDTA (4 1)) RTNVAR(&D)
RTVDTAARA DTAARA(ICIWRKPUS/TESTDTA (5 1)) RTNVAR(&E)
RTVDTAARA DTAARA(ICIWRKPUS/TESTDTA (6 1)) RTNVAR(&F)
SNDUSRMSG MSG(&A)
SNDUSRMSG MSG(&B)
SNDUSRMSG MSG(&C)
SNDUSRMSG MSG(&D)
SNDUSRMSG MSG(&E)
SNDUSRMSG MSG(&F)
ENDPGM
Is This Answer Correct ? | 3 Yes | 3 No |
A phisical file has two fields like 1) Account No(10,0) 2)Phone No(15,0)Unique on both fields?Please give me the answer for this?
what is the purpose of overrides?
Hi.can any body give me the code for this quesiton please.Because i dont have to try to enter the code in to the AS/400 server.Please can anybody give the answer for this question with complete code? A smple RPLE pgm which accepts the starting number and ending number as parameter.It then has to count all the odd numbers b/w the accepted range of numbers and display the results/ Ex:if the input parameters are 11 and 30 the result should be 10(11,13,15,17,19,21,23,25,27,29) Please explain and give me the complete code?
What is the purpose of SFLFOLD and SFLDROP keywords?
define the rcvf command?
Is LDA can be access accross the Job?
list some of the commonly used commands for debugging?
Job is running in production 24/7 how do u debug that running job ?
When will you use OPEN and CLOSE opcodes in RPG program?
How to create files dynamically without DDS?
explain the use of dftwrt display keyword?
is it possible to create a physical file without dds?