i made a PGM for read as well as write the record in DSPF but my PGM doesn`t read that PF it not showing any error .. it shows Blank value in varible.
PGM
DCL VAR(&WS) TYPE(*CHAR) LEN(10) /* variable */
DCL VAR(&WSPID4) TYPE(*CHAR) LEN(10) /*DSPF field*/
DCL VAR(&PDPID) TYPE(*CHAR) LEN(10) /*PF FIELD*/
DCLF FILE(KRGUNN/TP001P) OPNID(OP1) /*PF*/
DCLF FILE(KRGUNN/TPW005D) RCDFMT(RECDSP) /*DSPF*/
OPNDBF FILE(KRGUNN/TP001P) OPTION(*INP) OPNID(OP1)
POSDBF OPNID(OP1) POSITION(*START)
RCVF RCDFMT(RTP001P) OPNID(OP1) /*READ PF*/
CHGVAR VAR(&WS) VALUE(&PDPID) /*MOVE PF VALUE TO VARIABLE*/
CHGVAR VAR(&WSPID4) VALUE(&WS) /*MOVE VARIABLE TO DSPF FLD*/
SNDRCVF RCDFMT(RECDSP)
CLOF OPNID(OP1)
EXIT: ENDPGM
Software/Hardware used:
i-series
ASKED:
February 14, 2012 7:18 AM
UPDATED:
March 17, 2012 1:32 AM
THANKS ITS WORK NOW…
DCL VAR(&WS) TYPE(*CHAR) LEN(10) /* variable */
DCL VAR(&WSPID4) TYPE(*CHAR) LEN(10) /*DSPF field*/
DCL VAR(&PDPID) TYPE(*CHAR) LEN(10) /*PF FIELD*/
Why are those three lines in the program? How does your program ever put a value into &PDID? Where do you move any values into your display fields? None of those variables are part of the physical file nor of the display file.
Tom
Hi Tom u r right
DCL VAR(&WS) TYPE(*CHAR) LEN(10) /* variable */
DCL VAR(&WSPID4) TYPE(*CHAR) LEN(10) /*DSPF field*/
DCL VAR(&PDPID) TYPE(*CHAR) LEN(10) /*PF FIELD*/
these three lines are not require to add in pgm … Bcoz we can directly move the pf field value to DSPF no need to declare. But I was just adding for his reference… I dont know why he has taken that line…
I dont know why he has taken that line…
I asked so that the OP would have to think about them. By talking about them, we could understand how fields from declared files are automatically made available in a CL program.
I believe that discussion is better than only providing code. It allows some learning of principles.
Tom
Ya…. But it is not possiblae to explain line by line code here…. Thats better to provide correct solution where required… I agree discusion is better but some times…
I agree discusion is better but some times…
The site prohibits providing direct solutions for “homework” questions.
The example CL was clearly at a “learning” level. In order to determine the reason behind asking the question, some dialog is required first.
Tom
Ok Man cool down thats not any political issue to expnad our discussion… Just leave it and cool down…………
Tom, you are right on it. Basic homework question.