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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the different types of data areas?

983


how many files, printer files you can describe in a rpg?

632


what is the maximum number of record formats in dspf?

991


What are the different opcodes used for file operation on a subfile in a rpg pgm?

1095


What Is The Error If We Don't Get Login Screen?

677






when would you use or not use this approach?

888


how do you specify the number of records to roll in a subfile ?

1241


how do you use exceptional write in c specs?

1150


what is match field indicator?

1023


different type of cursor?

640


what are the different opcodes available in rpg for database access ?

813


why do we use readc? What is sflnxtchg?

670


what is the use of data structures?

637


is it possible to create a physical file without dds?

1196


How Many Specs Are There In Rpg & Which Are They?

683