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 |
1)In a pf if we delete a record then how to insert a new record at the same place in that pf?? any logic or code? 2)A batch job is taking a lot of time to run,found that it is going into loop and wrapping up so how to skip that loop and process the job without changing the code? 3)In which scenario C D I R comes and C D G F comes in a job? 4)If a job came to error while processing a file how we can know at which record the error hit and how to skip that record and process other records without changing program code?
What is the purpose of reorganizing the physical file i.e. , RGZPFM?
How can we create subsystem in as400?
What is the use of jdftval in as400?
Space & Skip Are Which Level Keywords?
what does vldcmdkey means?
What is the purpose of SFLFOLD and SFLDROP keywords?
1.what are the builtin funtions in cl pgg?Explain with example 2.what is meant by left outer join?where we can use this?
What is the purpose of CHGPF (Change physical file) command?
What is difference between rename and prefix?
what do we can do with the embedded sql statements?
define subsystem?